From 44c10a8cd1ade56e9be8b76b0dc105ad312804b9 Mon Sep 17 00:00:00 2001 From: "oshima@chromium.org" Date: Tue, 19 Nov 2013 02:08:17 +0000 Subject: Revert 235861 "Add ash-enable-immersive-all-windows command line..." > Add ash-enable-immersive-all-windows command line flag to enable immersive fullscreen for non-frameless v2 apps. (The goal is to add support for immersive fullscreen for v1 apps and miscellaneous windows such as the task manager shortly) When the flag is set, will put the app into immersive fullscreen. > > In immersive fullscreen, the window header (the title bar and window controls) slide out as an overlay over the web contents when the mouse is hovered at the top of the display. > > chrome.app.window.current().isFullscreen() returns false for immersive fullscreen windows > Entering fullscreen via the app.window api or webkitRequestFullScreen() quits immersive fullscreen. > > BUG=307622 > R=oshima,benwells > TBR=sky (For adding VIEWS_EXPORT to ui/views/widget/widget_observer.h) > TEST=Manual, see steps below: > 1) Install: https://chrome.google.com/webstore/detail/window-state-sample/hcbhfbnaaancmblfhdknlnojpafjohbi > 2) Enable "Enable immersive fullscreen for non browser windows" in chrome://flags > 3) Hit > 4) Ensure that the "isFullscreen" checkbox in the app is checked > 5) Ensure that the shelf light bar is visible (The shelf is not completely hidden) > 6) Hover the mouse at the top of the screen. Ensure that the window header (maximize and close button slide down and overlay the web contents) > 7) Move the mouse off of the header. Ensure that the window header slides off screen > 8) Press the Fullscreen button in the app (It may be useful to set the "chrome.app.window actions delay" to zero seconds) > 9) Ensure that the shelf is completely hidden. > 10) Hover the mouse at the top of the screen. Ensure that the header slides out again. > 11) Press > 12) Ensure that the "isFullscreen" checkbox is unchecked > 13) Ensure that the window header is visible and does not slide out > > Review URL: https://codereview.chromium.org/59043013 BUG=307622,320938 TBR=pkotwicz@chromium.org Review URL: https://codereview.chromium.org/73623008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235895 0039d316-1c4b-4281-b951-d872f2087c98 --- apps/shell_window.cc | 38 ++++++++++++++++---------------------- apps/shell_window.h | 24 ++++-------------------- apps/ui/native_app_window.h | 7 ++----- 3 files changed, 22 insertions(+), 47 deletions(-) (limited to 'apps') diff --git a/apps/shell_window.cc b/apps/shell_window.cc index 2c0b3fac..5e4098f 100644 --- a/apps/shell_window.cc +++ b/apps/shell_window.cc @@ -141,7 +141,8 @@ ShellWindow::ShellWindow(Profile* profile, window_type_(WINDOW_TYPE_DEFAULT), delegate_(delegate), image_loader_ptr_factory_(this), - fullscreen_types_(FULLSCREEN_TYPE_NONE), + fullscreen_for_window_api_(false), + fullscreen_for_tab_(false), show_on_first_paint_(false), first_paint_complete_(false) { } @@ -403,8 +404,8 @@ void ShellWindow::Fullscreen() { if (!profile()->GetPrefs()->GetBoolean(prefs::kAppFullscreenAllowed)) return; #endif - fullscreen_types_ |= FULLSCREEN_TYPE_WINDOW_API; - GetBaseWindow()->SetFullscreen(fullscreen_types_); + fullscreen_for_window_api_ = true; + GetBaseWindow()->SetFullscreen(true); } void ShellWindow::Maximize() { @@ -416,24 +417,15 @@ void ShellWindow::Minimize() { } void ShellWindow::Restore() { - if (fullscreen_types_ != FULLSCREEN_TYPE_NONE) { - fullscreen_types_ = FULLSCREEN_TYPE_NONE; - GetBaseWindow()->SetFullscreen(fullscreen_types_); + fullscreen_for_window_api_ = false; + fullscreen_for_tab_ = false; + if (GetBaseWindow()->IsFullscreenOrPending()) { + GetBaseWindow()->SetFullscreen(false); } else { GetBaseWindow()->Restore(); } } -void ShellWindow::OSFullscreen() { -#if !defined(OS_MACOSX) - // Do not enter fullscreen mode if disallowed by pref. - if (!profile()->GetPrefs()->GetBoolean(prefs::kAppFullscreenAllowed)) - return; -#endif - fullscreen_types_ |= FULLSCREEN_TYPE_OS; - GetBaseWindow()->SetFullscreen(fullscreen_types_); -} - void ShellWindow::SetMinimumSize(const gfx::Size& min_size) { size_constraints_.set_minimum_size(min_size); OnSizeConstraintsChanged(); @@ -593,16 +585,18 @@ void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source, return; } - if (enter_fullscreen) - fullscreen_types_ |= FULLSCREEN_TYPE_HTML_API; - else - fullscreen_types_ &= ~FULLSCREEN_TYPE_HTML_API; - GetBaseWindow()->SetFullscreen(fullscreen_types_); + fullscreen_for_tab_ = enter_fullscreen; + + if (enter_fullscreen) { + native_app_window_->SetFullscreen(true); + } else if (!fullscreen_for_window_api_) { + native_app_window_->SetFullscreen(false); + } } bool ShellWindow::IsFullscreenForTabOrPending( const content::WebContents* source) const { - return ((fullscreen_types_ & FULLSCREEN_TYPE_HTML_API) != 0); + return fullscreen_for_tab_; } void ShellWindow::Observe(int type, diff --git a/apps/shell_window.h b/apps/shell_window.h index 9890038..c236a1d 100644 --- a/apps/shell_window.h +++ b/apps/shell_window.h @@ -92,21 +92,6 @@ class ShellWindow : public content::NotificationObserver, FRAME_NONE, // Frameless window. }; - enum FullscreenType { - // Not fullscreen. - FULLSCREEN_TYPE_NONE = 0, - - // Fullscreen entered by the app.window api. - FULLSCREEN_TYPE_WINDOW_API = 1 << 0, - - // Fullscreen entered by HTML requestFullscreen(). - FULLSCREEN_TYPE_HTML_API = 1 << 1, - - // Fullscreen entered by the OS. ChromeOS uses this type of fullscreen to - // enter immersive fullscreen when the user hits the key. - FULLSCREEN_TYPE_OS = 1 << 2 - }; - class SizeConstraints { public: // The value SizeConstraints uses to represent an unbounded width or height. @@ -299,9 +284,6 @@ class ShellWindow : public content::NotificationObserver, void Minimize(); void Restore(); - // Transitions to OS fullscreen. See FULLSCREEN_TYPE_OS for more details. - void OSFullscreen(); - // Set the minimum and maximum size that this window is allowed to be. void SetMinimumSize(const gfx::Size& min_size); void SetMaximumSize(const gfx::Size& max_size); @@ -462,8 +444,10 @@ class ShellWindow : public content::NotificationObserver, base::WeakPtrFactory image_loader_ptr_factory_; - // Bit field of FullscreenType. - int fullscreen_types_; + // Fullscreen entered by app.window api. + bool fullscreen_for_window_api_; + // Fullscreen entered by HTML requestFullscreen. + bool fullscreen_for_tab_; // Size constraints on the window. SizeConstraints size_constraints_; diff --git a/apps/ui/native_app_window.h b/apps/ui/native_app_window.h index 73f6f88..222a680 100644 --- a/apps/ui/native_app_window.h +++ b/apps/ui/native_app_window.h @@ -18,11 +18,8 @@ namespace apps { class NativeAppWindow : public ui::BaseWindow, public web_modal::WebContentsModalDialogHost { public: - // Sets whether the window is fullscreen and the type of fullscreen. - // |fullscreen_types| is a bit field of ShellWindow::FullscreenType. - virtual void SetFullscreen(int fullscreen_types) = 0; - - // Returns whether the window is fullscreen or about to enter fullscreen. + // Fullscreen changes may be asynchronous on some platforms. + virtual void SetFullscreen(bool fullscreen) = 0; virtual bool IsFullscreenOrPending() const = 0; // Returns true if the window is a panel that has been detached. -- cgit v1.1