| 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 10 matching lines...) Expand all Loading... |
| 21 #include "ui/keyboard/keyboard_controller_observer.h" | 21 #include "ui/keyboard/keyboard_controller_observer.h" |
| 22 #include "ui/wm/public/activation_change_observer.h" | 22 #include "ui/wm/public/activation_change_observer.h" |
| 23 | 23 |
| 24 namespace keyboard { | 24 namespace keyboard { |
| 25 class KeyboardController; | 25 class KeyboardController; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace ash { | 28 namespace ash { |
| 29 | 29 |
| 30 class RootWindowController; | 30 class RootWindowController; |
| 31 class WorkspaceLayoutManagerBackdropDelegate; | 31 class BackdropDelegate; |
| 32 class BackdropController; |
| 33 |
| 34 namespace test { |
| 35 class WorkspaceControllerTestApi; |
| 36 } |
| 32 | 37 |
| 33 namespace wm { | 38 namespace wm { |
| 34 class WMEvent; | 39 class WMEvent; |
| 35 } | 40 } |
| 36 | 41 |
| 37 // LayoutManager used on the window created for a workspace. | 42 // LayoutManager used on the window created for a workspace. |
| 38 class ASH_EXPORT WorkspaceLayoutManager | 43 class ASH_EXPORT WorkspaceLayoutManager |
| 39 : public aura::LayoutManager, | 44 : public aura::LayoutManager, |
| 40 public aura::WindowObserver, | 45 public aura::WindowObserver, |
| 41 public aura::client::ActivationChangeObserver, | 46 public aura::client::ActivationChangeObserver, |
| 42 public keyboard::KeyboardControllerObserver, | 47 public keyboard::KeyboardControllerObserver, |
| 43 public display::DisplayObserver, | 48 public display::DisplayObserver, |
| 44 public ShellObserver, | 49 public ShellObserver, |
| 45 public wm::WindowStateObserver { | 50 public wm::WindowStateObserver { |
| 46 public: | 51 public: |
| 47 // |window| is the container for this layout manager. | 52 // |window| is the container for this layout manager. |
| 48 explicit WorkspaceLayoutManager(aura::Window* window); | 53 explicit WorkspaceLayoutManager(aura::Window* window); |
| 49 ~WorkspaceLayoutManager() override; | 54 ~WorkspaceLayoutManager() override; |
| 50 | 55 |
| 51 // A delegate which can be set to add a backdrop behind the top most visible | 56 // A delegate which can be set to add a backdrop behind the top most visible |
| 52 // window. With the call the ownership of the delegate will be transferred to | 57 // window. With the call the ownership of the delegate will be transferred to |
| 53 // the WorkspaceLayoutManager. | 58 // the WorkspaceLayoutManager. |
| 54 void SetMaximizeBackdropDelegate( | 59 void SetBackdropDelegate(std::unique_ptr<BackdropDelegate> delegate); |
| 55 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate); | |
| 56 | 60 |
| 57 // Overridden from aura::LayoutManager: | 61 // Overridden from aura::LayoutManager: |
| 58 void OnWindowResized() override; | 62 void OnWindowResized() override; |
| 59 void OnWindowAddedToLayout(aura::Window* child) override; | 63 void OnWindowAddedToLayout(aura::Window* child) override; |
| 60 void OnWillRemoveWindowFromLayout(aura::Window* child) override; | 64 void OnWillRemoveWindowFromLayout(aura::Window* child) override; |
| 61 void OnWindowRemovedFromLayout(aura::Window* child) override; | 65 void OnWindowRemovedFromLayout(aura::Window* child) override; |
| 62 void OnChildWindowVisibilityChanged(aura::Window* child, | 66 void OnChildWindowVisibilityChanged(aura::Window* child, |
| 63 bool visible) override; | 67 bool visible) override; |
| 64 void SetChildBounds(aura::Window* child, | 68 void SetChildBounds(aura::Window* child, |
| 65 const gfx::Rect& requested_bounds) override; | 69 const gfx::Rect& requested_bounds) override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 93 uint32_t changed_metrics) override; | 97 uint32_t changed_metrics) override; |
| 94 | 98 |
| 95 // ShellObserver overrides: | 99 // ShellObserver overrides: |
| 96 void OnFullscreenStateChanged(bool is_fullscreen, | 100 void OnFullscreenStateChanged(bool is_fullscreen, |
| 97 WmWindow* root_window) override; | 101 WmWindow* root_window) override; |
| 98 void OnPinnedStateChanged(WmWindow* pinned_window) override; | 102 void OnPinnedStateChanged(WmWindow* pinned_window) override; |
| 99 void OnVirtualKeyboardStateChanged(bool activated, | 103 void OnVirtualKeyboardStateChanged(bool activated, |
| 100 aura::Window* root_window) override; | 104 aura::Window* root_window) override; |
| 101 | 105 |
| 102 private: | 106 private: |
| 107 friend class test::WorkspaceControllerTestApi; |
| 103 typedef std::set<aura::Window*> WindowSet; | 108 typedef std::set<aura::Window*> WindowSet; |
| 104 | 109 |
| 105 // Adjusts the bounds of all managed windows when the display area changes. | 110 // Adjusts the bounds of all managed windows when the display area changes. |
| 106 // This happens when the display size, work area insets has changed. | 111 // This happens when the display size, work area insets has changed. |
| 107 // If this is called for a display size change (i.e. |event| | 112 // If this is called for a display size change (i.e. |event| |
| 108 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen | 113 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen |
| 109 // windows are readjusted to make sure the window is completely within the | 114 // windows are readjusted to make sure the window is completely within the |
| 110 // display region. Otherwise, it makes sure at least some parts of the window | 115 // display region. Otherwise, it makes sure at least some parts of the window |
| 111 // is on display. | 116 // is on display. |
| 112 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event); | 117 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 130 WindowSet windows_; | 135 WindowSet windows_; |
| 131 | 136 |
| 132 // The work area in the coordinates of |window_|. | 137 // The work area in the coordinates of |window_|. |
| 133 gfx::Rect work_area_in_parent_; | 138 gfx::Rect work_area_in_parent_; |
| 134 | 139 |
| 135 // True if this workspace is currently in fullscreen mode. | 140 // True if this workspace is currently in fullscreen mode. |
| 136 bool is_fullscreen_; | 141 bool is_fullscreen_; |
| 137 | 142 |
| 138 // A window which covers the full container and which gets inserted behind the | 143 // A window which covers the full container and which gets inserted behind the |
| 139 // topmost visible window. | 144 // topmost visible window. |
| 140 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_; | 145 std::unique_ptr<BackdropController> backdrop_controller_; |
| 141 | 146 |
| 142 ScopedObserver<keyboard::KeyboardController, | 147 ScopedObserver<keyboard::KeyboardController, |
| 143 keyboard::KeyboardControllerObserver> | 148 keyboard::KeyboardControllerObserver> |
| 144 keyboard_observer_; | 149 keyboard_observer_; |
| 145 | 150 |
| 146 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); | 151 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); |
| 147 }; | 152 }; |
| 148 | 153 |
| 149 } // namespace ash | 154 } // namespace ash |
| 150 | 155 |
| 151 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 156 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| OLD | NEW |