| 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/wm_activation_observer.h" | 14 #include "ash/common/wm/wm_activation_observer.h" |
| 15 #include "ash/common/wm/wm_display_observer.h" | 15 #include "ash/common/wm/wm_display_observer.h" |
| 16 #include "ash/common/wm/wm_layout_manager.h" | 16 #include "ash/common/wm/wm_layout_manager.h" |
| 17 #include "ash/common/wm/wm_overview_mode_observer.h" | 17 #include "ash/common/wm/wm_overview_mode_observer.h" |
| 18 #include "ash/common/wm/wm_root_window_controller_observer.h" | 18 #include "ash/common/wm/wm_root_window_controller_observer.h" |
| 19 #include "ash/common/wm/wm_window_observer.h" | 19 #include "ash/common/wm/wm_window_observer.h" |
| 20 #include "ash/common/wm/wm_window_tracker.h" | 20 #include "ash/common/wm/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 wm::WmLayoutManager, | 59 : public wm::WmLayoutManager, |
| 60 public wm::WindowStateObserver, | 60 public wm::WindowStateObserver, |
| 61 public wm::WmActivationObserver, | 61 public wm::WmActivationObserver, |
| 62 public wm::WmDisplayObserver, | 62 public wm::WmDisplayObserver, |
| 63 public wm::WmOverviewModeObserver, | 63 public wm::WmOverviewModeObserver, |
| 64 public wm::WmRootWindowControllerObserver, | 64 public wm::WmRootWindowControllerObserver, |
| 65 public wm::WmWindowObserver, | 65 public wm::WmWindowObserver, |
| 66 public keyboard::KeyboardControllerObserver, | 66 public keyboard::KeyboardControllerObserver, |
| 67 public wm::WmShelfObserver { | 67 public WmShelfObserver { |
| 68 public: | 68 public: |
| 69 explicit PanelLayoutManager(wm::WmWindow* panel_container); | 69 explicit PanelLayoutManager(wm::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(wm::WmWindow* window); | 74 static PanelLayoutManager* Get(wm::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(wm::WmWindow* panel); | 79 void StartDragging(wm::WmWindow* panel); |
| 80 void FinishDragging(); | 80 void FinishDragging(); |
| 81 | 81 |
| 82 void ToggleMinimize(wm::WmWindow* panel); | 82 void ToggleMinimize(wm::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(wm::WmWindow* panel); | 88 views::Widget* GetCalloutWidgetForPanel(wm::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 wm::WmLayoutManager | 93 // Overridden from wm::WmLayoutManager |
| 94 void OnWindowResized() override; | 94 void OnWindowResized() override; |
| 95 void OnWindowAddedToLayout(wm::WmWindow* child) override; | 95 void OnWindowAddedToLayout(wm::WmWindow* child) override; |
| 96 void OnWillRemoveWindowFromLayout(wm::WmWindow* child) override; | 96 void OnWillRemoveWindowFromLayout(wm::WmWindow* child) override; |
| 97 void OnWindowRemovedFromLayout(wm::WmWindow* child) override; | 97 void OnWindowRemovedFromLayout(wm::WmWindow* child) override; |
| 98 void OnChildWindowVisibilityChanged(wm::WmWindow* child, | 98 void OnChildWindowVisibilityChanged(wm::WmWindow* child, |
| 99 bool visibile) override; | 99 bool visibile) override; |
| 100 void SetChildBounds(wm::WmWindow* child, | 100 void SetChildBounds(wm::WmWindow* child, |
| 101 const gfx::Rect& requested_bounds) override; | 101 const gfx::Rect& requested_bounds) override; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 114 void OnPostWindowStateTypeChange(wm::WindowState* window_state, | 114 void OnPostWindowStateTypeChange(wm::WindowState* window_state, |
| 115 wm::WindowStateType old_type) override; | 115 wm::WindowStateType old_type) override; |
| 116 | 116 |
| 117 // Overridden from wm::WmActivationObserver | 117 // Overridden from wm::WmActivationObserver |
| 118 void OnWindowActivated(wm::WmWindow* gained_active, | 118 void OnWindowActivated(wm::WmWindow* gained_active, |
| 119 wm::WmWindow* lost_active) override; | 119 wm::WmWindow* lost_active) override; |
| 120 | 120 |
| 121 // Overridden from WindowTreeHostManager::Observer | 121 // Overridden from WindowTreeHostManager::Observer |
| 122 void OnDisplayConfigurationChanged() override; | 122 void OnDisplayConfigurationChanged() override; |
| 123 | 123 |
| 124 // Overridden from wm::WmShelfObserver | 124 // Overridden from WmShelfObserver |
| 125 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; | 125 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; |
| 126 void OnShelfIconPositionsChanged() override; | 126 void OnShelfIconPositionsChanged() override; |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 friend class PanelLayoutManagerTest; | 129 friend class PanelLayoutManagerTest; |
| 130 friend class PanelWindowResizerTest; | 130 friend class PanelWindowResizerTest; |
| 131 friend class DockedWindowResizerTest; | 131 friend class DockedWindowResizerTest; |
| 132 friend class DockedWindowLayoutManagerTest; | 132 friend class DockedWindowLayoutManagerTest; |
| 133 friend class WorkspaceControllerTest; | 133 friend class WorkspaceControllerTest; |
| 134 friend class AcceleratorControllerTest; | 134 friend class AcceleratorControllerTest; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 bool in_add_window_; | 186 bool in_add_window_; |
| 187 // Protect against recursive calls to Relayout(). | 187 // Protect against recursive calls to Relayout(). |
| 188 bool in_layout_; | 188 bool in_layout_; |
| 189 // Indicates if the panel callout widget should be created. | 189 // Indicates if the panel callout widget should be created. |
| 190 bool show_callout_widgets_; | 190 bool show_callout_widgets_; |
| 191 // Ordered list of unowned pointers to panel windows. | 191 // Ordered list of unowned pointers to panel windows. |
| 192 PanelList panel_windows_; | 192 PanelList panel_windows_; |
| 193 // The panel being dragged. | 193 // The panel being dragged. |
| 194 wm::WmWindow* dragged_panel_; | 194 wm::WmWindow* dragged_panel_; |
| 195 // The shelf we are observing for shelf icon changes. | 195 // The shelf we are observing for shelf icon changes. |
| 196 wm::WmShelf* shelf_; | 196 WmShelf* shelf_; |
| 197 | 197 |
| 198 // When not NULL, the shelf is hidden (i.e. full screen) and this tracks the | 198 // When not NULL, the shelf is hidden (i.e. full screen) and this tracks the |
| 199 // set of panel windows which have been temporarily hidden and need to be | 199 // set of panel windows which have been temporarily hidden and need to be |
| 200 // restored when the shelf becomes visible again. | 200 // restored when the shelf becomes visible again. |
| 201 std::unique_ptr<wm::WmWindowTracker> restore_windows_on_shelf_visible_; | 201 std::unique_ptr<wm::WmWindowTracker> restore_windows_on_shelf_visible_; |
| 202 | 202 |
| 203 // The last active panel. Used to maintain stacking order even if no panels | 203 // The last active panel. Used to maintain stacking order even if no panels |
| 204 // are currently focused. | 204 // are currently focused. |
| 205 wm::WmWindow* last_active_panel_; | 205 wm::WmWindow* last_active_panel_; |
| 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_COMMON_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ | 213 #endif // ASH_COMMON_WM_PANELS_PANEL_LAYOUT_MANAGER_H_ |
| OLD | NEW |