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

Side by Side Diff: ash/common/wm/lock_layout_manager.cc

Issue 2739763003: Moves maintaining ShellObservers back to Shell (Closed)
Patch Set: merge 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/lock_layout_manager.h" 5 #include "ash/common/wm/lock_layout_manager.h"
6 6
7 #include "ash/common/wm/lock_window_state.h" 7 #include "ash/common/wm/lock_window_state.h"
8 #include "ash/common/wm/window_state.h" 8 #include "ash/common/wm/window_state.h"
9 #include "ash/common/wm/wm_event.h" 9 #include "ash/common/wm/wm_event.h"
10 #include "ash/common/wm_shell.h"
11 #include "ash/common/wm_window.h" 10 #include "ash/common/wm_window.h"
11 #include "ash/shell.h"
12 #include "ui/events/event.h" 12 #include "ui/events/event.h"
13 #include "ui/keyboard/keyboard_controller.h" 13 #include "ui/keyboard/keyboard_controller.h"
14 #include "ui/keyboard/keyboard_util.h" 14 #include "ui/keyboard/keyboard_util.h"
15 15
16 namespace ash { 16 namespace ash {
17 17
18 LockLayoutManager::LockLayoutManager(WmWindow* window) 18 LockLayoutManager::LockLayoutManager(WmWindow* window)
19 : wm::WmSnapToPixelLayoutManager(), 19 : wm::WmSnapToPixelLayoutManager(),
20 window_(window), 20 window_(window),
21 root_window_(window->GetRootWindow()), 21 root_window_(window->GetRootWindow()),
22 is_observing_keyboard_(false) { 22 is_observing_keyboard_(false) {
23 WmShell::Get()->AddShellObserver(this); 23 Shell::GetInstance()->AddShellObserver(this);
24 root_window_->aura_window()->AddObserver(this); 24 root_window_->aura_window()->AddObserver(this);
25 if (keyboard::KeyboardController::GetInstance()) { 25 if (keyboard::KeyboardController::GetInstance()) {
26 keyboard::KeyboardController::GetInstance()->AddObserver(this); 26 keyboard::KeyboardController::GetInstance()->AddObserver(this);
27 is_observing_keyboard_ = true; 27 is_observing_keyboard_ = true;
28 } 28 }
29 } 29 }
30 30
31 LockLayoutManager::~LockLayoutManager() { 31 LockLayoutManager::~LockLayoutManager() {
32 if (root_window_) 32 if (root_window_)
33 root_window_->aura_window()->RemoveObserver(this); 33 root_window_->aura_window()->RemoveObserver(this);
34 34
35 for (WmWindow* child : window_->GetChildren()) 35 for (WmWindow* child : window_->GetChildren())
36 child->aura_window()->RemoveObserver(this); 36 child->aura_window()->RemoveObserver(this);
37 37
38 WmShell::Get()->RemoveShellObserver(this); 38 Shell::GetInstance()->RemoveShellObserver(this);
39 39
40 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { 40 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) {
41 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); 41 keyboard::KeyboardController::GetInstance()->RemoveObserver(this);
42 is_observing_keyboard_ = false; 42 is_observing_keyboard_ = false;
43 } 43 }
44 } 44 }
45 45
46 void LockLayoutManager::OnWindowResized() { 46 void LockLayoutManager::OnWindowResized() {
47 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); 47 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
48 AdjustWindowsForWorkAreaChange(&event); 48 AdjustWindowsForWorkAreaChange(&event);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void LockLayoutManager::AdjustWindowsForWorkAreaChange( 112 void LockLayoutManager::AdjustWindowsForWorkAreaChange(
113 const wm::WMEvent* event) { 113 const wm::WMEvent* event) {
114 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || 114 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED ||
115 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); 115 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
116 116
117 for (WmWindow* child : window_->GetChildren()) 117 for (WmWindow* child : window_->GetChildren())
118 child->GetWindowState()->OnWMEvent(event); 118 child->GetWindowState()->OnWMEvent(event);
119 } 119 }
120 120
121 } // namespace ash 121 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/dock/docked_window_layout_manager.cc ('k') | ash/common/wm/maximize_mode/maximize_mode_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698