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

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
Index: apps/shell_window.cc
diff --git a/apps/shell_window.cc b/apps/shell_window.cc
index ed41645910a8331a35b94a39db3f2bc10e7269d1..5703f111e886f0d336e0e2fcac7dc0a5faae22be 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;
benwells 2013/11/14 00:06:54 Is there a logical change here? It was checking Is
pkotwicz 2013/11/14 01:05:24 This is not a logical change as far as I can tell.
+ 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);
}
void ShellWindow::Observe(int type,

Powered by Google App Engine
This is Rietveld 408576698