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/wm/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "ash/keyboard/keyboard_observer_register.h" | 11 #include "ash/keyboard/keyboard_observer_register.h" |
12 #include "ash/public/cpp/shell_window_ids.h" | 12 #include "ash/public/cpp/shell_window_ids.h" |
13 #include "ash/public/cpp/window_properties.h" | 13 #include "ash/public/cpp/window_properties.h" |
14 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
15 #include "ash/shelf/wm_shelf.h" | 15 #include "ash/shelf/wm_shelf.h" |
16 #include "ash/shelf/wm_shelf_util.h" | 16 #include "ash/shelf/wm_shelf_util.h" |
17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "ash/shell_port.h" |
18 #include "ash/wm/overview/window_selector_controller.h" | 19 #include "ash/wm/overview/window_selector_controller.h" |
19 #include "ash/wm/window_animation_types.h" | 20 #include "ash/wm/window_animation_types.h" |
20 #include "ash/wm/window_parenting_utils.h" | 21 #include "ash/wm/window_parenting_utils.h" |
21 #include "ash/wm/window_properties.h" | 22 #include "ash/wm/window_properties.h" |
22 #include "ash/wm/window_state.h" | 23 #include "ash/wm/window_state.h" |
23 #include "ash/wm/window_state_aura.h" | 24 #include "ash/wm/window_state_aura.h" |
24 #include "ash/wm/window_util.h" | 25 #include "ash/wm/window_util.h" |
25 #include "ash/wm_shell.h" | |
26 #include "ash/wm_window.h" | 26 #include "ash/wm_window.h" |
27 #include "base/auto_reset.h" | 27 #include "base/auto_reset.h" |
28 #include "third_party/skia/include/core/SkColor.h" | 28 #include "third_party/skia/include/core/SkColor.h" |
29 #include "third_party/skia/include/core/SkPath.h" | 29 #include "third_party/skia/include/core/SkPath.h" |
30 #include "ui/aura/client/window_parenting_client.h" | 30 #include "ui/aura/client/window_parenting_client.h" |
31 #include "ui/aura/window_delegate.h" | 31 #include "ui/aura/window_delegate.h" |
32 #include "ui/compositor/scoped_layer_animation_settings.h" | 32 #include "ui/compositor/scoped_layer_animation_settings.h" |
33 #include "ui/gfx/canvas.h" | 33 #include "ui/gfx/canvas.h" |
34 #include "ui/gfx/geometry/rect.h" | 34 #include "ui/gfx/geometry/rect.h" |
35 #include "ui/gfx/geometry/vector2d.h" | 35 #include "ui/gfx/geometry/vector2d.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 in_add_window_(false), | 252 in_add_window_(false), |
253 in_layout_(false), | 253 in_layout_(false), |
254 show_callout_widgets_(true), | 254 show_callout_widgets_(true), |
255 dragged_panel_(nullptr), | 255 dragged_panel_(nullptr), |
256 shelf_(nullptr), | 256 shelf_(nullptr), |
257 last_active_panel_(nullptr), | 257 last_active_panel_(nullptr), |
258 keyboard_observer_(this), | 258 keyboard_observer_(this), |
259 weak_factory_(this) { | 259 weak_factory_(this) { |
260 DCHECK(panel_container); | 260 DCHECK(panel_container); |
261 Shell::Get()->activation_client()->AddObserver(this); | 261 Shell::Get()->activation_client()->AddObserver(this); |
262 WmShell::Get()->AddDisplayObserver(this); | 262 ShellPort::Get()->AddDisplayObserver(this); |
263 Shell::Get()->AddShellObserver(this); | 263 Shell::Get()->AddShellObserver(this); |
264 } | 264 } |
265 | 265 |
266 PanelLayoutManager::~PanelLayoutManager() { | 266 PanelLayoutManager::~PanelLayoutManager() { |
267 Shutdown(); | 267 Shutdown(); |
268 } | 268 } |
269 | 269 |
270 // static | 270 // static |
271 PanelLayoutManager* PanelLayoutManager::Get(WmWindow* window) { | 271 PanelLayoutManager* PanelLayoutManager::Get(WmWindow* window) { |
272 if (!window) | 272 if (!window) |
273 return nullptr; | 273 return nullptr; |
274 | 274 |
275 return static_cast<PanelLayoutManager*>( | 275 return static_cast<PanelLayoutManager*>( |
276 window->GetRootWindow() | 276 window->GetRootWindow() |
277 ->GetChildByShellWindowId(kShellWindowId_PanelContainer) | 277 ->GetChildByShellWindowId(kShellWindowId_PanelContainer) |
278 ->aura_window() | 278 ->aura_window() |
279 ->layout_manager()); | 279 ->layout_manager()); |
280 } | 280 } |
281 | 281 |
282 void PanelLayoutManager::Shutdown() { | 282 void PanelLayoutManager::Shutdown() { |
283 if (shelf_) { | 283 if (shelf_) { |
284 shelf_->RemoveObserver(this); | 284 shelf_->RemoveObserver(this); |
285 shelf_ = nullptr; | 285 shelf_ = nullptr; |
286 } | 286 } |
287 for (PanelList::iterator iter = panel_windows_.begin(); | 287 for (PanelList::iterator iter = panel_windows_.begin(); |
288 iter != panel_windows_.end(); ++iter) { | 288 iter != panel_windows_.end(); ++iter) { |
289 delete iter->callout_widget; | 289 delete iter->callout_widget; |
290 } | 290 } |
291 panel_windows_.clear(); | 291 panel_windows_.clear(); |
292 WmShell* shell = panel_container_->GetShell(); | |
293 Shell::Get()->activation_client()->RemoveObserver(this); | 292 Shell::Get()->activation_client()->RemoveObserver(this); |
294 shell->RemoveDisplayObserver(this); | 293 ShellPort::Get()->RemoveDisplayObserver(this); |
295 Shell::Get()->RemoveShellObserver(this); | 294 Shell::Get()->RemoveShellObserver(this); |
296 } | 295 } |
297 | 296 |
298 void PanelLayoutManager::StartDragging(WmWindow* panel) { | 297 void PanelLayoutManager::StartDragging(WmWindow* panel) { |
299 DCHECK(!dragged_panel_); | 298 DCHECK(!dragged_panel_); |
300 dragged_panel_ = panel; | 299 dragged_panel_ = panel; |
301 Relayout(); | 300 Relayout(); |
302 } | 301 } |
303 | 302 |
304 void PanelLayoutManager::FinishDragging() { | 303 void PanelLayoutManager::FinishDragging() { |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 // This bounds change will have caused a change to the Shelf which does not | 941 // This bounds change will have caused a change to the Shelf which does not |
943 // propogate automatically to this class, so manually recalculate bounds. | 942 // propogate automatically to this class, so manually recalculate bounds. |
944 OnWindowResized(); | 943 OnWindowResized(); |
945 } | 944 } |
946 | 945 |
947 void PanelLayoutManager::OnKeyboardClosed() { | 946 void PanelLayoutManager::OnKeyboardClosed() { |
948 keyboard_observer_.RemoveAll(); | 947 keyboard_observer_.RemoveAll(); |
949 } | 948 } |
950 | 949 |
951 } // namespace ash | 950 } // namespace ash |
OLD | NEW |