| 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/panels/panel_layout_manager.h" | 5 #include "ash/common/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 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 root_window_controller_(panel_container->GetRootWindowController()), | 251 root_window_controller_(panel_container->GetRootWindowController()), |
| 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 WmShell* shell = panel_container->GetShell(); | |
| 262 Shell::GetInstance()->activation_client()->AddObserver(this); | 261 Shell::GetInstance()->activation_client()->AddObserver(this); |
| 263 shell->AddDisplayObserver(this); | 262 WmShell::Get()->AddDisplayObserver(this); |
| 264 Shell::GetInstance()->AddShellObserver(this); | 263 Shell::GetInstance()->AddShellObserver(this); |
| 265 } | 264 } |
| 266 | 265 |
| 267 PanelLayoutManager::~PanelLayoutManager() { | 266 PanelLayoutManager::~PanelLayoutManager() { |
| 268 Shutdown(); | 267 Shutdown(); |
| 269 } | 268 } |
| 270 | 269 |
| 271 // static | 270 // static |
| 272 PanelLayoutManager* PanelLayoutManager::Get(WmWindow* window) { | 271 PanelLayoutManager* PanelLayoutManager::Get(WmWindow* window) { |
| 273 if (!window) | 272 if (!window) |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 608 |
| 610 void PanelLayoutManager::Relayout() { | 609 void PanelLayoutManager::Relayout() { |
| 611 if (!shelf_ || !shelf_->GetWindow()) | 610 if (!shelf_ || !shelf_->GetWindow()) |
| 612 return; | 611 return; |
| 613 | 612 |
| 614 // Suppress layouts during overview mode because changing window bounds | 613 // Suppress layouts during overview mode because changing window bounds |
| 615 // interfered with overview mode animations. However, layouts need to be done | 614 // interfered with overview mode animations. However, layouts need to be done |
| 616 // when the WindowSelectorController is restoring minimized windows so that | 615 // when the WindowSelectorController is restoring minimized windows so that |
| 617 // they actually become visible. | 616 // they actually become visible. |
| 618 WindowSelectorController* window_selector_controller = | 617 WindowSelectorController* window_selector_controller = |
| 619 WmShell::Get()->window_selector_controller(); | 618 Shell::Get()->window_selector_controller(); |
| 620 if (in_layout_ || | 619 if (in_layout_ || |
| 621 (window_selector_controller->IsSelecting() && | 620 (window_selector_controller->IsSelecting() && |
| 622 !window_selector_controller->IsRestoringMinimizedWindows())) { | 621 !window_selector_controller->IsRestoringMinimizedWindows())) { |
| 623 return; | 622 return; |
| 624 } | 623 } |
| 625 | 624 |
| 626 base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true); | 625 base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true); |
| 627 | 626 |
| 628 const ShelfAlignment alignment = shelf_->GetAlignment(); | 627 const ShelfAlignment alignment = shelf_->GetAlignment(); |
| 629 const bool horizontal = shelf_->IsHorizontalAlignment(); | 628 const bool horizontal = shelf_->IsHorizontalAlignment(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 // This bounds change will have caused a change to the Shelf which does not | 942 // This bounds change will have caused a change to the Shelf which does not |
| 944 // propogate automatically to this class, so manually recalculate bounds. | 943 // propogate automatically to this class, so manually recalculate bounds. |
| 945 OnWindowResized(); | 944 OnWindowResized(); |
| 946 } | 945 } |
| 947 | 946 |
| 948 void PanelLayoutManager::OnKeyboardClosed() { | 947 void PanelLayoutManager::OnKeyboardClosed() { |
| 949 keyboard_observer_.RemoveAll(); | 948 keyboard_observer_.RemoveAll(); |
| 950 } | 949 } |
| 951 | 950 |
| 952 } // namespace ash | 951 } // namespace ash |
| OLD | NEW |