| 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/common/wm_shell.h" | 5 #include "ash/common/wm_shell.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
| 10 #include "ash/common/accelerators/ash_focus_manager_factory.h" | 10 #include "ash/common/accelerators/ash_focus_manager_factory.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Must occur after SessionStateDelegate creation and user login because | 144 // Must occur after SessionStateDelegate creation and user login because |
| 145 // Chrome's implementation of ShelfDelegate assumes it can get information | 145 // Chrome's implementation of ShelfDelegate assumes it can get information |
| 146 // about multi-profile login state. | 146 // about multi-profile login state. |
| 147 DCHECK(GetSessionStateDelegate()); | 147 DCHECK(GetSessionStateDelegate()); |
| 148 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); | 148 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); |
| 149 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model())); | 149 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model())); |
| 150 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model())); | 150 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model())); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void WmShell::OnMaximizeModeStarted() { | 153 void WmShell::OnMaximizeModeStarted() { |
| 154 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); | 154 for (auto& observer : shell_observers_) |
| 155 observer.OnMaximizeModeStarted(); |
| 155 } | 156 } |
| 156 | 157 |
| 157 void WmShell::OnMaximizeModeEnded() { | 158 void WmShell::OnMaximizeModeEnded() { |
| 158 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); | 159 for (auto& observer : shell_observers_) |
| 160 observer.OnMaximizeModeEnded(); |
| 159 } | 161 } |
| 160 | 162 |
| 161 void WmShell::UpdateAfterLoginStatusChange(LoginStatus status) { | 163 void WmShell::UpdateAfterLoginStatusChange(LoginStatus status) { |
| 162 for (WmWindow* root_window : GetAllRootWindows()) { | 164 for (WmWindow* root_window : GetAllRootWindows()) { |
| 163 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( | 165 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( |
| 164 status); | 166 status); |
| 165 } | 167 } |
| 166 } | 168 } |
| 167 | 169 |
| 168 void WmShell::NotifyFullscreenStateChanged(bool is_fullscreen, | 170 void WmShell::NotifyFullscreenStateChanged(bool is_fullscreen, |
| 169 WmWindow* root_window) { | 171 WmWindow* root_window) { |
| 170 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, | 172 for (auto& observer : shell_observers_) |
| 171 OnFullscreenStateChanged(is_fullscreen, root_window)); | 173 observer.OnFullscreenStateChanged(is_fullscreen, root_window); |
| 172 } | 174 } |
| 173 | 175 |
| 174 void WmShell::NotifyPinnedStateChanged(WmWindow* pinned_window) { | 176 void WmShell::NotifyPinnedStateChanged(WmWindow* pinned_window) { |
| 175 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, | 177 for (auto& observer : shell_observers_) |
| 176 OnPinnedStateChanged(pinned_window)); | 178 observer.OnPinnedStateChanged(pinned_window); |
| 177 } | 179 } |
| 178 | 180 |
| 179 void WmShell::NotifyVirtualKeyboardActivated(bool activated) { | 181 void WmShell::NotifyVirtualKeyboardActivated(bool activated) { |
| 180 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, | 182 for (auto& observer : shell_observers_) |
| 181 OnVirtualKeyboardStateChanged(activated)); | 183 observer.OnVirtualKeyboardStateChanged(activated); |
| 182 } | 184 } |
| 183 | 185 |
| 184 void WmShell::NotifyShelfCreatedForRootWindow(WmWindow* root_window) { | 186 void WmShell::NotifyShelfCreatedForRootWindow(WmWindow* root_window) { |
| 185 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, | 187 for (auto& observer : shell_observers_) |
| 186 OnShelfCreatedForRootWindow(root_window)); | 188 observer.OnShelfCreatedForRootWindow(root_window); |
| 187 } | 189 } |
| 188 | 190 |
| 189 void WmShell::NotifyShelfAlignmentChanged(WmWindow* root_window) { | 191 void WmShell::NotifyShelfAlignmentChanged(WmWindow* root_window) { |
| 190 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, | 192 for (auto& observer : shell_observers_) |
| 191 OnShelfAlignmentChanged(root_window)); | 193 observer.OnShelfAlignmentChanged(root_window); |
| 192 } | 194 } |
| 193 | 195 |
| 194 void WmShell::NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window) { | 196 void WmShell::NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window) { |
| 195 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, | 197 for (auto& observer : shell_observers_) |
| 196 OnShelfAutoHideBehaviorChanged(root_window)); | 198 observer.OnShelfAutoHideBehaviorChanged(root_window); |
| 197 } | 199 } |
| 198 | 200 |
| 199 void WmShell::AddShellObserver(ShellObserver* observer) { | 201 void WmShell::AddShellObserver(ShellObserver* observer) { |
| 200 shell_observers_.AddObserver(observer); | 202 shell_observers_.AddObserver(observer); |
| 201 } | 203 } |
| 202 | 204 |
| 203 void WmShell::RemoveShellObserver(ShellObserver* observer) { | 205 void WmShell::RemoveShellObserver(ShellObserver* observer) { |
| 204 shell_observers_.RemoveObserver(observer); | 206 shell_observers_.RemoveObserver(observer); |
| 205 } | 207 } |
| 206 | 208 |
| 207 void WmShell::OnLockStateEvent(LockStateObserver::EventType event) { | 209 void WmShell::OnLockStateEvent(LockStateObserver::EventType event) { |
| 208 FOR_EACH_OBSERVER(LockStateObserver, lock_state_observers_, | 210 for (auto& observer : lock_state_observers_) |
| 209 OnLockStateEvent(event)); | 211 observer.OnLockStateEvent(event); |
| 210 } | 212 } |
| 211 | 213 |
| 212 void WmShell::AddLockStateObserver(LockStateObserver* observer) { | 214 void WmShell::AddLockStateObserver(LockStateObserver* observer) { |
| 213 lock_state_observers_.AddObserver(observer); | 215 lock_state_observers_.AddObserver(observer); |
| 214 } | 216 } |
| 215 | 217 |
| 216 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { | 218 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { |
| 217 lock_state_observers_.RemoveObserver(observer); | 219 lock_state_observers_.RemoveObserver(observer); |
| 218 } | 220 } |
| 219 | 221 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 void WmShell::DeleteToastManager() { | 380 void WmShell::DeleteToastManager() { |
| 379 toast_manager_.reset(); | 381 toast_manager_.reset(); |
| 380 } | 382 } |
| 381 | 383 |
| 382 void WmShell::SetAcceleratorController( | 384 void WmShell::SetAcceleratorController( |
| 383 std::unique_ptr<AcceleratorController> accelerator_controller) { | 385 std::unique_ptr<AcceleratorController> accelerator_controller) { |
| 384 accelerator_controller_ = std::move(accelerator_controller); | 386 accelerator_controller_ = std::move(accelerator_controller); |
| 385 } | 387 } |
| 386 | 388 |
| 387 } // namespace ash | 389 } // namespace ash |
| OLD | NEW |