diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-01-12 17:42:39 -0800 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2012-01-16 17:10:54 -0800 |
commit | 95740c40dc0b78f1342ec0c257664b4300a07e6b (patch) | |
tree | 5a9addf353bc813d3c993f78098c0cf1e2e9be1c | |
parent | a0bdcf4b6af8cf34f8421c373f6b19b74e441db9 (diff) | |
download | external_webkit-95740c40dc0b78f1342ec0c257664b4300a07e6b.zip external_webkit-95740c40dc0b78f1342ec0c257664b4300a07e6b.tar.gz external_webkit-95740c40dc0b78f1342ec0c257664b4300a07e6b.tar.bz2 |
Support javascript to exit full screen video
When webkit side receive the webkitExitFullscreen, just send it over to the
java side.
framework change:
https://android-git.corp.google.com/g/#/c/158653/
Change-Id: Ice2a5ea33458a8bf3e6990e288d94d5f032b0921
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp | 5 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 17 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index ab5fcb0..f907440 100644 --- a/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -638,6 +638,11 @@ void ChromeClientAndroid::enterFullscreenForNode(Node* node) void ChromeClientAndroid::exitFullscreenForNode(Node* node) { + FrameView* frameView = m_webFrame->page()->mainFrame()->view(); + android::WebViewCore* core = android::WebViewCore::getWebViewCore(frameView); + if (core) + core->exitFullscreenVideo(); + return; } #endif diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index b7c4648..6737329 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -304,6 +304,7 @@ struct WebViewCore::JavaGlue { jmethodID m_setScrollbarModes; jmethodID m_setInstallableWebApp; jmethodID m_enterFullscreenForVideoLayer; + jmethodID m_exitFullscreenVideo; jmethodID m_setWebTextViewAutoFillable; jmethodID m_selectAt; AutoJObject object(JNIEnv* env) { @@ -377,6 +378,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m , m_isPaused(false) , m_cacheMode(0) , m_shouldPaintCaret(true) + , m_fullscreenVideoMode(false) , m_pluginInvalTimer(this, &WebViewCore::pluginInvalTimerFired) , m_screenOnCounter(0) , m_currentNodeDomNavigationAxis(0) @@ -439,6 +441,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_javaGlue->m_setInstallableWebApp = GetJMethod(env, clazz, "setInstallableWebApp", "()V"); #if ENABLE(VIDEO) m_javaGlue->m_enterFullscreenForVideoLayer = GetJMethod(env, clazz, "enterFullscreenForVideoLayer", "(ILjava/lang/String;)V"); + m_javaGlue->m_exitFullscreenVideo = GetJMethod(env, clazz, "exitFullscreenVideo", "()V"); #endif m_javaGlue->m_setWebTextViewAutoFillable = GetJMethod(env, clazz, "setWebTextViewAutoFillable", "(ILjava/lang/String;)V"); m_javaGlue->m_selectAt = GetJMethod(env, clazz, "selectAt", "(II)V"); @@ -3887,6 +3890,20 @@ void WebViewCore::enterFullscreenForVideoLayer(int layerId, const WTF::String& u return; jstring jUrlStr = wtfStringToJstring(env, url); env->CallVoidMethod(javaObject.get(), m_javaGlue->m_enterFullscreenForVideoLayer, layerId, jUrlStr); + m_fullscreenVideoMode = true; + checkException(env); +} + +void WebViewCore::exitFullscreenVideo() +{ + JNIEnv* env = JSC::Bindings::getJNIEnv(); + AutoJObject javaObject = m_javaGlue->object(env); + if (!javaObject.get()) + return; + if (m_fullscreenVideoMode) { + env->CallVoidMethod(javaObject.get(), m_javaGlue->m_exitFullscreenVideo); + m_fullscreenVideoMode = false; + } checkException(env); } #endif diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index 9e7c4af..69b805c 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -559,6 +559,7 @@ namespace android { #if ENABLE(VIDEO) void enterFullscreenForVideoLayer(int layerId, const WTF::String& url); + void exitFullscreenVideo(); #endif void setWebTextViewAutoFillable(int queryId, const string16& previewSummary); @@ -700,6 +701,7 @@ namespace android { bool m_isPaused; int m_cacheMode; bool m_shouldPaintCaret; + bool m_fullscreenVideoMode; SkTDArray<PluginWidgetAndroid*> m_plugins; WebCore::Timer<WebViewCore> m_pluginInvalTimer; |