| 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_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 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 class ASH_EXPORT PanelLayoutManager | 53 class ASH_EXPORT PanelLayoutManager |
| 54 : public aura::LayoutManager, | 54 : public aura::LayoutManager, |
| 55 public wm::WindowStateObserver, | 55 public wm::WindowStateObserver, |
| 56 public aura::client::ActivationChangeObserver, | 56 public aura::client::ActivationChangeObserver, |
| 57 public WmDisplayObserver, | 57 public WmDisplayObserver, |
| 58 public ShellObserver, | 58 public ShellObserver, |
| 59 public aura::WindowObserver, | 59 public aura::WindowObserver, |
| 60 public keyboard::KeyboardControllerObserver, | 60 public keyboard::KeyboardControllerObserver, |
| 61 public WmShelfObserver { | 61 public WmShelfObserver { |
| 62 public: | 62 public: |
| 63 explicit PanelLayoutManager(WmWindow* panel_container); | 63 explicit PanelLayoutManager(aura::Window* panel_container); |
| 64 ~PanelLayoutManager() override; | 64 ~PanelLayoutManager() override; |
| 65 | 65 |
| 66 // Returns the PanelLayoutManager in the specified hierarchy. This searches | 66 // Returns the PanelLayoutManager in the specified hierarchy. This searches |
| 67 // from the root of |window|. | 67 // from the root of |window|. |
| 68 static PanelLayoutManager* Get(WmWindow* window); | 68 static PanelLayoutManager* Get(aura::Window* window); |
| 69 | 69 |
| 70 // Call Shutdown() before deleting children of panel_container. | 70 // Call Shutdown() before deleting children of panel_container. |
| 71 void Shutdown(); | 71 void Shutdown(); |
| 72 | 72 |
| 73 void StartDragging(WmWindow* panel); | 73 void StartDragging(aura::Window* panel); |
| 74 void FinishDragging(); | 74 void FinishDragging(); |
| 75 | 75 |
| 76 void ToggleMinimize(WmWindow* panel); | 76 void ToggleMinimize(aura::Window* panel); |
| 77 | 77 |
| 78 // Hide / Show the panel callout widgets. | 78 // Hide / Show the panel callout widgets. |
| 79 void SetShowCalloutWidgets(bool show); | 79 void SetShowCalloutWidgets(bool show); |
| 80 | 80 |
| 81 // Returns the callout widget (arrow) for |panel|. | 81 // Returns the callout widget (arrow) for |panel|. |
| 82 views::Widget* GetCalloutWidgetForPanel(WmWindow* panel); | 82 views::Widget* GetCalloutWidgetForPanel(aura::Window* panel); |
| 83 | 83 |
| 84 WmShelf* shelf() { return shelf_; } | 84 WmShelf* shelf() { return shelf_; } |
| 85 void SetShelf(WmShelf* shelf); | 85 void SetShelf(WmShelf* shelf); |
| 86 | 86 |
| 87 // aura::LayoutManager: | 87 // aura::LayoutManager: |
| 88 void OnWindowResized() override; | 88 void OnWindowResized() override; |
| 89 void OnWindowAddedToLayout(aura::Window* child) override; | 89 void OnWindowAddedToLayout(aura::Window* child) override; |
| 90 void OnWillRemoveWindowFromLayout(aura::Window* child) override; | 90 void OnWillRemoveWindowFromLayout(aura::Window* child) override; |
| 91 void OnWindowRemovedFromLayout(aura::Window* child) override; | 91 void OnWindowRemovedFromLayout(aura::Window* child) override; |
| 92 void OnChildWindowVisibilityChanged(aura::Window* child, | 92 void OnChildWindowVisibilityChanged(aura::Window* child, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 friend class PanelLayoutManagerTest; | 125 friend class PanelLayoutManagerTest; |
| 126 friend class PanelWindowResizerTest; | 126 friend class PanelWindowResizerTest; |
| 127 friend class WorkspaceControllerTest; | 127 friend class WorkspaceControllerTest; |
| 128 friend class AcceleratorControllerTest; | 128 friend class AcceleratorControllerTest; |
| 129 | 129 |
| 130 views::Widget* CreateCalloutWidget(); | 130 views::Widget* CreateCalloutWidget(); |
| 131 | 131 |
| 132 struct ASH_EXPORT PanelInfo { | 132 struct ASH_EXPORT PanelInfo { |
| 133 PanelInfo() : window(NULL), callout_widget(NULL), slide_in(false) {} | 133 PanelInfo() : window(NULL), callout_widget(NULL), slide_in(false) {} |
| 134 | 134 |
| 135 bool operator==(const WmWindow* other_window) const { | 135 bool operator==(const aura::Window* other_window) const { |
| 136 return window == other_window; | 136 return window == other_window; |
| 137 } | 137 } |
| 138 | 138 |
| 139 // Returns |callout_widget| as a widget. Used by tests. | 139 // Returns |callout_widget| as a widget. Used by tests. |
| 140 views::Widget* CalloutWidget(); | 140 views::Widget* CalloutWidget(); |
| 141 | 141 |
| 142 // A weak pointer to the panel window. | 142 // A weak pointer to the panel window. |
| 143 WmWindow* window; | 143 aura::Window* window; |
| 144 | 144 |
| 145 // The callout widget for this panel. This pointer must be managed | 145 // The callout widget for this panel. This pointer must be managed |
| 146 // manually as this structure is used in a std::list. See | 146 // manually as this structure is used in a std::list. See |
| 147 // http://www.chromium.org/developers/smart-pointer-guidelines | 147 // http://www.chromium.org/developers/smart-pointer-guidelines |
| 148 PanelCalloutWidget* callout_widget; | 148 PanelCalloutWidget* callout_widget; |
| 149 | 149 |
| 150 // True on new and restored panel windows until the panel has been | 150 // True on new and restored panel windows until the panel has been |
| 151 // positioned. The first time Relayout is called the panel will be shown, | 151 // positioned. The first time Relayout is called the panel will be shown, |
| 152 // and slide into position and this will be set to false. | 152 // and slide into position and this will be set to false. |
| 153 bool slide_in; | 153 bool slide_in; |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 typedef std::list<PanelInfo> PanelList; | 156 typedef std::list<PanelInfo> PanelList; |
| 157 | 157 |
| 158 void MinimizePanel(aura::Window* panel); | 158 void MinimizePanel(aura::Window* panel); |
| 159 void RestorePanel(aura::Window* panel); | 159 void RestorePanel(aura::Window* panel); |
| 160 | 160 |
| 161 // Called whenever the panel layout might change. | 161 // Called whenever the panel layout might change. |
| 162 void Relayout(); | 162 void Relayout(); |
| 163 | 163 |
| 164 // Called whenever the panel stacking order needs to be updated (e.g. focus | 164 // Called whenever the panel stacking order needs to be updated (e.g. focus |
| 165 // changes or a panel is moved). | 165 // changes or a panel is moved). |
| 166 void UpdateStacking(WmWindow* active_panel); | 166 void UpdateStacking(aura::Window* active_panel); |
| 167 | 167 |
| 168 // Update the callout arrows for all managed panels. | 168 // Update the callout arrows for all managed panels. |
| 169 void UpdateCallouts(); | 169 void UpdateCallouts(); |
| 170 | 170 |
| 171 // Overridden from keyboard::KeyboardControllerObserver: | 171 // Overridden from keyboard::KeyboardControllerObserver: |
| 172 void OnKeyboardBoundsChanging(const gfx::Rect& keyboard_bounds) override; | 172 void OnKeyboardBoundsChanging(const gfx::Rect& keyboard_bounds) override; |
| 173 void OnKeyboardClosed() override; | 173 void OnKeyboardClosed() override; |
| 174 | 174 |
| 175 // Parent window associated with this layout manager. | 175 // Parent window associated with this layout manager. |
| 176 WmWindow* panel_container_; | 176 aura::Window* panel_container_; |
| 177 | 177 |
| 178 RootWindowController* root_window_controller_; | 178 RootWindowController* root_window_controller_; |
| 179 | 179 |
| 180 // Protect against recursive calls to OnWindowAddedToLayout(). | 180 // Protect against recursive calls to OnWindowAddedToLayout(). |
| 181 bool in_add_window_; | 181 bool in_add_window_; |
| 182 // Protect against recursive calls to Relayout(). | 182 // Protect against recursive calls to Relayout(). |
| 183 bool in_layout_; | 183 bool in_layout_; |
| 184 // Indicates if the panel callout widget should be created. | 184 // Indicates if the panel callout widget should be created. |
| 185 bool show_callout_widgets_; | 185 bool show_callout_widgets_; |
| 186 // Ordered list of unowned pointers to panel windows. | 186 // Ordered list of unowned pointers to panel windows. |
| 187 PanelList panel_windows_; | 187 PanelList panel_windows_; |
| 188 // The panel being dragged. | 188 // The panel being dragged. |
| 189 WmWindow* dragged_panel_; | 189 aura::Window* dragged_panel_; |
| 190 // The shelf we are observing for shelf icon changes. | 190 // The shelf we are observing for shelf icon changes. |
| 191 WmShelf* shelf_; | 191 WmShelf* shelf_; |
| 192 | 192 |
| 193 // When not NULL, the shelf is hidden (i.e. full screen) and this tracks the | 193 // When not NULL, the shelf is hidden (i.e. full screen) and this tracks the |
| 194 // set of panel windows which have been temporarily hidden and need to be | 194 // set of panel windows which have been temporarily hidden and need to be |
| 195 // restored when the shelf becomes visible again. | 195 // restored when the shelf becomes visible again. |
| 196 std::unique_ptr<aura::WindowTracker> restore_windows_on_shelf_visible_; | 196 std::unique_ptr<aura::WindowTracker> restore_windows_on_shelf_visible_; |
| 197 | 197 |
| 198 // The last active panel. Used to maintain stacking order even if no panels | 198 // The last active panel. Used to maintain stacking order even if no panels |
| 199 // are currently focused. | 199 // are currently focused. |
| 200 WmWindow* last_active_panel_; | 200 aura::Window* last_active_panel_; |
| 201 | 201 |
| 202 ScopedObserver<keyboard::KeyboardController, | 202 ScopedObserver<keyboard::KeyboardController, |
| 203 keyboard::KeyboardControllerObserver> | 203 keyboard::KeyboardControllerObserver> |
| 204 keyboard_observer_; | 204 keyboard_observer_; |
| 205 | 205 |
| 206 base::WeakPtrFactory<PanelLayoutManager> weak_factory_; | 206 base::WeakPtrFactory<PanelLayoutManager> weak_factory_; |
| 207 | 207 |
| 208 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); | 208 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 } // namespace ash | 211 } // namespace ash |
| 212 | 212 |
| 213 #endif // ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ | 213 #endif // ASH_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ |
| OLD | NEW |