diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-05-05 15:30:38 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-05-09 14:56:28 -0700 |
commit | bb6c037d4178a0b35e964651e09323c8d714f435 (patch) | |
tree | 7b06395547e9d94d86059b4d22bbfa2138ed0e2f /WebKit | |
parent | 7703c9980a33dc32db8120d1677478aca020ebbd (diff) | |
download | external_webkit-bb6c037d4178a0b35e964651e09323c8d714f435.zip external_webkit-bb6c037d4178a0b35e964651e09323c8d714f435.tar.gz external_webkit-bb6c037d4178a0b35e964651e09323c8d714f435.tar.bz2 |
Better support for exiting full screen
When exiting the full screen, we need to let the webkit know the status.
bug:4312214
Change-Id: I4e475da3b426176fd232551e16fbe740994d8d36
Diffstat (limited to 'WebKit')
3 files changed, 33 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index 5cfa1b5..6f872b8 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -581,6 +581,7 @@ void ChromeClientAndroid::enterFullscreenForNode(Node* node) FrameView* frameView = m_webFrame->page()->mainFrame()->view(); android::WebViewCore* core = android::WebViewCore::getWebViewCore(frameView); + m_webFrame->page()->mainFrame()->document()->webkitWillEnterFullScreenForElement(videoElement); if (core) core->enterFullscreenForVideoLayer(layer->uniqueId(), url); } @@ -590,5 +591,15 @@ void ChromeClientAndroid::exitFullscreenForNode(Node* node) } #endif +#if ENABLE(FULLSCREEN_API) +void ChromeClientAndroid::exitFullScreenForElement(Element* element) +{ + if (!element) + return; + + HTMLMediaElement* videoElement = static_cast<HTMLMediaElement*>(element); + videoElement->exitFullscreen(); +} +#endif } diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h index 2b6f68a..d49cec8 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h @@ -187,6 +187,10 @@ namespace android { virtual void webAppCanBeInstalled(); #endif +#if ENABLE(FULLSCREEN_API) + virtual void exitFullScreenForElement(Element*); +#endif + #if ENABLE(VIDEO) virtual bool supportsFullscreenForNode(const WebCore::Node*); virtual void enterFullscreenForNode(WebCore::Node*); diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index 982e384..e6a2710 100644 --- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -180,6 +180,14 @@ void MediaPlayerPrivate::onTimeupdate(int position) m_player->timeChanged(); } +void MediaPlayerPrivate::onStopFullscreen() +{ + if (m_player && m_player->mediaPlayerClient() + && m_player->mediaPlayerClient()->mediaPlayerOwningDocument()) { + m_player->mediaPlayerClient()->mediaPlayerOwningDocument()->webkitCancelFullScreen(); + } +} + class MediaPlayerVideoPrivate : public MediaPlayerPrivate { public: void load(const String& url) @@ -590,6 +598,14 @@ static bool SendSurfaceTexture(JNIEnv* env, jobject obj, jobject surfTex, return true; } +static void OnStopFullscreen(JNIEnv* env, jobject obj, int pointer) +{ + if (pointer) { + WebCore::MediaPlayerPrivate* player = + reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer); + player->onStopFullscreen(); + } +} /* * JNI registration @@ -599,6 +615,8 @@ static JNINativeMethod g_MediaPlayerMethods[] = { (void*) OnPrepared }, { "nativeOnEnded", "(I)V", (void*) OnEnded }, + { "nativeOnStopFullscreen", "(I)V", + (void*) OnStopFullscreen }, { "nativeOnPaused", "(I)V", (void*) OnPaused }, { "nativeOnPosterFetched", "(Landroid/graphics/Bitmap;I)V", |