diff options
Diffstat (limited to 'WebKit/android/jni')
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 29 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.h | 7 |
2 files changed, 31 insertions, 5 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index c6034aa..4bff8a7 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -291,7 +291,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m 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;)V"); + m_javaGlue->m_showFullScreenPlugin = GetJMethod(env, clazz, "showFullScreenPlugin", "(Landroid/webkit/plugin/WebkitPlugin;I)V"); m_javaGlue->m_hideFullScreenPlugin = GetJMethod(env, clazz, "hideFullScreenPlugin", "()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"); @@ -1442,6 +1442,18 @@ void WebViewCore::sendPluginEvent(const ANPEvent& evt) } } +PluginWidgetAndroid* WebViewCore::getPluginWidget(NPP npp) +{ + PluginWidgetAndroid** iter = m_plugins.begin(); + PluginWidgetAndroid** stop = m_plugins.end(); + for (; iter < stop; ++iter) { + if ((*iter)->pluginView()->instance() == npp) { + return (*iter); + } + } + return NULL; +} + static PluginView* nodeIsPlugin(Node* node) { RenderObject* renderer = node->renderer(); if (renderer && renderer->isWidget()) { @@ -2548,7 +2560,7 @@ jobject WebViewCore::createPluginJavaInstance(const WebCore::String& libName, NP return result; } -void WebViewCore::showFullScreenPlugin(jobject webkitPlugin) +void WebViewCore::showFullScreenPlugin(jobject webkitPlugin, NPP npp) { JNIEnv* env = JSC::Bindings::getJNIEnv(); AutoJObject obj = m_javaGlue->object(env); @@ -2558,7 +2570,8 @@ void WebViewCore::showFullScreenPlugin(jobject webkitPlugin) return; env->CallVoidMethod(obj.get(), - m_javaGlue->m_showFullScreenPlugin, webkitPlugin); + m_javaGlue->m_showFullScreenPlugin, + webkitPlugin, (int)npp); checkException(env); } @@ -3198,6 +3211,14 @@ static void ProvideVisitedHistory(JNIEnv *env, jobject obj, jobject hist) env->DeleteLocalRef(array); } +// Notification from the UI thread that the plugin's full-screen surface has been discarded +static void FullScreenPluginHidden(JNIEnv* env, jobject obj, jint npp) +{ + WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + PluginWidgetAndroid* plugin = viewImpl->getPluginWidget((NPP)npp); + plugin->exitFullScreen(false); +} + // ---------------------------------------------------------------------------- /* @@ -3292,6 +3313,8 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) UpdateFrameCacheIfLoading }, { "nativeProvideVisitedHistory", "([Ljava/lang/String;)V", (void*) ProvideVisitedHistory }, + { "nativeFullScreenPluginHidden", "(I)V", + (void*) FullScreenPluginHidden }, }; int register_webviewcore(JNIEnv* env) diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index a469329..3f00f3c 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -364,6 +364,9 @@ namespace android { // send this event to all of the plugins who have the given flag set void sendPluginEvent(const ANPEvent& evt, ANPEventFlag flag); + // lookup the plugin widget struct given an NPP + PluginWidgetAndroid* getPluginWidget(NPP npp); + // return the cursorNode if it is a plugin Node* cursorNodeIsPlugin(); @@ -380,9 +383,9 @@ namespace android { jobject createPluginJavaInstance(const WebCore::String& libName, NPP npp); // Creates a full screen surface for a plugin - void showFullScreenPlugin(jobject webkitPlugin); + void showFullScreenPlugin(jobject webkitPlugin, NPP npp); - // Discards the full screen surface of a plugin + // Instructs the UI thread to discard the plugin's full-screen surface void hideFullScreenPlugin(); // Creates a Surface (i.e. View) for a plugin |
