summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 12:03:42 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 12:03:42 +0000
commit99c014ccedd421202354c35922a2b2c19784a884 (patch)
treebb25cca69a6487a672c84015dad630ebd430eb52
parent97f3561f4d61087f2ec16e36cf286c01fef469ac (diff)
downloadchromium_src-99c014ccedd421202354c35922a2b2c19784a884.zip
chromium_src-99c014ccedd421202354c35922a2b2c19784a884.tar.gz
chromium_src-99c014ccedd421202354c35922a2b2c19784a884.tar.bz2
[content shell] add support for entering/exiting fullscreen mode for layout test
BUG=111316 TEST=fullscreen layout tests pass R=marja@chromium.org Review URL: https://chromiumcodereview.appspot.com/11308223 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169642 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/shell/shell.cc24
-rw-r--r--content/shell/shell.h14
-rw-r--r--content/shell/shell_android.cc7
3 files changed, 38 insertions, 7 deletions
diff --git a/content/shell/shell.cc b/content/shell/shell.cc
index 8bed9bd..0fff828 100644
--- a/content/shell/shell.cc
+++ b/content/shell/shell.cc
@@ -41,7 +41,8 @@ base::Callback<void(Shell*)> Shell::shell_created_callback_;
bool Shell::quit_message_loop_ = true;
Shell::Shell(WebContents* web_contents)
- : window_(NULL),
+ : is_fullscreen_(false),
+ window_(NULL),
url_edit_view_(NULL)
#if defined(OS_WIN) && !defined(USE_AURA)
, default_edit_wnd_proc_(0)
@@ -191,6 +192,27 @@ void Shell::LoadingStateChanged(WebContents* source) {
PlatformSetIsLoading(source->IsLoading());
}
+void Shell::ToggleFullscreenModeForTab(WebContents* web_contents,
+ bool enter_fullscreen) {
+#if defined(OS_ANDROID)
+ PlatformToggleFullscreenModeForTab(web_contents, enter_fullscreen);
+#endif
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
+ return;
+ if (is_fullscreen_ != enter_fullscreen) {
+ is_fullscreen_ = enter_fullscreen;
+ web_contents->GetRenderViewHost()->WasResized();
+ }
+}
+
+bool Shell::IsFullscreenForTabOrPending(const WebContents* web_contents) const {
+#if defined(OS_ANDROID)
+ return PlatformIsFullscreenForTabOrPending(web_contents);
+#else
+ return is_fullscreen_;
+#endif
+}
+
void Shell::CloseContents(WebContents* source) {
Close();
}
diff --git a/content/shell/shell.h b/content/shell/shell.h
index f22e03a..6934c97 100644
--- a/content/shell/shell.h
+++ b/content/shell/shell.h
@@ -104,11 +104,11 @@ class Shell : public WebContentsDelegate,
#if defined(OS_ANDROID)
virtual void LoadProgressChanged(WebContents* source,
double progress) OVERRIDE;
- virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents,
+#endif
+ virtual void ToggleFullscreenModeForTab(WebContents* web_contents,
bool enter_fullscreen) OVERRIDE;
virtual bool IsFullscreenForTabOrPending(
- const content::WebContents* web_contents) const OVERRIDE;
-#endif
+ const WebContents* web_contents) const OVERRIDE;
virtual void CloseContents(WebContents* source) OVERRIDE;
virtual bool CanOverscrollContent() const OVERRIDE;
virtual void WebContentsCreated(WebContents* source_contents,
@@ -160,6 +160,12 @@ class Shell : public WebContentsDelegate,
void PlatformSetIsLoading(bool loading);
// Set the title of shell window
void PlatformSetTitle(const string16& title);
+#if defined(OS_ANDROID)
+ void PlatformToggleFullscreenModeForTab(WebContents* web_contents,
+ bool enter_fullscreen);
+ bool PlatformIsFullscreenForTabOrPending(
+ const WebContents* web_contents) const;
+#endif
#if (defined(OS_WIN) && !defined(USE_AURA)) || defined(TOOLKIT_GTK)
// Resizes the main window to the given dimensions.
@@ -197,6 +203,8 @@ class Shell : public WebContentsDelegate,
scoped_ptr<WebContents> web_contents_;
+ bool is_fullscreen_;
+
gfx::NativeWindow window_;
gfx::NativeEditView url_edit_view_;
diff --git a/content/shell/shell_android.cc b/content/shell/shell_android.cc
index 5fb8cb0..66663e0 100644
--- a/content/shell/shell_android.cc
+++ b/content/shell/shell_android.cc
@@ -66,14 +66,15 @@ void Shell::LoadProgressChanged(WebContents* source, double progress) {
Java_Shell_onLoadProgressChanged(env, java_object_.obj(), progress);
}
-void Shell::ToggleFullscreenModeForTab(WebContents* web_contents,
- bool enter_fullscreen) {
+void Shell::PlatformToggleFullscreenModeForTab(WebContents* web_contents,
+ bool enter_fullscreen) {
JNIEnv* env = AttachCurrentThread();
Java_Shell_toggleFullscreenModeForTab(
env, java_object_.obj(), enter_fullscreen);
}
-bool Shell::IsFullscreenForTabOrPending(const WebContents* web_contents) const {
+bool Shell::PlatformIsFullscreenForTabOrPending(
+ const WebContents* web_contents) const {
JNIEnv* env = AttachCurrentThread();
return Java_Shell_isFullscreenForTabOrPending(env, java_object_.obj());
}