| 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_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| 6 #define ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace aura { | 23 namespace aura { |
| 24 class RootWindow; | 24 class RootWindow; |
| 25 class Window; | 25 class Window; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace ui { | 28 namespace ui { |
| 29 class Layer; | 29 class Layer; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace ash { | 32 namespace ash { |
| 33 class ShelfLayoutManager; | 33 class WorkspaceLayoutManagerBackdropDelegate; |
| 34 class WorkspaceLayoutManagerDelegate; | |
| 35 | 34 |
| 36 namespace wm { | 35 namespace wm { |
| 37 class WindowState; | 36 class WindowState; |
| 37 class WorkspaceLayoutManagerDelegate; |
| 38 class WMEvent; | 38 class WMEvent; |
| 39 } | 39 } |
| 40 | 40 |
| 41 // LayoutManager used on the window created for a workspace. | 41 // LayoutManager used on the window created for a workspace. |
| 42 class ASH_EXPORT WorkspaceLayoutManager | 42 class ASH_EXPORT WorkspaceLayoutManager |
| 43 : public aura::LayoutManager, | 43 : public aura::LayoutManager, |
| 44 public aura::WindowObserver, | 44 public aura::WindowObserver, |
| 45 public aura::client::ActivationChangeObserver, | 45 public aura::client::ActivationChangeObserver, |
| 46 public keyboard::KeyboardControllerObserver, | 46 public keyboard::KeyboardControllerObserver, |
| 47 public ShellObserver, | 47 public ShellObserver, |
| 48 public wm::WindowStateObserver { | 48 public wm::WindowStateObserver { |
| 49 public: | 49 public: |
| 50 explicit WorkspaceLayoutManager(aura::Window* window); | 50 WorkspaceLayoutManager( |
| 51 aura::Window* window, |
| 52 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate); |
| 53 |
| 51 ~WorkspaceLayoutManager() override; | 54 ~WorkspaceLayoutManager() override; |
| 52 | 55 |
| 53 void SetShelf(ShelfLayoutManager* shelf); | 56 void DeleteDelegate(); |
| 54 | 57 |
| 55 // A delegate which can be set to add a backdrop behind the top most visible | 58 // A delegate which can be set to add a backdrop behind the top most visible |
| 56 // window. With the call the ownership of the delegate will be transferred to | 59 // window. With the call the ownership of the delegate will be transferred to |
| 57 // the WorkspaceLayoutManager. | 60 // the WorkspaceLayoutManager. |
| 58 void SetMaximizeBackdropDelegate( | 61 void SetMaximizeBackdropDelegate( |
| 59 std::unique_ptr<WorkspaceLayoutManagerDelegate> delegate); | 62 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate); |
| 60 | 63 |
| 61 // Overridden from aura::LayoutManager: | 64 // Overridden from aura::LayoutManager: |
| 62 void OnWindowResized() override {} | 65 void OnWindowResized() override {} |
| 63 void OnWindowAddedToLayout(aura::Window* child) override; | 66 void OnWindowAddedToLayout(aura::Window* child) override; |
| 64 void OnWillRemoveWindowFromLayout(aura::Window* child) override; | 67 void OnWillRemoveWindowFromLayout(aura::Window* child) override; |
| 65 void OnWindowRemovedFromLayout(aura::Window* child) override; | 68 void OnWindowRemovedFromLayout(aura::Window* child) override; |
| 66 void OnChildWindowVisibilityChanged(aura::Window* child, | 69 void OnChildWindowVisibilityChanged(aura::Window* child, |
| 67 bool visibile) override; | 70 bool visibile) override; |
| 68 void SetChildBounds(aura::Window* child, | 71 void SetChildBounds(aura::Window* child, |
| 69 const gfx::Rect& requested_bounds) override; | 72 const gfx::Rect& requested_bounds) override; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void UpdateBoundsFromStateType(wm::WindowState* window_state, | 125 void UpdateBoundsFromStateType(wm::WindowState* window_state, |
| 123 wm::WindowStateType old_state_type); | 126 wm::WindowStateType old_state_type); |
| 124 | 127 |
| 125 // If |window_state| is maximized or fullscreen the bounds of the | 128 // If |window_state| is maximized or fullscreen the bounds of the |
| 126 // window are set and true is returned. Does nothing otherwise. | 129 // window are set and true is returned. Does nothing otherwise. |
| 127 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state); | 130 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state); |
| 128 | 131 |
| 129 // Animates the window bounds to |bounds|. | 132 // Animates the window bounds to |bounds|. |
| 130 void SetChildBoundsAnimated(aura::Window* child, const gfx::Rect& bounds); | 133 void SetChildBoundsAnimated(aura::Window* child, const gfx::Rect& bounds); |
| 131 | 134 |
| 132 ShelfLayoutManager* shelf_; | |
| 133 aura::Window* window_; | 135 aura::Window* window_; |
| 134 aura::Window* root_window_; | 136 aura::Window* root_window_; |
| 135 | 137 |
| 138 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate_; |
| 139 |
| 136 // Set of windows we're listening to. | 140 // Set of windows we're listening to. |
| 137 WindowSet windows_; | 141 WindowSet windows_; |
| 138 | 142 |
| 139 // The work area in the coordinates of |window_|. | 143 // The work area in the coordinates of |window_|. |
| 140 gfx::Rect work_area_in_parent_; | 144 gfx::Rect work_area_in_parent_; |
| 141 | 145 |
| 142 // True if this workspace is currently in fullscreen mode. | 146 // True if this workspace is currently in fullscreen mode. |
| 143 bool is_fullscreen_; | 147 bool is_fullscreen_; |
| 144 | 148 |
| 145 // A window which covers the full container and which gets inserted behind the | 149 // A window which covers the full container and which gets inserted behind the |
| 146 // topmost visible window. | 150 // topmost visible window. |
| 147 std::unique_ptr<WorkspaceLayoutManagerDelegate> backdrop_delegate_; | 151 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_; |
| 148 | 152 |
| 149 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); | 153 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); |
| 150 }; | 154 }; |
| 151 | 155 |
| 152 } // namespace ash | 156 } // namespace ash |
| 153 | 157 |
| 154 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 158 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| OLD | NEW |