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 ed830082ce75f81419e6a7086272f891506ece0f..c2dab89d7d62c059456a17d571a7365613b564e6 100644 |
--- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
+++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc |
@@ -10,15 +10,13 @@ |
#include "ash/ash_switches.h" |
#include "ash/shell.h" |
#include "ash/wm/window_properties.h" |
-#include "base/command_line.h" |
+#include "ash/wm/wm_types.h" |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
#include "chrome/browser/ui/immersive_fullscreen_configuration.h" |
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
#include "chrome/browser/ui/views/frame/top_container_view.h" |
#include "content/public/browser/notification_service.h" |
-#include "content/public/browser/web_contents.h" |
-#include "content/public/browser/web_contents_view.h" |
#include "ui/aura/client/activation_client.h" |
#include "ui/aura/client/aura_constants.h" |
#include "ui/aura/client/capture_client.h" |
@@ -267,7 +265,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 +312,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) { |
@@ -363,7 +354,6 @@ void ImmersiveModeControllerAsh::SetEnabled(bool enabled) { |
reveal_state_ = CLOSED; |
EnablePaintToLayer(false); |
delegate_->SetImmersiveStyle(false); |
- SetRenderWindowTopInsetsForTouch(0); |
// Layout the root view so that incognito avatar icon, if any, gets laid |
// out. |
@@ -376,7 +366,8 @@ bool ImmersiveModeControllerAsh::IsEnabled() const { |
} |
bool ImmersiveModeControllerAsh::ShouldHideTabIndicators() const { |
- return tab_indicator_visibility_ != TAB_INDICATORS_SHOW; |
+ return native_window_->GetProperty(ash::internal::kFullscreenTypeKey) != |
+ ash::wm::FULLSCREEN_TYPE_IMMERSIVE_MINIMAL_CHROME; |
} |
bool ImmersiveModeControllerAsh::ShouldHideTopViews() const { |
@@ -604,14 +595,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,22 +885,26 @@ bool ImmersiveModeControllerAsh::UpdateRevealedLocksForSwipe( |
} |
void ImmersiveModeControllerAsh::UpdateUseMinimalChrome(Layout layout) { |
- // 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 previous_fullscreen_type = |
+ native_window_->GetProperty(ash::internal::kFullscreenTypeKey); |
+ |
+ ash::wm::FullscreenType fullscreen_type = ash::wm::FULLSCREEN_TYPE_OTHER; |
+ if (enabled_) { |
+ // May be NULL in tests. |
+ FullscreenController* fullscreen_controller = |
+ delegate_->GetFullscreenController(); |
+ bool in_tab_fullscreen = fullscreen_controller ? |
+ fullscreen_controller->IsFullscreenForTabOrPending() : false; |
+ 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; |
+ native_window_->SetProperty(ash::internal::kFullscreenTypeKey, |
+ fullscreen_type); |
+ |
// Ash on Windows may not have a shell. |
if (ash::Shell::HasInstance()) { |
// When using minimal chrome, the shelf is auto-hidden. The auto-hidden |
@@ -925,12 +912,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 { |
@@ -971,7 +956,6 @@ void ImmersiveModeControllerAsh::MaybeStartReveal(Animate animate) { |
// top-of-window views to their initial offscreen position for the |
// animation. |
delegate_->SetImmersiveStyle(false); |
- SetRenderWindowTopInsetsForTouch(0); |
LayoutBrowserRootView(); |
// Do not do any more processing if LayoutBrowserView() changed |
@@ -1069,7 +1053,6 @@ void ImmersiveModeControllerAsh::OnSlideClosedAnimationCompleted() { |
EnablePaintToLayer(false); |
// Update tabstrip for closed state. |
delegate_->SetImmersiveStyle(true); |
- SetRenderWindowTopInsetsForTouch(kNearTopContainerDistance); |
LayoutBrowserRootView(); |
} |
@@ -1149,21 +1132,6 @@ bool ImmersiveModeControllerAsh::ShouldHandleGestureEvent( |
location.x() < top_container_bounds_in_screen.right()); |
} |
-void ImmersiveModeControllerAsh::SetRenderWindowTopInsetsForTouch( |
- int top_inset) { |
- content::WebContents* contents = delegate_->GetWebContents(); |
- if (contents) { |
- aura::Window* window = contents->GetView()->GetContentNativeView(); |
- // |window| is NULL if the renderer crashed. |
- if (window) { |
- gfx::Insets inset(top_inset, 0, 0, 0); |
- window->SetHitTestBoundsOverrideOuter( |
- window->hit_test_bounds_override_outer_mouse(), |
- inset); |
- } |
- } |
-} |
- |
void ImmersiveModeControllerAsh::RecreateBubbleManager() { |
bubble_manager_.reset(new BubbleManager(this)); |
const std::vector<aura::Window*> transient_children = |