From 12946d64538c583c4a1561fc6e64e43a128a832f Mon Sep 17 00:00:00 2001 From: "mukai@chromium.org" Date: Tue, 23 Jul 2013 18:15:06 +0000 Subject: [PATCH] Moves calling OnAutoHideState to when exactly the state has changed. This method is called when a window is maximized or fullscreen. BUG=249509 R=harrym@chromium.org TEST=manually Review URL: https://chromiumcodereview.appspot.com/19968005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213169 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/shelf/shelf_layout_manager.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index e0d06d71ae1c..4fa302b54c58 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -211,8 +211,6 @@ void ShelfLayoutManager::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) { auto_hide_behavior_ = behavior; UpdateVisibilityState(); FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, - OnAutoHideStateChanged(state_.auto_hide_state)); - FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, OnAutoHideBehaviorChanged(root_window_, auto_hide_behavior_)); } @@ -333,17 +331,12 @@ void ShelfLayoutManager::UpdateAutoHideState() { if (auto_hide_state == SHELF_AUTO_HIDE_HIDDEN) { // Hides happen immediately. SetState(state_.visibility_state); - FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, - OnAutoHideStateChanged(auto_hide_state)); } else { auto_hide_timer_.Stop(); auto_hide_timer_.Start( FROM_HERE, base::TimeDelta::FromMilliseconds(kAutoHideDelayMS), this, &ShelfLayoutManager::UpdateAutoHideStateNow); - FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, - OnAutoHideStateChanged( - CalculateAutoHideState(state_.visibility_state))); } } else { auto_hide_timer_.Stop(); @@ -658,6 +651,11 @@ void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) { UpdateHitTestBounds(); if (!delay_shelf_update) UpdateShelfBackground(change_type); + + if (old_state.auto_hide_state != state_.auto_hide_state) { + FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, + OnAutoHideStateChanged(state_.auto_hide_state)); + } } void ShelfLayoutManager::StopAnimating() { -- 2.11.4.GIT