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 #ifndef ASH_COMMON_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_COMMON_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ |
6 #define ASH_COMMON_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ | 6 #define ASH_COMMON_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
12 #include "ash/common/wm/shelf/wm_shelf_observer.h" | 12 #include "ash/common/shelf/wm_shelf_observer.h" |
13 #include "ash/common/wm/window_state_observer.h" | 13 #include "ash/common/wm/window_state_observer.h" |
14 #include "ash/common/wm_activation_observer.h" | 14 #include "ash/common/wm_activation_observer.h" |
15 #include "ash/common/wm_display_observer.h" | 15 #include "ash/common/wm_display_observer.h" |
16 #include "ash/common/wm_layout_manager.h" | 16 #include "ash/common/wm_layout_manager.h" |
17 #include "ash/common/wm_overview_mode_observer.h" | 17 #include "ash/common/wm_overview_mode_observer.h" |
18 #include "ash/common/wm_root_window_controller_observer.h" | 18 #include "ash/common/wm_root_window_controller_observer.h" |
19 #include "ash/common/wm_window_observer.h" | 19 #include "ash/common/wm_window_observer.h" |
20 #include "ash/common/wm_window_tracker.h" | 20 #include "ash/common/wm_window_tracker.h" |
21 #include "base/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
22 #include "base/macros.h" | 22 #include "base/macros.h" |
(...skipping 10 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 namespace views { | 35 namespace views { |
36 class Widget; | 36 class Widget; |
37 } | 37 } |
38 | 38 |
39 namespace ash { | 39 namespace ash { |
40 class PanelCalloutWidget; | 40 class PanelCalloutWidget; |
41 class Shelf; | 41 class Shelf; |
42 class ShelfLayoutManager; | 42 class ShelfLayoutManager; |
| 43 class WmShelf; |
43 | 44 |
44 namespace wm { | 45 namespace wm { |
45 class WmRootWindowController; | 46 class WmRootWindowController; |
46 class WmShelf; | |
47 } | 47 } |
48 | 48 |
49 // PanelLayoutManager is responsible for organizing panels within the | 49 // PanelLayoutManager is responsible for organizing panels within the |
50 // workspace. It is associated with a specific container window (i.e. | 50 // workspace. It is associated with a specific container window (i.e. |
51 // kShellWindowId_PanelContainer) and controls the layout of any windows | 51 // kShellWindowId_PanelContainer) and controls the layout of any windows |
52 // added to that container. | 52 // added to that container. |
53 // | 53 // |
54 // The constructor takes a |panel_container| argument which is expected to set | 54 // The constructor takes a |panel_container| argument which is expected to set |
55 // its layout manager to this instance, e.g.: | 55 // its layout manager to this instance, e.g.: |
56 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); | 56 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); |
57 | 57 |
58 class ASH_EXPORT PanelLayoutManager | 58 class ASH_EXPORT PanelLayoutManager |
59 : public WmLayoutManager, | 59 : public WmLayoutManager, |
60 public wm::WindowStateObserver, | 60 public wm::WindowStateObserver, |
61 public WmActivationObserver, | 61 public WmActivationObserver, |
62 public WmDisplayObserver, | 62 public WmDisplayObserver, |
63 public WmOverviewModeObserver, | 63 public WmOverviewModeObserver, |
64 public WmRootWindowControllerObserver, | 64 public WmRootWindowControllerObserver, |
65 public WmWindowObserver, | 65 public WmWindowObserver, |
66 public keyboard::KeyboardControllerObserver, | 66 public keyboard::KeyboardControllerObserver, |
67 public wm::WmShelfObserver { | 67 public WmShelfObserver { |
68 public: | 68 public: |
69 explicit PanelLayoutManager(WmWindow* panel_container); | 69 explicit PanelLayoutManager(WmWindow* panel_container); |
70 ~PanelLayoutManager() override; | 70 ~PanelLayoutManager() override; |
71 | 71 |
72 // Returns the PanelLayoutManager in the specified hierarchy. This searches | 72 // Returns the PanelLayoutManager in the specified hierarchy. This searches |
73 // from the root of |window|. | 73 // from the root of |window|. |
74 static PanelLayoutManager* Get(WmWindow* window); | 74 static PanelLayoutManager* Get(WmWindow* window); |
75 | 75 |
76 // Call Shutdown() before deleting children of panel_container. | 76 // Call Shutdown() before deleting children of panel_container. |
77 void Shutdown(); | 77 void Shutdown(); |
78 | 78 |
79 void StartDragging(WmWindow* panel); | 79 void StartDragging(WmWindow* panel); |
80 void FinishDragging(); | 80 void FinishDragging(); |
81 | 81 |
82 void ToggleMinimize(WmWindow* panel); | 82 void ToggleMinimize(WmWindow* panel); |
83 | 83 |
84 // Hide / Show the panel callout widgets. | 84 // Hide / Show the panel callout widgets. |
85 void SetShowCalloutWidgets(bool show); | 85 void SetShowCalloutWidgets(bool show); |
86 | 86 |
87 // Returns the callout widget (arrow) for |panel|. | 87 // Returns the callout widget (arrow) for |panel|. |
88 views::Widget* GetCalloutWidgetForPanel(WmWindow* panel); | 88 views::Widget* GetCalloutWidgetForPanel(WmWindow* panel); |
89 | 89 |
90 wm::WmShelf* shelf() { return shelf_; } | 90 WmShelf* shelf() { return shelf_; } |
91 void SetShelf(wm::WmShelf* shelf); | 91 void SetShelf(WmShelf* shelf); |
92 | 92 |
93 // Overridden from WmLayoutManager | 93 // Overridden from WmLayoutManager |
94 void OnWindowResized() override; | 94 void OnWindowResized() override; |
95 void OnWindowAddedToLayout(WmWindow* child) override; | 95 void OnWindowAddedToLayout(WmWindow* child) override; |
96 void OnWillRemoveWindowFromLayout(WmWindow* child) override; | 96 void OnWillRemoveWindowFromLayout(WmWindow* child) override; |
97 void OnWindowRemovedFromLayout(WmWindow* child) override; | 97 void OnWindowRemovedFromLayout(WmWindow* child) override; |
98 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override; | 98 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override; |
99 void SetChildBounds(WmWindow* child, | 99 void SetChildBounds(WmWindow* child, |
100 const gfx::Rect& requested_bounds) override; | 100 const gfx::Rect& requested_bounds) override; |
101 | 101 |
(...skipping 11 matching lines...) Expand all Loading... |
113 void OnPostWindowStateTypeChange(wm::WindowState* window_state, | 113 void OnPostWindowStateTypeChange(wm::WindowState* window_state, |
114 wm::WindowStateType old_type) override; | 114 wm::WindowStateType old_type) override; |
115 | 115 |
116 // Overridden from WmActivationObserver | 116 // Overridden from WmActivationObserver |
117 void OnWindowActivated(WmWindow* gained_active, | 117 void OnWindowActivated(WmWindow* gained_active, |
118 WmWindow* lost_active) override; | 118 WmWindow* lost_active) override; |
119 | 119 |
120 // Overridden from WindowTreeHostManager::Observer | 120 // Overridden from WindowTreeHostManager::Observer |
121 void OnDisplayConfigurationChanged() override; | 121 void OnDisplayConfigurationChanged() override; |
122 | 122 |
123 // Overridden from wm::WmShelfObserver | 123 // Overridden from WmShelfObserver |
124 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; | 124 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; |
125 void OnShelfIconPositionsChanged() override; | 125 void OnShelfIconPositionsChanged() override; |
126 | 126 |
127 private: | 127 private: |
128 friend class PanelLayoutManagerTest; | 128 friend class PanelLayoutManagerTest; |
129 friend class PanelWindowResizerTest; | 129 friend class PanelWindowResizerTest; |
130 friend class DockedWindowResizerTest; | 130 friend class DockedWindowResizerTest; |
131 friend class DockedWindowLayoutManagerTest; | 131 friend class DockedWindowLayoutManagerTest; |
132 friend class WorkspaceControllerTest; | 132 friend class WorkspaceControllerTest; |
133 friend class AcceleratorControllerTest; | 133 friend class AcceleratorControllerTest; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 bool in_add_window_; | 185 bool in_add_window_; |
186 // Protect against recursive calls to Relayout(). | 186 // Protect against recursive calls to Relayout(). |
187 bool in_layout_; | 187 bool in_layout_; |
188 // Indicates if the panel callout widget should be created. | 188 // Indicates if the panel callout widget should be created. |
189 bool show_callout_widgets_; | 189 bool show_callout_widgets_; |
190 // Ordered list of unowned pointers to panel windows. | 190 // Ordered list of unowned pointers to panel windows. |
191 PanelList panel_windows_; | 191 PanelList panel_windows_; |
192 // The panel being dragged. | 192 // The panel being dragged. |
193 WmWindow* dragged_panel_; | 193 WmWindow* dragged_panel_; |
194 // The shelf we are observing for shelf icon changes. | 194 // The shelf we are observing for shelf icon changes. |
195 wm::WmShelf* shelf_; | 195 WmShelf* shelf_; |
196 | 196 |
197 // When not NULL, the shelf is hidden (i.e. full screen) and this tracks the | 197 // When not NULL, the shelf is hidden (i.e. full screen) and this tracks the |
198 // set of panel windows which have been temporarily hidden and need to be | 198 // set of panel windows which have been temporarily hidden and need to be |
199 // restored when the shelf becomes visible again. | 199 // restored when the shelf becomes visible again. |
200 std::unique_ptr<WmWindowTracker> restore_windows_on_shelf_visible_; | 200 std::unique_ptr<WmWindowTracker> restore_windows_on_shelf_visible_; |
201 | 201 |
202 // The last active panel. Used to maintain stacking order even if no panels | 202 // The last active panel. Used to maintain stacking order even if no panels |
203 // are currently focused. | 203 // are currently focused. |
204 WmWindow* last_active_panel_; | 204 WmWindow* last_active_panel_; |
205 base::WeakPtrFactory<PanelLayoutManager> weak_factory_; | 205 base::WeakPtrFactory<PanelLayoutManager> weak_factory_; |
206 | 206 |
207 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); | 207 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); |
208 }; | 208 }; |
209 | 209 |
210 } // namespace ash | 210 } // namespace ash |
211 | 211 |
212 #endif // ASH_COMMON_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ | 212 #endif // ASH_COMMON_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ |
OLD | NEW |