jmethodID m_createPluginJavaInstance;
jmethodID m_showFullScreenPlugin;
jmethodID m_hideFullScreenPlugin;
+ jmethodID m_updateFullScreenPlugin;
jmethodID m_createSurface;
jmethodID m_updateSurface;
jmethodID m_destroySurface;
m_javaGlue->m_addMessageToConsole = GetJMethod(env, clazz, "addMessageToConsole", "(Ljava/lang/String;ILjava/lang/String;)V");
m_javaGlue->m_getPluginClass = GetJMethod(env, clazz, "getPluginClass", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Class;");
m_javaGlue->m_createPluginJavaInstance = GetJMethod(env, clazz, "createPluginJavaInstance", "(Ljava/lang/String;I)Landroid/webkit/plugin/WebkitPlugin;");
- m_javaGlue->m_showFullScreenPlugin = GetJMethod(env, clazz, "showFullScreenPlugin", "(Landroid/webkit/plugin/WebkitPlugin;I)V");
+ m_javaGlue->m_showFullScreenPlugin = GetJMethod(env, clazz, "showFullScreenPlugin", "(Landroid/webkit/plugin/WebkitPlugin;IIIII)V");
m_javaGlue->m_hideFullScreenPlugin = GetJMethod(env, clazz, "hideFullScreenPlugin", "()V");
+ m_javaGlue->m_updateFullScreenPlugin = GetJMethod(env, clazz, "updateFullScreenPlugin", "(IIII)V");
m_javaGlue->m_createSurface = GetJMethod(env, clazz, "createSurface", "(Landroid/webkit/plugin/WebkitPlugin;IIII)Landroid/webkit/ViewManager$ChildView;");
m_javaGlue->m_updateSurface = GetJMethod(env, clazz, "updateSurface", "(Landroid/webkit/ViewManager$ChildView;IIII)V");
m_javaGlue->m_destroySurface = GetJMethod(env, clazz, "destroySurface", "(Landroid/webkit/ViewManager$ChildView;)V");
return result;
}
-void WebViewCore::showFullScreenPlugin(jobject webkitPlugin, NPP npp)
+void WebViewCore::showFullScreenPlugin(jobject webkitPlugin, NPP npp, int x,
+ int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = m_javaGlue->object(env);
env->CallVoidMethod(obj.get(),
m_javaGlue->m_showFullScreenPlugin,
- webkitPlugin, (int)npp);
+ webkitPlugin, (int)npp, x, y, width, height);
checkException(env);
}
checkException(env);
}
+void WebViewCore::updateFullScreenPlugin(int x, int y, int width, int height)
+{
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_updateFullScreenPlugin, x, y,
+ width, height);
+ checkException(env);
+}
+
jobject WebViewCore::createSurface(jobject webkitPlugin, int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
jobject createPluginJavaInstance(const WebCore::String& libName, NPP npp);
// Creates a full screen surface for a plugin
- void showFullScreenPlugin(jobject webkitPlugin, NPP npp);
+ void showFullScreenPlugin(jobject webkitPlugin, NPP npp, int x, int y, int width, int height);
// Instructs the UI thread to discard the plugin's full-screen surface
void hideFullScreenPlugin();
+ // Update coordinates and dimensions for a full screen plugin
+ void updateFullScreenPlugin(int x, int y, int width, int height);
+
// Creates a Surface (i.e. View) for a plugin
jobject createSurface(jobject webkitPlugin, int x, int y, int width, int height);
m_embeddedView = env->NewGlobalRef(tempObj);
}
}
+ if (m_isFullScreen && m_pluginBounds != oldPluginBounds) {
+ m_core->updateFullScreenPlugin(docPoint.x(), docPoint.y(),
+ window->width, window->height);
+ }
} else {
m_flipPixelRef->safeUnref();
m_flipPixelRef = new SkFlipPixelRef(computeConfig(isTransparent),
return;
}
- m_core->showFullScreenPlugin(m_webkitPlugin, m_pluginView->instance());
+ IntPoint docPoint = frameToDocumentCoords(m_pluginWindow->x, m_pluginWindow->y);
+ m_core->showFullScreenPlugin(m_webkitPlugin, m_pluginView->instance(),
+ docPoint.x(), docPoint.y(), m_pluginWindow->width,
+ m_pluginWindow->height);
m_isFullScreen = true;
}