OLD | NEW |
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/wm/lock_layout_manager.h" | 5 #include "ash/wm/lock_layout_manager.h" |
6 | 6 |
| 7 #include "ash/common/shell_delegate.h" |
7 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
8 #include "ash/common/wm/wm_event.h" | 9 #include "ash/common/wm/wm_event.h" |
9 #include "ash/shell.h" | 10 #include "ash/common/wm_shell.h" |
10 #include "ash/shell_delegate.h" | |
11 #include "ash/wm/lock_window_state.h" | 11 #include "ash/wm/lock_window_state.h" |
12 #include "ash/wm/window_state_aura.h" | 12 #include "ash/wm/window_state_aura.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
15 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
16 #include "ui/keyboard/keyboard_controller.h" | 16 #include "ui/keyboard/keyboard_controller.h" |
17 #include "ui/keyboard/keyboard_util.h" | 17 #include "ui/keyboard/keyboard_util.h" |
18 | 18 |
19 namespace ash { | 19 namespace ash { |
20 | 20 |
21 LockLayoutManager::LockLayoutManager(aura::Window* window) | 21 LockLayoutManager::LockLayoutManager(aura::Window* window) |
22 : SnapToPixelLayoutManager(window), | 22 : SnapToPixelLayoutManager(window), |
23 window_(window), | 23 window_(window), |
24 root_window_(window->GetRootWindow()), | 24 root_window_(window->GetRootWindow()), |
25 is_observing_keyboard_(false) { | 25 is_observing_keyboard_(false) { |
26 Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); | 26 WmShell::Get()->delegate()->AddVirtualKeyboardStateObserver(this); |
27 root_window_->AddObserver(this); | 27 root_window_->AddObserver(this); |
28 if (keyboard::KeyboardController::GetInstance()) { | 28 if (keyboard::KeyboardController::GetInstance()) { |
29 keyboard::KeyboardController::GetInstance()->AddObserver(this); | 29 keyboard::KeyboardController::GetInstance()->AddObserver(this); |
30 is_observing_keyboard_ = true; | 30 is_observing_keyboard_ = true; |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 LockLayoutManager::~LockLayoutManager() { | 34 LockLayoutManager::~LockLayoutManager() { |
35 if (root_window_) | 35 if (root_window_) |
36 root_window_->RemoveObserver(this); | 36 root_window_->RemoveObserver(this); |
37 | 37 |
38 for (aura::Window::Windows::const_iterator it = window_->children().begin(); | 38 for (aura::Window::Windows::const_iterator it = window_->children().begin(); |
39 it != window_->children().end(); ++it) { | 39 it != window_->children().end(); ++it) { |
40 (*it)->RemoveObserver(this); | 40 (*it)->RemoveObserver(this); |
41 } | 41 } |
42 | 42 |
43 Shell::GetInstance()->delegate()->RemoveVirtualKeyboardStateObserver(this); | 43 WmShell::Get()->delegate()->RemoveVirtualKeyboardStateObserver(this); |
44 | 44 |
45 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { | 45 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { |
46 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); | 46 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); |
47 is_observing_keyboard_ = false; | 47 is_observing_keyboard_ = false; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 void LockLayoutManager::OnWindowResized() { | 51 void LockLayoutManager::OnWindowResized() { |
52 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 52 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
53 AdjustWindowsForWorkAreaChange(&event); | 53 AdjustWindowsForWorkAreaChange(&event); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || | 126 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || |
127 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 127 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
128 | 128 |
129 for (aura::Window::Windows::const_iterator it = window_->children().begin(); | 129 for (aura::Window::Windows::const_iterator it = window_->children().begin(); |
130 it != window_->children().end(); ++it) { | 130 it != window_->children().end(); ++it) { |
131 wm::GetWindowState(*it)->OnWMEvent(event); | 131 wm::GetWindowState(*it)->OnWMEvent(event); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 } // namespace ash | 135 } // namespace ash |
OLD | NEW |