| 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_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| 6 #define ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 6 #define ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ash/common/shell_observer.h" | 12 #include "ash/common/shell_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_types.h" | 14 #include "ash/common/wm/wm_types.h" |
| 15 #include "ash/common/wm_activation_observer.h" | 15 #include "ash/common/wm_activation_observer.h" |
| 16 #include "ash/common/wm_layout_manager.h" | 16 #include "ash/common/wm_layout_manager.h" |
| 17 #include "ash/common/wm_root_window_controller_observer.h" | |
| 18 #include "ash/common/wm_window_observer.h" | 17 #include "ash/common/wm_window_observer.h" |
| 19 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "ui/display/display_observer.h" |
| 20 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 21 #include "ui/keyboard/keyboard_controller_observer.h" | 21 #include "ui/keyboard/keyboard_controller_observer.h" |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| 24 class WmShell; | 24 class WmShell; |
| 25 class WmRootWindowController; | 25 class WmRootWindowController; |
| 26 class WorkspaceLayoutManagerBackdropDelegate; | 26 class WorkspaceLayoutManagerBackdropDelegate; |
| 27 | 27 |
| 28 namespace wm { | 28 namespace wm { |
| 29 class WMEvent; | 29 class WMEvent; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // LayoutManager used on the window created for a workspace. | 32 // LayoutManager used on the window created for a workspace. |
| 33 class ASH_EXPORT WorkspaceLayoutManager | 33 class ASH_EXPORT WorkspaceLayoutManager |
| 34 : public WmLayoutManager, | 34 : public WmLayoutManager, |
| 35 public WmWindowObserver, | 35 public WmWindowObserver, |
| 36 public WmActivationObserver, | 36 public WmActivationObserver, |
| 37 public keyboard::KeyboardControllerObserver, | 37 public keyboard::KeyboardControllerObserver, |
| 38 public WmRootWindowControllerObserver, | 38 public display::DisplayObserver, |
| 39 public ShellObserver, | 39 public ShellObserver, |
| 40 public wm::WindowStateObserver { | 40 public wm::WindowStateObserver { |
| 41 public: | 41 public: |
| 42 // |window| is the container for this layout manager. | 42 // |window| is the container for this layout manager. |
| 43 explicit WorkspaceLayoutManager(WmWindow* window); | 43 explicit WorkspaceLayoutManager(WmWindow* window); |
| 44 ~WorkspaceLayoutManager() override; | 44 ~WorkspaceLayoutManager() override; |
| 45 | 45 |
| 46 // A delegate which can be set to add a backdrop behind the top most visible | 46 // A delegate which can be set to add a backdrop behind the top most visible |
| 47 // window. With the call the ownership of the delegate will be transferred to | 47 // window. With the call the ownership of the delegate will be transferred to |
| 48 // the WorkspaceLayoutManager. | 48 // the WorkspaceLayoutManager. |
| 49 void SetMaximizeBackdropDelegate( | 49 void SetMaximizeBackdropDelegate( |
| 50 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate); | 50 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate); |
| 51 | 51 |
| 52 // Overridden from WmLayoutManager: | 52 // Overridden from WmLayoutManager: |
| 53 void OnWindowResized() override; | 53 void OnWindowResized() override; |
| 54 void OnWindowAddedToLayout(WmWindow* child) override; | 54 void OnWindowAddedToLayout(WmWindow* child) override; |
| 55 void OnWillRemoveWindowFromLayout(WmWindow* child) override; | 55 void OnWillRemoveWindowFromLayout(WmWindow* child) override; |
| 56 void OnWindowRemovedFromLayout(WmWindow* child) override; | 56 void OnWindowRemovedFromLayout(WmWindow* child) override; |
| 57 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override; | 57 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override; |
| 58 void SetChildBounds(WmWindow* child, | 58 void SetChildBounds(WmWindow* child, |
| 59 const gfx::Rect& requested_bounds) override; | 59 const gfx::Rect& requested_bounds) override; |
| 60 | 60 |
| 61 // WmRootWindowControllerObserver overrides: | |
| 62 void OnWorkAreaChanged() override; | |
| 63 | |
| 64 // Overriden from WmWindowObserver: | 61 // Overriden from WmWindowObserver: |
| 65 void OnWindowTreeChanged( | 62 void OnWindowTreeChanged( |
| 66 WmWindow* window, | 63 WmWindow* window, |
| 67 const WmWindowObserver::TreeChangeParams& params) override; | 64 const WmWindowObserver::TreeChangeParams& params) override; |
| 68 void OnWindowPropertyChanged(WmWindow* window, | 65 void OnWindowPropertyChanged(WmWindow* window, |
| 69 WmWindowProperty property) override; | 66 WmWindowProperty property) override; |
| 70 void OnWindowStackingChanged(WmWindow* window) override; | 67 void OnWindowStackingChanged(WmWindow* window) override; |
| 71 void OnWindowDestroying(WmWindow* window) override; | 68 void OnWindowDestroying(WmWindow* window) override; |
| 72 void OnWindowBoundsChanged(WmWindow* window, | 69 void OnWindowBoundsChanged(WmWindow* window, |
| 73 const gfx::Rect& old_bounds, | 70 const gfx::Rect& old_bounds, |
| 74 const gfx::Rect& new_bounds) override; | 71 const gfx::Rect& new_bounds) override; |
| 75 | 72 |
| 76 // WmActivationObserver overrides: | 73 // WmActivationObserver overrides: |
| 77 void OnWindowActivated(WmWindow* gained_active, | 74 void OnWindowActivated(WmWindow* gained_active, |
| 78 WmWindow* lost_active) override; | 75 WmWindow* lost_active) override; |
| 79 | 76 |
| 80 // keyboard::KeyboardControllerObserver overrides: | 77 // keyboard::KeyboardControllerObserver overrides: |
| 81 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | 78 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
| 82 | 79 |
| 83 // WindowStateObserver overrides: | 80 // WindowStateObserver overrides: |
| 84 void OnPostWindowStateTypeChange(wm::WindowState* window_state, | 81 void OnPostWindowStateTypeChange(wm::WindowState* window_state, |
| 85 wm::WindowStateType old_type) override; | 82 wm::WindowStateType old_type) override; |
| 86 | 83 |
| 84 // display::DisplayObserver overrides: |
| 85 void OnDisplayMetricsChanged(const display::Display& display, |
| 86 uint32_t changed_metrics) override; |
| 87 |
| 87 // ShellObserver overrides: | 88 // ShellObserver overrides: |
| 88 void OnFullscreenStateChanged(bool is_fullscreen, | 89 void OnFullscreenStateChanged(bool is_fullscreen, |
| 89 WmWindow* root_window) override; | 90 WmWindow* root_window) override; |
| 90 void OnPinnedStateChanged(WmWindow* pinned_window) override; | 91 void OnPinnedStateChanged(WmWindow* pinned_window) override; |
| 91 | 92 |
| 92 private: | 93 private: |
| 93 typedef std::set<WmWindow*> WindowSet; | 94 typedef std::set<WmWindow*> WindowSet; |
| 94 | 95 |
| 95 // Adjusts the bounds of all managed windows when the display area changes. | 96 // Adjusts the bounds of all managed windows when the display area changes. |
| 96 // This happens when the display size, work area insets has changed. | 97 // This happens when the display size, work area insets has changed. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // A window which covers the full container and which gets inserted behind the | 130 // A window which covers the full container and which gets inserted behind the |
| 130 // topmost visible window. | 131 // topmost visible window. |
| 131 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_; | 132 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_; |
| 132 | 133 |
| 133 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); | 134 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); |
| 134 }; | 135 }; |
| 135 | 136 |
| 136 } // namespace ash | 137 } // namespace ash |
| 137 | 138 |
| 138 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ | 139 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ |
| OLD | NEW |