| 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..61ebbe667a7f22085bda98726c2ef9c9d1e696dd 100644
|
| --- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
|
| +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
|
| @@ -9,16 +9,13 @@
|
|
|
| #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"
|
| #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 +264,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 +311,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 +321,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.
|
|
|
| @@ -363,7 +353,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 +365,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 +594,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 +884,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 +910,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 +954,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 +1051,6 @@ void ImmersiveModeControllerAsh::OnSlideClosedAnimationCompleted() {
|
| EnablePaintToLayer(false);
|
| // Update tabstrip for closed state.
|
| delegate_->SetImmersiveStyle(true);
|
| - SetRenderWindowTopInsetsForTouch(kNearTopContainerDistance);
|
| LayoutBrowserRootView();
|
| }
|
|
|
| @@ -1149,21 +1130,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 =
|
|
|