Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: ash/wm/panels/panel_layout_manager.h

Issue 1929023002: Refactors WindowResizers to use ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move forward declaration Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/panels/attached_panel_window_targeter.cc ('k') | ash/wm/panels/panel_layout_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ 5 #ifndef ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_
6 #define ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ 6 #define ASH_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/shelf/shelf_icon_observer.h" 12 #include "ash/shelf/shelf_icon_observer.h"
13 #include "ash/shelf/shelf_layout_manager_observer.h"
14 #include "ash/shell_observer.h" 13 #include "ash/shell_observer.h"
14 #include "ash/wm/common/shelf/wm_shelf_observer.h"
15 #include "ash/wm/common/window_state_observer.h" 15 #include "ash/wm/common/window_state_observer.h"
16 #include "ash/wm/common/wm_activation_observer.h" 16 #include "ash/wm/common/wm_activation_observer.h"
17 #include "ash/wm/common/wm_display_observer.h" 17 #include "ash/wm/common/wm_display_observer.h"
18 #include "ash/wm/common/wm_layout_manager.h" 18 #include "ash/wm/common/wm_layout_manager.h"
19 #include "ash/wm/common/wm_overview_mode_observer.h" 19 #include "ash/wm/common/wm_overview_mode_observer.h"
20 #include "ash/wm/common/wm_root_window_controller_observer.h" 20 #include "ash/wm/common/wm_root_window_controller_observer.h"
21 #include "ash/wm/common/wm_window_observer.h" 21 #include "ash/wm/common/wm_window_observer.h"
22 #include "ash/wm/common/wm_window_tracker.h" 22 #include "ash/wm/common/wm_window_tracker.h"
23 #include "base/compiler_specific.h" 23 #include "base/compiler_specific.h"
24 #include "base/macros.h" 24 #include "base/macros.h"
(...skipping 13 matching lines...) Expand all
38 class Widget; 38 class Widget;
39 } 39 }
40 40
41 namespace ash { 41 namespace ash {
42 class PanelCalloutWidget; 42 class PanelCalloutWidget;
43 class Shelf; 43 class Shelf;
44 class ShelfLayoutManager; 44 class ShelfLayoutManager;
45 45
46 namespace wm { 46 namespace wm {
47 class WmRootWindowController; 47 class WmRootWindowController;
48 class WmShelf;
48 } 49 }
49 50
50 // PanelLayoutManager is responsible for organizing panels within the 51 // PanelLayoutManager is responsible for organizing panels within the
51 // workspace. It is associated with a specific container window (i.e. 52 // workspace. It is associated with a specific container window (i.e.
52 // kShellWindowId_PanelContainer) and controls the layout of any windows 53 // kShellWindowId_PanelContainer) and controls the layout of any windows
53 // added to that container. 54 // added to that container.
54 // 55 //
55 // The constructor takes a |panel_container| argument which is expected to set 56 // The constructor takes a |panel_container| argument which is expected to set
56 // its layout manager to this instance, e.g.: 57 // its layout manager to this instance, e.g.:
57 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); 58 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container));
58 59
59 class ASH_EXPORT PanelLayoutManager 60 class ASH_EXPORT PanelLayoutManager
60 : public wm::WmLayoutManager, 61 : public wm::WmLayoutManager,
61 public ShelfIconObserver, 62 public ShelfIconObserver,
62 public wm::WindowStateObserver, 63 public wm::WindowStateObserver,
63 public wm::WmActivationObserver, 64 public wm::WmActivationObserver,
64 public wm::WmDisplayObserver, 65 public wm::WmDisplayObserver,
65 public wm::WmOverviewModeObserver, 66 public wm::WmOverviewModeObserver,
66 public wm::WmRootWindowControllerObserver, 67 public wm::WmRootWindowControllerObserver,
67 public wm::WmWindowObserver, 68 public wm::WmWindowObserver,
68 public keyboard::KeyboardControllerObserver, 69 public keyboard::KeyboardControllerObserver,
69 public ShelfLayoutManagerObserver { 70 public wm::WmShelfObserver {
70 public: 71 public:
71 explicit PanelLayoutManager(wm::WmWindow* panel_container); 72 explicit PanelLayoutManager(wm::WmWindow* panel_container);
72 ~PanelLayoutManager() override; 73 ~PanelLayoutManager() override;
73 74
74 // Returns the PanelLayoutManager in the specified hierarchy. This searches 75 // Returns the PanelLayoutManager in the specified hierarchy. This searches
75 // from the root of |window|. 76 // from the root of |window|.
76 static PanelLayoutManager* Get(wm::WmWindow* window); 77 static PanelLayoutManager* Get(wm::WmWindow* window);
77 78
78 // Call Shutdown() before deleting children of panel_container. 79 // Call Shutdown() before deleting children of panel_container.
79 void Shutdown(); 80 void Shutdown();
80 81
81 void StartDragging(wm::WmWindow* panel); 82 void StartDragging(wm::WmWindow* panel);
82 void FinishDragging(); 83 void FinishDragging();
83 84
84 void ToggleMinimize(wm::WmWindow* panel); 85 void ToggleMinimize(wm::WmWindow* panel);
85 86
86 // Hide / Show the panel callout widgets. 87 // Hide / Show the panel callout widgets.
87 void SetShowCalloutWidgets(bool show); 88 void SetShowCalloutWidgets(bool show);
88 89
89 // Returns the callout widget (arrow) for |panel|. 90 // Returns the callout widget (arrow) for |panel|.
90 views::Widget* GetCalloutWidgetForPanel(wm::WmWindow* panel); 91 views::Widget* GetCalloutWidgetForPanel(wm::WmWindow* panel);
91 92
92 Shelf* shelf() { return shelf_; } 93 wm::WmShelf* shelf() { return shelf_; }
93 void SetShelf(Shelf* shelf); 94 void SetShelf(wm::WmShelf* shelf);
94 95
95 // Overridden from wm::WmLayoutManager 96 // Overridden from wm::WmLayoutManager
96 void OnWindowResized() override; 97 void OnWindowResized() override;
97 void OnWindowAddedToLayout(wm::WmWindow* child) override; 98 void OnWindowAddedToLayout(wm::WmWindow* child) override;
98 void OnWillRemoveWindowFromLayout(wm::WmWindow* child) override; 99 void OnWillRemoveWindowFromLayout(wm::WmWindow* child) override;
99 void OnWindowRemovedFromLayout(wm::WmWindow* child) override; 100 void OnWindowRemovedFromLayout(wm::WmWindow* child) override;
100 void OnChildWindowVisibilityChanged(wm::WmWindow* child, 101 void OnChildWindowVisibilityChanged(wm::WmWindow* child,
101 bool visibile) override; 102 bool visibile) override;
102 void SetChildBounds(wm::WmWindow* child, 103 void SetChildBounds(wm::WmWindow* child,
103 const gfx::Rect& requested_bounds) override; 104 const gfx::Rect& requested_bounds) override;
104 105
105 // Overridden from ShelfIconObserver
106 void OnShelfIconPositionsChanged() override;
107
108 // Overridden from wm::WmOverviewModeObserver 106 // Overridden from wm::WmOverviewModeObserver
109 void OnOverviewModeEnded() override; 107 void OnOverviewModeEnded() override;
110 108
111 // Overridden from wm::WmRootWindowControllerObserver 109 // Overridden from wm::WmRootWindowControllerObserver
112 void OnShelfAlignmentChanged() override; 110 void OnShelfAlignmentChanged() override;
113 111
114 // Overridden from wm::WmWindowObserver 112 // Overridden from wm::WmWindowObserver
115 void OnWindowPropertyChanged(wm::WmWindow* window, 113 void OnWindowPropertyChanged(wm::WmWindow* window,
116 wm::WmWindowProperty property, 114 wm::WmWindowProperty property,
117 intptr_t old) override; 115 intptr_t old) override;
118 116
119 // Overridden from wm::WindowStateObserver 117 // Overridden from wm::WindowStateObserver
120 void OnPostWindowStateTypeChange(wm::WindowState* window_state, 118 void OnPostWindowStateTypeChange(wm::WindowState* window_state,
121 wm::WindowStateType old_type) override; 119 wm::WindowStateType old_type) override;
122 120
123 // Overridden from wm::WmActivationObserver 121 // Overridden from wm::WmActivationObserver
124 void OnWindowActivated(wm::WmWindow* gained_active, 122 void OnWindowActivated(wm::WmWindow* gained_active,
125 wm::WmWindow* lost_active) override; 123 wm::WmWindow* lost_active) override;
126 124
127 // Overridden from WindowTreeHostManager::Observer 125 // Overridden from WindowTreeHostManager::Observer
128 void OnDisplayConfigurationChanged() override; 126 void OnDisplayConfigurationChanged() override;
129 127
130 // Overridden from ShelfLayoutManagerObserver 128 // Overridden from wm::WmShelfObserver
131 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; 129 void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
130 void OnShelfIconPositionsChanged() override;
132 131
133 private: 132 private:
134 friend class PanelLayoutManagerTest; 133 friend class PanelLayoutManagerTest;
135 friend class PanelWindowResizerTest; 134 friend class PanelWindowResizerTest;
136 friend class DockedWindowResizerTest; 135 friend class DockedWindowResizerTest;
137 friend class DockedWindowLayoutManagerTest; 136 friend class DockedWindowLayoutManagerTest;
138 friend class WorkspaceControllerTest; 137 friend class WorkspaceControllerTest;
139 friend class AcceleratorControllerTest; 138 friend class AcceleratorControllerTest;
140 139
141 views::Widget* CreateCalloutWidget(); 140 views::Widget* CreateCalloutWidget();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 bool in_add_window_; 190 bool in_add_window_;
192 // Protect against recursive calls to Relayout(). 191 // Protect against recursive calls to Relayout().
193 bool in_layout_; 192 bool in_layout_;
194 // Indicates if the panel callout widget should be created. 193 // Indicates if the panel callout widget should be created.
195 bool show_callout_widgets_; 194 bool show_callout_widgets_;
196 // Ordered list of unowned pointers to panel windows. 195 // Ordered list of unowned pointers to panel windows.
197 PanelList panel_windows_; 196 PanelList panel_windows_;
198 // The panel being dragged. 197 // The panel being dragged.
199 wm::WmWindow* dragged_panel_; 198 wm::WmWindow* dragged_panel_;
200 // The shelf we are observing for shelf icon changes. 199 // The shelf we are observing for shelf icon changes.
201 Shelf* shelf_; 200 wm::WmShelf* shelf_;
202 // The shelf layout manager being observed for visibility changes.
203 ShelfLayoutManager* shelf_layout_manager_;
204 201
205 // When not NULL, the shelf is hidden (i.e. full screen) and this tracks the 202 // When not NULL, the shelf is hidden (i.e. full screen) and this tracks the
206 // set of panel windows which have been temporarily hidden and need to be 203 // set of panel windows which have been temporarily hidden and need to be
207 // restored when the shelf becomes visible again. 204 // restored when the shelf becomes visible again.
208 std::unique_ptr<wm::WmWindowTracker> restore_windows_on_shelf_visible_; 205 std::unique_ptr<wm::WmWindowTracker> restore_windows_on_shelf_visible_;
209 206
210 // The last active panel. Used to maintain stacking order even if no panels 207 // The last active panel. Used to maintain stacking order even if no panels
211 // are currently focused. 208 // are currently focused.
212 wm::WmWindow* last_active_panel_; 209 wm::WmWindow* last_active_panel_;
213 base::WeakPtrFactory<PanelLayoutManager> weak_factory_; 210 base::WeakPtrFactory<PanelLayoutManager> weak_factory_;
214 211
215 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); 212 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager);
216 }; 213 };
217 214
218 } // namespace ash 215 } // namespace ash
219 216
220 #endif // ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ 217 #endif // ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/wm/panels/attached_panel_window_targeter.cc ('k') | ash/wm/panels/panel_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698