Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/aura/wm_shelf_aura.h" | 5 #include "ash/aura/wm_shelf_aura.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shelf/wm_shelf_observer.h" | 8 #include "ash/common/shelf/wm_shelf_observer.h" |
| 9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 } | 37 } |
| 38 | 38 |
| 39 ResetShelfLayoutManager(); | 39 ResetShelfLayoutManager(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 Shelf* WmShelfAura::GetShelf(WmShelf* shelf) { | 43 Shelf* WmShelfAura::GetShelf(WmShelf* shelf) { |
| 44 return static_cast<WmShelfAura*>(shelf)->shelf_; | 44 return static_cast<WmShelfAura*>(shelf)->shelf_; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void WmShelfAura::AddObserver(WmShelfObserver* observer) { | |
| 48 observers_.AddObserver(observer); | |
| 49 } | |
| 50 | |
| 51 void WmShelfAura::RemoveObserver(WmShelfObserver* observer) { | |
| 52 observers_.RemoveObserver(observer); | |
| 53 } | |
| 54 | |
| 47 void WmShelfAura::ResetShelfLayoutManager() { | 55 void WmShelfAura::ResetShelfLayoutManager() { |
| 48 if (!shelf_layout_manager_) | 56 if (!shelf_layout_manager_) |
| 49 return; | 57 return; |
| 50 shelf_layout_manager_->RemoveObserver(this); | 58 shelf_layout_manager_->RemoveObserver(this); |
| 51 shelf_layout_manager_ = nullptr; | 59 shelf_layout_manager_ = nullptr; |
| 52 } | 60 } |
| 53 | 61 |
| 54 WmWindow* WmShelfAura::GetWindow() { | 62 WmWindow* WmShelfAura::GetWindow() { |
| 55 return WmWindowAura::Get(shelf_->shelf_widget()->GetNativeView()); | 63 return WmWindowAura::Get(shelf_->shelf_widget()->GetNativeView()); |
| 56 } | 64 } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 86 | 94 |
| 87 void WmShelfAura::UpdateIconPositionForWindow(WmWindow* window) { | 95 void WmShelfAura::UpdateIconPositionForWindow(WmWindow* window) { |
| 88 shelf_->UpdateIconPositionForWindow(WmWindowAura::GetAuraWindow(window)); | 96 shelf_->UpdateIconPositionForWindow(WmWindowAura::GetAuraWindow(window)); |
| 89 } | 97 } |
| 90 | 98 |
| 91 gfx::Rect WmShelfAura::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { | 99 gfx::Rect WmShelfAura::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { |
| 92 return shelf_->GetScreenBoundsOfItemIconForWindow( | 100 return shelf_->GetScreenBoundsOfItemIconForWindow( |
| 93 WmWindowAura::GetAuraWindow(window)); | 101 WmWindowAura::GetAuraWindow(window)); |
| 94 } | 102 } |
| 95 | 103 |
| 96 void WmShelfAura::AddObserver(WmShelfObserver* observer) { | |
| 97 observers_.AddObserver(observer); | |
| 98 } | |
| 99 | |
| 100 void WmShelfAura::RemoveObserver(WmShelfObserver* observer) { | |
| 101 observers_.RemoveObserver(observer); | |
| 102 } | |
| 103 | |
| 104 void WmShelfAura::WillDeleteShelfLayoutManager() { | 104 void WmShelfAura::WillDeleteShelfLayoutManager() { |
| 105 ResetShelfLayoutManager(); | 105 ResetShelfLayoutManager(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void WmShelfAura::OnBackgroundUpdated( | 108 void WmShelfAura::OnBackgroundUpdated( |
| 109 ShelfBackgroundType background_type, | 109 ShelfBackgroundType background_type, |
| 110 BackgroundAnimatorChangeType change_type) { | 110 BackgroundAnimatorChangeType change_type) { |
| 111 if (background_type == GetBackgroundType()) | |
|
James Cook
2016/06/14 17:50:00
This might change when the observer fires compared
bruthig
2016/07/26 19:50:01
It most definitely changes when the WmShelfObserve
James Cook
2016/07/27 00:30:38
Yes, please TODO it.
| |
| 112 return; | |
| 111 FOR_EACH_OBSERVER(WmShelfObserver, observers_, | 113 FOR_EACH_OBSERVER(WmShelfObserver, observers_, |
| 112 OnBackgroundUpdated(background_type, change_type)); | 114 OnBackgroundUpdated(background_type, change_type)); |
| 113 } | 115 } |
| 114 | 116 |
| 115 void WmShelfAura::WillChangeVisibilityState(ShelfVisibilityState new_state) { | 117 void WmShelfAura::WillChangeVisibilityState(ShelfVisibilityState new_state) { |
| 116 FOR_EACH_OBSERVER(WmShelfObserver, observers_, | 118 FOR_EACH_OBSERVER(WmShelfObserver, observers_, |
| 117 WillChangeVisibilityState(new_state)); | 119 WillChangeVisibilityState(new_state)); |
| 118 } | 120 } |
| 119 | 121 |
| 120 void WmShelfAura::OnShelfIconPositionsChanged() { | 122 void WmShelfAura::OnShelfIconPositionsChanged() { |
| 121 FOR_EACH_OBSERVER(WmShelfObserver, observers_, OnShelfIconPositionsChanged()); | 123 FOR_EACH_OBSERVER(WmShelfObserver, observers_, OnShelfIconPositionsChanged()); |
| 122 } | 124 } |
| 123 | 125 |
| 124 } // namespace ash | 126 } // namespace ash |
| OLD | NEW |