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

Unified Diff: ash/wm/shelf_layout_manager.cc

Issue 10701051: Polish launcher tooltip visibility (2nd try). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 | « ash/wm/shelf_layout_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/shelf_layout_manager.cc
diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc
index 156fad152144a9fa89d585ba5f844738e95b1512..b966af19532ab08f5283b78489103d80cc7ebedd 100644
--- a/ash/wm/shelf_layout_manager.cc
+++ b/ash/wm/shelf_layout_manager.cc
@@ -136,6 +136,7 @@ ShelfLayoutManager::ShelfLayoutManager(views::Widget* status)
}
ShelfLayoutManager::~ShelfLayoutManager() {
+ FOR_EACH_OBSERVER(Observer, observers_, WillDeleteShelf());
Shell::GetInstance()->RemoveShellObserver(this);
aura::client::GetActivationClient(root_window_)->RemoveObserver(this);
}
@@ -145,6 +146,8 @@ void ShelfLayoutManager::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) {
return;
auto_hide_behavior_ = behavior;
UpdateVisibilityState();
+ FOR_EACH_OBSERVER(Observer, observers_,
+ OnAutoHideStateChanged(state_.auto_hide_state));
}
bool ShelfLayoutManager::IsVisible() const {
@@ -279,12 +282,16 @@ void ShelfLayoutManager::UpdateAutoHideState() {
if (auto_hide_state == AUTO_HIDE_HIDDEN) {
// Hides happen immediately.
SetState(state_.visibility_state);
+ FOR_EACH_OBSERVER(Observer, 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(Observer, observers_, OnAutoHideStateChanged(
+ CalculateAutoHideState(state_.visibility_state)));
}
} else {
auto_hide_timer_.Stop();
@@ -296,6 +303,14 @@ void ShelfLayoutManager::SetWindowOverlapsShelf(bool value) {
UpdateShelfBackground(internal::BackgroundAnimator::CHANGE_ANIMATE);
}
+void ShelfLayoutManager::AddObserver(Observer* observer) {
+ observers_.AddObserver(observer);
+}
+
+void ShelfLayoutManager::RemoveObserver(Observer* observer) {
+ observers_.RemoveObserver(observer);
+}
+
////////////////////////////////////////////////////////////////////////////////
// ShelfLayoutManager, aura::LayoutManager implementation:
@@ -345,6 +360,9 @@ void ShelfLayoutManager::SetState(VisibilityState visibility_state) {
if (state_.Equals(state))
return; // Nothing changed.
+ FOR_EACH_OBSERVER(Observer, observers_,
+ WillChangeVisibilityState(visibility_state));
+
if (state.visibility_state == AUTO_HIDE) {
// When state is AUTO_HIDE we need to track when the mouse is over the
// launcher to unhide the shelf. AutoHideEventFilter does that for us.
« no previous file with comments | « ash/wm/shelf_layout_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698