summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2012-01-17 15:35:10 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-17 15:35:10 -0800
commit8df0eba6a3a17a722e4501827666ab5d7ae00f92 (patch)
tree46b2db1f2c802793d86ce4372b9bca9f2ed94c7d
parentf5c4d4a38743557eb4a5405151d9bee21daab0bd (diff)
parent95740c40dc0b78f1342ec0c257664b4300a07e6b (diff)
downloadexternal_webkit-8df0eba6a3a17a722e4501827666ab5d7ae00f92.zip
external_webkit-8df0eba6a3a17a722e4501827666ab5d7ae00f92.tar.gz
external_webkit-8df0eba6a3a17a722e4501827666ab5d7ae00f92.tar.bz2
Merge "Support javascript to exit full screen video"
-rw-r--r--Source/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp5
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp17
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h2
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 4c0699b..703f177 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -305,6 +305,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) {
@@ -378,6 +379,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)
@@ -440,6 +442,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");
@@ -3901,6 +3904,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 0f38ccf..06f6b97 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -562,6 +562,7 @@ namespace android {
#if ENABLE(VIDEO)
void enterFullscreenForVideoLayer(int layerId, const WTF::String& url);
+ void exitFullscreenVideo();
#endif
void setWebTextViewAutoFillable(int queryId, const string16& previewSummary);
@@ -703,6 +704,7 @@ namespace android {
bool m_isPaused;
int m_cacheMode;
bool m_shouldPaintCaret;
+ bool m_fullscreenVideoMode;
SkTDArray<PluginWidgetAndroid*> m_plugins;
WebCore::Timer<WebViewCore> m_pluginInvalTimer;