OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system_modal_container_layout_manager.h" | 5 #include "ash/common/wm/system_modal_container_layout_manager.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 //////////////////////////////////////////////////////////////////////////////// | 40 //////////////////////////////////////////////////////////////////////////////// |
41 // SystemModalContainerLayoutManager, public: | 41 // SystemModalContainerLayoutManager, public: |
42 | 42 |
43 SystemModalContainerLayoutManager::SystemModalContainerLayoutManager( | 43 SystemModalContainerLayoutManager::SystemModalContainerLayoutManager( |
44 WmWindow* container) | 44 WmWindow* container) |
45 : container_(container) {} | 45 : container_(container) {} |
46 | 46 |
47 SystemModalContainerLayoutManager::~SystemModalContainerLayoutManager() {} | 47 SystemModalContainerLayoutManager::~SystemModalContainerLayoutManager() { |
| 48 if (keyboard::KeyboardController::GetInstance()) |
| 49 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); |
| 50 } |
48 | 51 |
49 //////////////////////////////////////////////////////////////////////////////// | 52 //////////////////////////////////////////////////////////////////////////////// |
50 // SystemModalContainerLayoutManager, WmLayoutManager implementation: | 53 // SystemModalContainerLayoutManager, WmLayoutManager implementation: |
51 | 54 |
52 void SystemModalContainerLayoutManager::OnWindowResized() { | 55 void SystemModalContainerLayoutManager::OnWindowResized() { |
53 PositionDialogsAfterWorkAreaResize(); | 56 PositionDialogsAfterWorkAreaResize(); |
54 } | 57 } |
55 | 58 |
56 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(WmWindow* child) { | 59 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(WmWindow* child) { |
57 DCHECK(child->GetType() == ui::wm::WINDOW_TYPE_NORMAL || | 60 DCHECK(child->GetType() == ui::wm::WINDOW_TYPE_NORMAL || |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 126 |
124 //////////////////////////////////////////////////////////////////////////////// | 127 //////////////////////////////////////////////////////////////////////////////// |
125 // SystemModalContainerLayoutManager, Keyboard::KeybaordControllerObserver | 128 // SystemModalContainerLayoutManager, Keyboard::KeybaordControllerObserver |
126 // implementation: | 129 // implementation: |
127 | 130 |
128 void SystemModalContainerLayoutManager::OnKeyboardBoundsChanging( | 131 void SystemModalContainerLayoutManager::OnKeyboardBoundsChanging( |
129 const gfx::Rect& new_bounds) { | 132 const gfx::Rect& new_bounds) { |
130 PositionDialogsAfterWorkAreaResize(); | 133 PositionDialogsAfterWorkAreaResize(); |
131 } | 134 } |
132 | 135 |
| 136 void SystemModalContainerLayoutManager::OnKeyboardClosed() {} |
| 137 |
133 bool SystemModalContainerLayoutManager::IsPartOfActiveModalWindow( | 138 bool SystemModalContainerLayoutManager::IsPartOfActiveModalWindow( |
134 WmWindow* window) { | 139 WmWindow* window) { |
135 return modal_window() && | 140 return modal_window() && |
136 (modal_window()->Contains(window) || | 141 (modal_window()->Contains(window) || |
137 HasTransientAncestor(window->GetToplevelWindowForFocus(), | 142 HasTransientAncestor(window->GetToplevelWindowForFocus(), |
138 modal_window())); | 143 modal_window())); |
139 } | 144 } |
140 | 145 |
141 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() { | 146 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() { |
142 if (modal_windows_.empty()) | 147 if (modal_windows_.empty()) |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 bool SystemModalContainerLayoutManager::IsBoundsCentered( | 263 bool SystemModalContainerLayoutManager::IsBoundsCentered( |
259 const gfx::Rect& bounds) const { | 264 const gfx::Rect& bounds) const { |
260 gfx::Point window_center = bounds.CenterPoint(); | 265 gfx::Point window_center = bounds.CenterPoint(); |
261 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); | 266 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); |
262 return std::abs(window_center.x() - container_center.x()) < | 267 return std::abs(window_center.x() - container_center.x()) < |
263 kCenterPixelDelta && | 268 kCenterPixelDelta && |
264 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; | 269 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; |
265 } | 270 } |
266 | 271 |
267 } // namespace ash | 272 } // namespace ash |
OLD | NEW |