| 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.
|
|
|