| Index: apps/shell_window.cc
|
| diff --git a/apps/shell_window.cc b/apps/shell_window.cc
|
| index ed41645910a8331a35b94a39db3f2bc10e7269d1..b235f2400c48d376afc833a1e8aa7e7ed0c13d11 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_type_(FULLSCREEN_TYPE_NONE),
|
| show_on_first_paint_(false),
|
| first_paint_complete_(false) {
|
| }
|
| @@ -404,8 +403,12 @@ void ShellWindow::Fullscreen() {
|
| if (!profile()->GetPrefs()->GetBoolean(prefs::kAppFullscreenAllowed))
|
| return;
|
| #endif
|
| - fullscreen_for_window_api_ = true;
|
| - GetBaseWindow()->SetFullscreen(true);
|
| + bool tab_fullscreen =
|
| + (fullscreen_type_ == FULLSCREEN_TYPE_TAB ||
|
| + fullscreen_type_ == FULLSCREEN_TYPE_WINDOW_AND_TAB);
|
| + fullscreen_type_ = tab_fullscreen ?
|
| + FULLSCREEN_TYPE_WINDOW_AND_TAB : FULLSCREEN_TYPE_WINDOW;
|
| + GetBaseWindow()->SetFullscreen(fullscreen_type_);
|
| }
|
|
|
| void ShellWindow::Maximize() {
|
| @@ -417,15 +420,28 @@ void ShellWindow::Minimize() {
|
| }
|
|
|
| void ShellWindow::Restore() {
|
| - fullscreen_for_window_api_ = false;
|
| - fullscreen_for_tab_ = false;
|
| - if (GetBaseWindow()->IsFullscreenOrPending()) {
|
| - GetBaseWindow()->SetFullscreen(false);
|
| + if (fullscreen_type_ != FULLSCREEN_TYPE_NONE) {
|
| + fullscreen_type_ = FULLSCREEN_TYPE_NONE;
|
| + GetBaseWindow()->SetFullscreen(fullscreen_type_);
|
| } else {
|
| GetBaseWindow()->Restore();
|
| }
|
| }
|
|
|
| +void ShellWindow::ImmersiveFullscreen() {
|
| +#if !defined(OS_MACOSX)
|
| + // Do not enter fullscreen mode if disallowed by pref.
|
| + if (!profile()->GetPrefs()->GetBoolean(prefs::kAppFullscreenAllowed))
|
| + return;
|
| +#endif
|
| + if (GetBaseWindow()->SupportsImmersiveFullscreen()) {
|
| + fullscreen_type_ = FULLSCREEN_TYPE_IMMERSIVE;
|
| + GetBaseWindow()->SetFullscreen(fullscreen_type_);
|
| + } else {
|
| + Fullscreen();
|
| + }
|
| +}
|
| +
|
| void ShellWindow::SetMinimumSize(const gfx::Size& min_size) {
|
| size_constraints_.set_minimum_size(min_size);
|
| OnSizeConstraintsChanged();
|
| @@ -585,18 +601,23 @@ void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source,
|
| return;
|
| }
|
|
|
| - fullscreen_for_tab_ = enter_fullscreen;
|
| -
|
| + bool window_fullscreen =
|
| + (fullscreen_type_ == FULLSCREEN_TYPE_WINDOW ||
|
| + fullscreen_type_ == FULLSCREEN_TYPE_WINDOW_AND_TAB);
|
| if (enter_fullscreen) {
|
| - native_app_window_->SetFullscreen(true);
|
| - } else if (!fullscreen_for_window_api_) {
|
| - native_app_window_->SetFullscreen(false);
|
| + fullscreen_type_ = window_fullscreen ?
|
| + FULLSCREEN_TYPE_WINDOW_AND_TAB : FULLSCREEN_TYPE_TAB;
|
| + } else {
|
| + fullscreen_type_ = window_fullscreen ?
|
| + FULLSCREEN_TYPE_WINDOW : FULLSCREEN_TYPE_NONE;
|
| }
|
| + GetBaseWindow()->SetFullscreen(fullscreen_type_);
|
| }
|
|
|
| bool ShellWindow::IsFullscreenForTabOrPending(
|
| const content::WebContents* source) const {
|
| - return fullscreen_for_tab_;
|
| + return (fullscreen_type_ == FULLSCREEN_TYPE_TAB ||
|
| + fullscreen_type_ == FULLSCREEN_TYPE_WINDOW_AND_TAB);
|
| }
|
|
|
| void ShellWindow::Observe(int type,
|
|
|