Index: chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
index fc7baac67b626828af0f26fce79a6d9fbd3b05aa..e11f7f1913d1cb7b810c084de3878096550900a5 100644 |
--- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
+++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
@@ -9,8 +9,7 @@ |
#include "ash/ash_switches.h" |
#include "ash/shell.h" |
-#include "ash/wm/window_properties.h" |
-#include "base/command_line.h" |
+#include "ash/wm/window_state.h" |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
#include "chrome/browser/ui/immersive_fullscreen_configuration.h" |
@@ -267,7 +266,6 @@ ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() |
enabled_(false), |
reveal_state_(CLOSED), |
revealed_lock_count_(0), |
- tab_indicator_visibility_(TAB_INDICATORS_HIDE), |
mouse_x_when_hit_top_in_screen_(-1), |
gesture_begun_(false), |
native_window_(NULL), |
@@ -315,12 +313,6 @@ void ImmersiveModeControllerAsh::Init( |
// window pointer so |this| can stop observing during destruction. |
native_window_ = widget_->GetNativeWindow(); |
top_container_ = top_container; |
- |
- // Optionally allow the tab indicators to be hidden. |
- if (CommandLine::ForCurrentProcess()-> |
- HasSwitch(ash::switches::kAshImmersiveHideTabIndicators)) { |
- tab_indicator_visibility_ = TAB_INDICATORS_FORCE_HIDE; |
- } |
} |
void ImmersiveModeControllerAsh::SetEnabled(bool enabled) { |
@@ -331,9 +323,9 @@ void ImmersiveModeControllerAsh::SetEnabled(bool enabled) { |
EnableWindowObservers(enabled_); |
- UpdateUseMinimalChrome(LAYOUT_NO); |
- |
if (enabled_) { |
+ UpdateUseMinimalChrome(LAYOUT_NO); |
+ |
// Animate enabling immersive mode by sliding out the top-of-window views. |
// No animation occurs if a lock is holding the top-of-window views open. |
@@ -376,7 +368,8 @@ bool ImmersiveModeControllerAsh::IsEnabled() const { |
} |
bool ImmersiveModeControllerAsh::ShouldHideTabIndicators() const { |
- return tab_indicator_visibility_ != TAB_INDICATORS_SHOW; |
+ return ash::wm::GetWindowState(native_window_)->fullscreen_type() != |
+ ash::wm::FULLSCREEN_TYPE_IMMERSIVE_MINIMAL_CHROME; |
} |
bool ImmersiveModeControllerAsh::ShouldHideTopViews() const { |
@@ -604,14 +597,6 @@ void ImmersiveModeControllerAsh::OnRemoveTransientChild( |
//////////////////////////////////////////////////////////////////////////////// |
// Testing interface: |
-void ImmersiveModeControllerAsh::SetForceHideTabIndicatorsForTest(bool force) { |
- if (force) |
- tab_indicator_visibility_ = TAB_INDICATORS_FORCE_HIDE; |
- else if (tab_indicator_visibility_ == TAB_INDICATORS_FORCE_HIDE) |
- tab_indicator_visibility_ = TAB_INDICATORS_HIDE; |
- UpdateUseMinimalChrome(LAYOUT_YES); |
-} |
- |
void ImmersiveModeControllerAsh::StartRevealForTest(bool hovered) { |
MaybeStartReveal(ANIMATE_NO); |
MoveMouse(top_container_, hovered); |
@@ -902,21 +887,24 @@ bool ImmersiveModeControllerAsh::UpdateRevealedLocksForSwipe( |
} |
void ImmersiveModeControllerAsh::UpdateUseMinimalChrome(Layout layout) { |
+ if (!enabled_) |
+ return; |
+ |
+ ash::wm::FullscreenType previous_fullscreen_type = |
+ ash::wm::GetWindowState(native_window_)->fullscreen_type(); |
+ |
// May be NULL in tests. |
FullscreenController* fullscreen_controller = |
delegate_->GetFullscreenController(); |
bool in_tab_fullscreen = fullscreen_controller ? |
fullscreen_controller->IsFullscreenForTabOrPending() : false; |
- bool use_minimal_chrome = !in_tab_fullscreen && enabled_; |
- native_window_->SetProperty(ash::internal::kFullscreenUsesMinimalChromeKey, |
- use_minimal_chrome); |
- |
- TabIndicatorVisibility previous_tab_indicator_visibility = |
- tab_indicator_visibility_; |
- if (tab_indicator_visibility_ != TAB_INDICATORS_FORCE_HIDE) { |
- tab_indicator_visibility_ = use_minimal_chrome ? |
- TAB_INDICATORS_SHOW : TAB_INDICATORS_HIDE; |
- } |
+ ash::wm::FullscreenType fullscreen_type = in_tab_fullscreen ? |
+ ash::wm::FULLSCREEN_TYPE_IMMERSIVE_NO_CHROME : |
+ ash::wm::FULLSCREEN_TYPE_IMMERSIVE_MINIMAL_CHROME; |
+ |
+ if (fullscreen_type == previous_fullscreen_type) |
+ return; |
+ ash::wm::GetWindowState(native_window_)->SetFullscreenType(fullscreen_type); |
// Ash on Windows may not have a shell. |
if (ash::Shell::HasInstance()) { |
@@ -925,12 +913,10 @@ void ImmersiveModeControllerAsh::UpdateUseMinimalChrome(Layout layout) { |
ash::Shell::GetInstance()->UpdateShelfVisibility(); |
} |
- if (tab_indicator_visibility_ != previous_tab_indicator_visibility) { |
- // If the top-of-window views are revealed or animating, the change will |
- // take effect with the layout once the top-of-window views are closed. |
- if (layout == LAYOUT_YES && reveal_state_ == CLOSED) |
- LayoutBrowserRootView(); |
- } |
+ // If the top-of-window views are revealed or animating, the change will take |
+ // effect with the layout once the top-of-window views are closed. |
+ if (layout == LAYOUT_YES && reveal_state_ == CLOSED) |
+ LayoutBrowserRootView(); |
} |
int ImmersiveModeControllerAsh::GetAnimationDuration(Animate animate) const { |