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

Side by Side Diff: ash/common/wm_shell.cc

Issue 2739763003: Moves maintaining ShellObservers back to Shell (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return; 168 return;
169 // Must occur after SessionStateDelegate creation and user login because 169 // Must occur after SessionStateDelegate creation and user login because
170 // Chrome's implementation of ShelfDelegate assumes it can get information 170 // Chrome's implementation of ShelfDelegate assumes it can get information
171 // about multi-profile login state. 171 // about multi-profile login state.
172 DCHECK(GetSessionStateDelegate()); 172 DCHECK(GetSessionStateDelegate());
173 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); 173 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0);
174 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model())); 174 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model()));
175 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model())); 175 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model()));
176 } 176 }
177 177
178 void WmShell::OnMaximizeModeStarted() {
179 for (auto& observer : shell_observers_)
180 observer.OnMaximizeModeStarted();
181 }
182
183 void WmShell::OnMaximizeModeEnding() {
184 for (auto& observer : shell_observers_)
185 observer.OnMaximizeModeEnding();
186 }
187
188 void WmShell::OnMaximizeModeEnded() {
189 for (auto& observer : shell_observers_)
190 observer.OnMaximizeModeEnded();
191 }
192
193 void WmShell::UpdateAfterLoginStatusChange(LoginStatus status) { 178 void WmShell::UpdateAfterLoginStatusChange(LoginStatus status) {
194 for (WmWindow* root_window : GetAllRootWindows()) { 179 for (WmWindow* root_window : GetAllRootWindows()) {
195 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( 180 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange(
196 status); 181 status);
197 } 182 }
198 } 183 }
199 184
200 void WmShell::NotifyFullscreenStateChanged(bool is_fullscreen,
201 WmWindow* root_window) {
202 for (auto& observer : shell_observers_)
203 observer.OnFullscreenStateChanged(is_fullscreen, root_window);
204 }
205
206 void WmShell::NotifyPinnedStateChanged(WmWindow* pinned_window) {
207 for (auto& observer : shell_observers_)
208 observer.OnPinnedStateChanged(pinned_window);
209 }
210
211 void WmShell::NotifyVirtualKeyboardActivated(bool activated) {
212 for (auto& observer : shell_observers_)
213 observer.OnVirtualKeyboardStateChanged(activated);
214 }
215
216 void WmShell::NotifyShelfCreatedForRootWindow(WmWindow* root_window) {
217 for (auto& observer : shell_observers_)
218 observer.OnShelfCreatedForRootWindow(root_window);
219 }
220
221 void WmShell::NotifyShelfAlignmentChanged(WmWindow* root_window) {
222 for (auto& observer : shell_observers_)
223 observer.OnShelfAlignmentChanged(root_window);
224 }
225
226 void WmShell::NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window) {
227 for (auto& observer : shell_observers_)
228 observer.OnShelfAutoHideBehaviorChanged(root_window);
229 }
230
231 void WmShell::AddShellObserver(ShellObserver* observer) {
232 shell_observers_.AddObserver(observer);
233 }
234
235 void WmShell::RemoveShellObserver(ShellObserver* observer) {
236 shell_observers_.RemoveObserver(observer);
237 }
238
239 void WmShell::OnLockStateEvent(LockStateObserver::EventType event) { 185 void WmShell::OnLockStateEvent(LockStateObserver::EventType event) {
240 for (auto& observer : lock_state_observers_) 186 for (auto& observer : lock_state_observers_)
241 observer.OnLockStateEvent(event); 187 observer.OnLockStateEvent(event);
242 } 188 }
243 189
244 void WmShell::AddLockStateObserver(LockStateObserver* observer) { 190 void WmShell::AddLockStateObserver(LockStateObserver* observer) {
245 lock_state_observers_.AddObserver(observer); 191 lock_state_observers_.AddObserver(observer);
246 } 192 }
247 193
248 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { 194 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 aura::client::ActivationChangeObserver::ActivationReason reason, 387 aura::client::ActivationChangeObserver::ActivationReason reason,
442 aura::Window* gained_active, 388 aura::Window* gained_active,
443 aura::Window* lost_active) { 389 aura::Window* lost_active) {
444 // TODO(sky): Shell should implement ActivationChangeObserver, not WmShell. 390 // TODO(sky): Shell should implement ActivationChangeObserver, not WmShell.
445 WmWindow* gained_active_wm = WmWindow::Get(gained_active); 391 WmWindow* gained_active_wm = WmWindow::Get(gained_active);
446 if (gained_active_wm) 392 if (gained_active_wm)
447 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); 393 set_root_window_for_new_windows(gained_active_wm->GetRootWindow());
448 } 394 }
449 395
450 } // namespace ash 396 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698