Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: ash/shelf/shelf_layout_manager.cc

Issue 20056003: Moves calling OnAutoHideState to when exactly the state has changed (2nd) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_layout_manager.cc
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index e0d06d71ae1c2e3caabfd5bfb9b1c46b6c9ad69f..46fb536fa2ad14460eb89787ccf2dfebfd8aa290 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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698