Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1568)

Unified Diff: apps/shell_window.cc

Issue 59043013: Add flag to enable immersive fullscreen for v2 apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/shell_window.h ('k') | apps/ui/native_app_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/shell_window.cc
diff --git a/apps/shell_window.cc b/apps/shell_window.cc
index 5e4098f504d51f62a3971a450f99b155572babed..2c0b3fac68463847044925154795f0aa9c020271 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,
« no previous file with comments | « apps/shell_window.h ('k') | apps/ui/native_app_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698