summaryrefslogtreecommitdiffstats
path: root/ash/shelf
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-24 00:38:08 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-24 00:38:08 +0000
commit3b11cbb8a274f304dddfef364db059d20e150305 (patch)
tree744a668b570327de8f68af28db9f1ff1a4c6bdf5 /ash/shelf
parent66dca23803a05a86112d0001d792cbd7b7058a88 (diff)
downloadchromium_src-3b11cbb8a274f304dddfef364db059d20e150305.zip
chromium_src-3b11cbb8a274f304dddfef364db059d20e150305.tar.gz
chromium_src-3b11cbb8a274f304dddfef364db059d20e150305.tar.bz2
Moves calling OnAutoHideState to when exactly the state has changed (2nd)
This method is called when a window is maximized or fullscreen. The first attempt was reverted due to a test failure in LauncherTooltipManagerTest, and it turns out that's because the observer method is not emitted correctly. BUG=249509 TBR=harrym@chromium.org, jamescook@chromium.org TEST=manually Review URL: https://chromiumcodereview.appspot.com/20056003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213298 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shelf')
-rw-r--r--ash/shelf/shelf_layout_manager.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index e0d06d7..46fb536 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,16 @@ void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) {
UpdateHitTestBounds();
if (!delay_shelf_update)
UpdateShelfBackground(change_type);
+
+ // OnAutoHideStateChanged Should be emitted when:
+ // - firstly state changed to auto-hide from other state
+ // - or, auto_hide_state has changed
+ if ((old_state.visibility_state != state_.visibility_state &&
+ state_.visibility_state == SHELF_AUTO_HIDE) ||
+ old_state.auto_hide_state != state_.auto_hide_state) {
+ FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
+ OnAutoHideStateChanged(state_.auto_hide_state));
+ }
}
void ShelfLayoutManager::StopAnimating() {