summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 17:28:53 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 17:28:53 +0000
commit63458430dba41ed11c5fde816d8fd852cb1f75f6 (patch)
treef99327be2a62992edbf08eb6af132cadf3404e1e /apps
parent74de2d9cff8bc3803b7b47794b0f02ac364fa0d1 (diff)
downloadchromium_src-63458430dba41ed11c5fde816d8fd852cb1f75f6.zip
chromium_src-63458430dba41ed11c5fde816d8fd852cb1f75f6.tar.gz
chromium_src-63458430dba41ed11c5fde816d8fd852cb1f75f6.tar.bz2
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, <F4> 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 TBR=benwells (Because this is relanding https://codereview.chromium.org/59043013/), 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 <F4> 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 <F4> 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/76483002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236258 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r--apps/shell_window.cc38
-rw-r--r--apps/shell_window.h24
-rw-r--r--apps/ui/native_app_window.h7
3 files changed, 47 insertions, 22 deletions
diff --git a/apps/shell_window.cc b/apps/shell_window.cc
index 5e4098f..2c0b3fac 100644
--- a/apps/shell_window.cc
+++ b/apps/shell_window.cc
@@ -141,8 +141,7 @@ ShellWindow::ShellWindow(Profile* profile,
window_type_(WINDOW_TYPE_DEFAULT),
delegate_(delegate),
image_loader_ptr_factory_(this),
- fullscreen_for_window_api_(false),
- fullscreen_for_tab_(false),
+ fullscreen_types_(FULLSCREEN_TYPE_NONE),
show_on_first_paint_(false),
first_paint_complete_(false) {
}
@@ -404,8 +403,8 @@ void ShellWindow::Fullscreen() {
if (!profile()->GetPrefs()->GetBoolean(prefs::kAppFullscreenAllowed))
return;
#endif
- fullscreen_for_window_api_ = true;
- GetBaseWindow()->SetFullscreen(true);
+ fullscreen_types_ |= FULLSCREEN_TYPE_WINDOW_API;
+ GetBaseWindow()->SetFullscreen(fullscreen_types_);
}
void ShellWindow::Maximize() {
@@ -417,15 +416,24 @@ void ShellWindow::Minimize() {
}
void ShellWindow::Restore() {
- fullscreen_for_window_api_ = false;
- fullscreen_for_tab_ = false;
- if (GetBaseWindow()->IsFullscreenOrPending()) {
- GetBaseWindow()->SetFullscreen(false);
+ if (fullscreen_types_ != FULLSCREEN_TYPE_NONE) {
+ fullscreen_types_ = FULLSCREEN_TYPE_NONE;
+ GetBaseWindow()->SetFullscreen(fullscreen_types_);
} 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();
@@ -585,18 +593,16 @@ void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source,
return;
}
- fullscreen_for_tab_ = enter_fullscreen;
-
- if (enter_fullscreen) {
- native_app_window_->SetFullscreen(true);
- } else if (!fullscreen_for_window_api_) {
- native_app_window_->SetFullscreen(false);
- }
+ if (enter_fullscreen)
+ fullscreen_types_ |= FULLSCREEN_TYPE_HTML_API;
+ else
+ fullscreen_types_ &= ~FULLSCREEN_TYPE_HTML_API;
+ GetBaseWindow()->SetFullscreen(fullscreen_types_);
}
bool ShellWindow::IsFullscreenForTabOrPending(
const content::WebContents* source) const {
- return fullscreen_for_tab_;
+ return ((fullscreen_types_ & FULLSCREEN_TYPE_HTML_API) != 0);
}
void ShellWindow::Observe(int type,
diff --git a/apps/shell_window.h b/apps/shell_window.h
index c236a1d..9890038 100644
--- a/apps/shell_window.h
+++ b/apps/shell_window.h
@@ -92,6 +92,21 @@ 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 <F4> key.
+ FULLSCREEN_TYPE_OS = 1 << 2
+ };
+
class SizeConstraints {
public:
// The value SizeConstraints uses to represent an unbounded width or height.
@@ -284,6 +299,9 @@ 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);
@@ -444,10 +462,8 @@ class ShellWindow : public content::NotificationObserver,
base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_;
- // Fullscreen entered by app.window api.
- bool fullscreen_for_window_api_;
- // Fullscreen entered by HTML requestFullscreen.
- bool fullscreen_for_tab_;
+ // Bit field of FullscreenType.
+ int fullscreen_types_;
// 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 222a680..73f6f88 100644
--- a/apps/ui/native_app_window.h
+++ b/apps/ui/native_app_window.h
@@ -18,8 +18,11 @@ namespace apps {
class NativeAppWindow : public ui::BaseWindow,
public web_modal::WebContentsModalDialogHost {
public:
- // Fullscreen changes may be asynchronous on some platforms.
- virtual void SetFullscreen(bool fullscreen) = 0;
+ // 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.
virtual bool IsFullscreenOrPending() const = 0;
// Returns true if the window is a panel that has been detached.