| 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 RootWindowController; |
| 34 class WorkspaceLayoutManagerDelegate; | 34 class WorkspaceLayoutManagerDelegate; |
| 35 | 35 |
| 36 namespace wm { | 36 namespace wm { |
| 37 class WindowState; | 37 class WindowState; |
| 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 explicit WorkspaceLayoutManager(aura::Window* window); |
| 51 ~WorkspaceLayoutManager() override; | 51 ~WorkspaceLayoutManager() override; |
| 52 | 52 |
| 53 void SetShelf(ShelfLayoutManager* shelf); | |
| 54 | |
| 55 // A delegate which can be set to add a backdrop behind the top most visible | 53 // 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 | 54 // window. With the call the ownership of the delegate will be transferred to |
| 57 // the WorkspaceLayoutManager. | 55 // the WorkspaceLayoutManager. |
| 58 void SetMaximizeBackdropDelegate( | 56 void SetMaximizeBackdropDelegate( |
| 59 std::unique_ptr<WorkspaceLayoutManagerDelegate> delegate); | 57 std::unique_ptr<WorkspaceLayoutManagerDelegate> delegate); |
| 60 | 58 |
| 61 // Overridden from aura::LayoutManager: | 59 // Overridden from aura::LayoutManager: |
| 62 void OnWindowResized() override {} | 60 void OnWindowResized() override {} |
| 63 void OnWindowAddedToLayout(aura::Window* child) override; | 61 void OnWindowAddedToLayout(aura::Window* child) override; |
| 64 void OnWillRemoveWindowFromLayout(aura::Window* child) override; | 62 void OnWillRemoveWindowFromLayout(aura::Window* child) override; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 101 |
| 104 // Adjusts the bounds of all managed windows when the display area changes. | 102 // Adjusts the bounds of all managed windows when the display area changes. |
| 105 // This happens when the display size, work area insets has changed. | 103 // This happens when the display size, work area insets has changed. |
| 106 // If this is called for a display size change (i.e. |event| | 104 // If this is called for a display size change (i.e. |event| |
| 107 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen | 105 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen |
| 108 // windows are readjusted to make sure the window is completely within the | 106 // windows are readjusted to make sure the window is completely within the |
| 109 // display region. Otherwise, it makes sure at least some parts of the window | 107 // display region. Otherwise, it makes sure at least some parts of the window |
| 110 // is on display. | 108 // is on display. |
| 111 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event); | 109 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event); |
| 112 | 110 |
| 113 // Updates the visibility state of the shelf. | |
| 114 void UpdateShelfVisibility(); | |
| 115 | |
| 116 // Updates the fullscreen state of the workspace and notifies Shell if it | 111 // Updates the fullscreen state of the workspace and notifies Shell if it |
| 117 // has changed. | 112 // has changed. |
| 118 void UpdateFullscreenState(); | 113 void UpdateFullscreenState(); |
| 119 | 114 |
| 120 // Updates the bounds of the window for a stte type change from | 115 // Updates the bounds of the window for a stte type change from |
| 121 // |old_show_type|. | 116 // |old_show_type|. |
| 122 void UpdateBoundsFromStateType(wm::WindowState* window_state, | 117 void UpdateBoundsFromStateType(wm::WindowState* window_state, |
| 123 wm::WindowStateType old_state_type); | 118 wm::WindowStateType old_state_type); |
| 124 | 119 |
| 125 // If |window_state| is maximized or fullscreen the bounds of the | 120 // If |window_state| is maximized or fullscreen the bounds of the |
| 126 // window are set and true is returned. Does nothing otherwise. | 121 // window are set and true is returned. Does nothing otherwise. |
| 127 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state); | 122 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state); |
| 128 | 123 |
| 129 // Animates the window bounds to |bounds|. | 124 // Animates the window bounds to |bounds|. |
| 130 void SetChildBoundsAnimated(aura::Window* child, const gfx::Rect& bounds); | 125 void SetChildBoundsAnimated(aura::Window* child, const gfx::Rect& bounds); |
| 131 | 126 |
| 132 ShelfLayoutManager* shelf_; | |
| 133 aura::Window* window_; | 127 aura::Window* window_; |
| 134 aura::Window* root_window_; | 128 aura::Window* root_window_; |
| 129 RootWindowController* root_window_controller_; |
| 135 | 130 |
| 136 // Set of windows we're listening to. | 131 // Set of windows we're listening to. |
| 137 WindowSet windows_; | 132 WindowSet windows_; |
| 138 | 133 |
| 139 // The work area in the coordinates of |window_|. | 134 // The work area in the coordinates of |window_|. |
| 140 gfx::Rect work_area_in_parent_; | 135 gfx::Rect work_area_in_parent_; |
| 141 | 136 |
| 142 // True if this workspace is currently in fullscreen mode. | 137 // True if this workspace is currently in fullscreen mode. |
| 143 bool is_fullscreen_; | 138 bool is_fullscreen_; |
| 144 | 139 |
| 145 // A window which covers the full container and which gets inserted behind the | 140 // A window which covers the full container and which gets inserted behind the |
| 146 // topmost visible window. | 141 // topmost visible window. |
| 147 std::unique_ptr<WorkspaceLayoutManagerDelegate> backdrop_delegate_; | 142 std::unique_ptr<WorkspaceLayoutManagerDelegate> backdrop_delegate_; |
| 148 | 143 |
| 149 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); | 144 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); |
| 150 }; | 145 }; |
| 151 | 146 |
| 152 } // namespace ash | 147 } // namespace ash |
| 153 | 148 |
| 154 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 149 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| OLD | NEW |