diff options
author | hugo.holgersson <hugo.holgersson@sonymobile.com> | 2015-01-22 00:47:14 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-22 08:47:56 +0000 |
commit | 4f1b4544ed3786cd8c09c2620568d0d9e508f2ba (patch) | |
tree | a3eefae789c63da33a5c399142c376c47eeb321c /android_webview/native | |
parent | 9b00baf317328c2b8e61845db4a5708797b1418b (diff) | |
download | chromium_src-4f1b4544ed3786cd8c09c2620568d0d9e508f2ba.zip chromium_src-4f1b4544ed3786cd8c09c2620568d0d9e508f2ba.tar.gz chromium_src-4f1b4544ed3786cd8c09c2620568d0d9e508f2ba.tar.bz2 |
Reduce duplicated code in AwWebContentsDelegate
This is pure refactoring. Functionality should not be affected.
CL reduces duplicated code that AwWebContentsDelegate copied
from WebContentsDelegateAndroid.
Background: This cleanup is a first step towards moving the
responsibility of ContentVideoView from the content embedders to
the content-layer. The goal is to let WebContentsDelegateAndroid's
ExitFullscreenModeForTab do the work that is common to both
WebViews and Android Chrome; for example, tearing down
ContentVideoView when fullscreen exits.
BUG=449152
Review URL: https://codereview.chromium.org/865613002
Cr-Commit-Position: refs/heads/master@{#312590}
Diffstat (limited to 'android_webview/native')
-rw-r--r-- | android_webview/native/aw_web_contents_delegate.cc | 19 | ||||
-rw-r--r-- | android_webview/native/aw_web_contents_delegate.h | 2 |
2 files changed, 5 insertions, 16 deletions
diff --git a/android_webview/native/aw_web_contents_delegate.cc b/android_webview/native/aw_web_contents_delegate.cc index b18354e..2f43de1ae 100644 --- a/android_webview/native/aw_web_contents_delegate.cc +++ b/android_webview/native/aw_web_contents_delegate.cc @@ -210,24 +210,15 @@ void AwWebContentsDelegate::RequestMediaAccessPermission( void AwWebContentsDelegate::EnterFullscreenModeForTab( content::WebContents* web_contents, const GURL& origin) { - ToggleFullscreenModeForTab(web_contents, true); + WebContentsDelegateAndroid::EnterFullscreenModeForTab(web_contents, origin); + is_fullscreen_ = true; + web_contents->GetRenderViewHost()->WasResized(); } void AwWebContentsDelegate::ExitFullscreenModeForTab( content::WebContents* web_contents) { - ToggleFullscreenModeForTab(web_contents, false); -} - -void AwWebContentsDelegate::ToggleFullscreenModeForTab( - content::WebContents* web_contents, bool enter_fullscreen) { - JNIEnv* env = AttachCurrentThread(); - - ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env); - if (java_delegate.obj()) { - Java_AwWebContentsDelegate_toggleFullscreenModeForTab( - env, java_delegate.obj(), enter_fullscreen); - } - is_fullscreen_ = enter_fullscreen; + WebContentsDelegateAndroid::ExitFullscreenModeForTab(web_contents); + is_fullscreen_ = false; web_contents->GetRenderViewHost()->WasResized(); } diff --git a/android_webview/native/aw_web_contents_delegate.h b/android_webview/native/aw_web_contents_delegate.h index 1346267..8a17a3e 100644 --- a/android_webview/native/aw_web_contents_delegate.h +++ b/android_webview/native/aw_web_contents_delegate.h @@ -61,8 +61,6 @@ class AwWebContentsDelegate const content::WebContents* web_contents) const override; private: - void ToggleFullscreenModeForTab(content::WebContents* web_contents, - bool enter_fullscreen); bool is_fullscreen_; }; |