Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Side by Side Diff: ash/common/wm/workspace/workspace_layout_manager.h

Issue 2035543004: Shuffles and renames ash/common/wm classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: random changes for chrome tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/wm/window_state_observer.h" 12 #include "ash/common/wm/window_state_observer.h"
13 #include "ash/common/wm/wm_activation_observer.h"
14 #include "ash/common/wm/wm_layout_manager.h"
15 #include "ash/common/wm/wm_root_window_controller_observer.h"
16 #include "ash/common/wm/wm_types.h" 13 #include "ash/common/wm/wm_types.h"
17 #include "ash/common/wm/wm_window_observer.h" 14 #include "ash/common/wm_activation_observer.h"
15 #include "ash/common/wm_layout_manager.h"
16 #include "ash/common/wm_root_window_controller_observer.h"
17 #include "ash/common/wm_window_observer.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
20 #include "ui/keyboard/keyboard_controller_observer.h" 20 #include "ui/keyboard/keyboard_controller_observer.h"
21 21
22 namespace ash { 22 namespace ash {
23 class WmShell;
24 class WmRootWindowController;
23 class WorkspaceLayoutManagerBackdropDelegate; 25 class WorkspaceLayoutManagerBackdropDelegate;
24 26
25 namespace wm { 27 namespace wm {
26 class WmGlobals;
27 class WmRootWindowController;
28 class WorkspaceLayoutManagerDelegate; 28 class WorkspaceLayoutManagerDelegate;
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 wm::WmLayoutManager, 34 : public WmLayoutManager,
35 public wm::WmWindowObserver, 35 public WmWindowObserver,
36 public wm::WmActivationObserver, 36 public WmActivationObserver,
37 public keyboard::KeyboardControllerObserver, 37 public keyboard::KeyboardControllerObserver,
38 public wm::WmRootWindowControllerObserver, 38 public WmRootWindowControllerObserver,
39 public wm::WindowStateObserver { 39 public wm::WindowStateObserver {
40 public: 40 public:
41 WorkspaceLayoutManager( 41 WorkspaceLayoutManager(
42 wm::WmWindow* window, 42 WmWindow* window,
43 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate); 43 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate);
44 44
45 ~WorkspaceLayoutManager() override; 45 ~WorkspaceLayoutManager() override;
46 46
47 void DeleteDelegate(); 47 void DeleteDelegate();
48 48
49 // A delegate which can be set to add a backdrop behind the top most visible 49 // A delegate which can be set to add a backdrop behind the top most visible
50 // window. With the call the ownership of the delegate will be transferred to 50 // window. With the call the ownership of the delegate will be transferred to
51 // the WorkspaceLayoutManager. 51 // the WorkspaceLayoutManager.
52 void SetMaximizeBackdropDelegate( 52 void SetMaximizeBackdropDelegate(
53 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate); 53 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate);
54 54
55 // Overridden from wm::WmLayoutManager: 55 // Overridden from WmLayoutManager:
56 void OnWindowResized() override; 56 void OnWindowResized() override;
57 void OnWindowAddedToLayout(wm::WmWindow* child) override; 57 void OnWindowAddedToLayout(WmWindow* child) override;
58 void OnWillRemoveWindowFromLayout(wm::WmWindow* child) override; 58 void OnWillRemoveWindowFromLayout(WmWindow* child) override;
59 void OnWindowRemovedFromLayout(wm::WmWindow* child) override; 59 void OnWindowRemovedFromLayout(WmWindow* child) override;
60 void OnChildWindowVisibilityChanged(wm::WmWindow* child, 60 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override;
61 bool visibile) override; 61 void SetChildBounds(WmWindow* child,
62 void SetChildBounds(wm::WmWindow* child,
63 const gfx::Rect& requested_bounds) override; 62 const gfx::Rect& requested_bounds) override;
64 63
65 // wm::WmRootWindowControllerObserver overrides: 64 // WmRootWindowControllerObserver overrides:
66 void OnWorkAreaChanged() override; 65 void OnWorkAreaChanged() override;
67 void OnFullscreenStateChanged(bool is_fullscreen) override; 66 void OnFullscreenStateChanged(bool is_fullscreen) override;
68 67
69 // Overriden from wm::WmWindowObserver: 68 // Overriden from WmWindowObserver:
70 void OnWindowTreeChanged( 69 void OnWindowTreeChanged(
71 wm::WmWindow* window, 70 WmWindow* window,
72 const wm::WmWindowObserver::TreeChangeParams& params) override; 71 const WmWindowObserver::TreeChangeParams& params) override;
73 void OnWindowPropertyChanged(wm::WmWindow* window, 72 void OnWindowPropertyChanged(WmWindow* window,
74 wm::WmWindowProperty property) override; 73 WmWindowProperty property) override;
75 void OnWindowStackingChanged(wm::WmWindow* window) override; 74 void OnWindowStackingChanged(WmWindow* window) override;
76 void OnWindowDestroying(wm::WmWindow* window) override; 75 void OnWindowDestroying(WmWindow* window) override;
77 void OnWindowBoundsChanged(wm::WmWindow* window, 76 void OnWindowBoundsChanged(WmWindow* window,
78 const gfx::Rect& old_bounds, 77 const gfx::Rect& old_bounds,
79 const gfx::Rect& new_bounds) override; 78 const gfx::Rect& new_bounds) override;
80 79
81 // wm::WmActivationObserver overrides: 80 // WmActivationObserver overrides:
82 void OnWindowActivated(wm::WmWindow* gained_active, 81 void OnWindowActivated(WmWindow* gained_active,
83 wm::WmWindow* lost_active) override; 82 WmWindow* lost_active) override;
84 83
85 // keyboard::KeyboardControllerObserver overrides: 84 // keyboard::KeyboardControllerObserver overrides:
86 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; 85 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
87 86
88 // WindowStateObserver overrides: 87 // WindowStateObserver overrides:
89 void OnPostWindowStateTypeChange(wm::WindowState* window_state, 88 void OnPostWindowStateTypeChange(wm::WindowState* window_state,
90 wm::WindowStateType old_type) override; 89 wm::WindowStateType old_type) override;
91 90
92 private: 91 private:
93 typedef std::set<wm::WmWindow*> WindowSet; 92 typedef std::set<WmWindow*> WindowSet;
94 93
95 // Adjusts the bounds of all managed windows when the display area changes. 94 // Adjusts the bounds of all managed windows when the display area changes.
96 // This happens when the display size, work area insets has changed. 95 // This happens when the display size, work area insets has changed.
97 // If this is called for a display size change (i.e. |event| 96 // If this is called for a display size change (i.e. |event|
98 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen 97 // is DISPLAY_RESIZED), the non-maximized/non-fullscreen
99 // windows are readjusted to make sure the window is completely within the 98 // windows are readjusted to make sure the window is completely within the
100 // display region. Otherwise, it makes sure at least some parts of the window 99 // display region. Otherwise, it makes sure at least some parts of the window
101 // is on display. 100 // is on display.
102 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event); 101 void AdjustAllWindowsBoundsForWorkAreaChange(const wm::WMEvent* event);
103 102
104 // Updates the visibility state of the shelf. 103 // Updates the visibility state of the shelf.
105 void UpdateShelfVisibility(); 104 void UpdateShelfVisibility();
106 105
107 // Updates the fullscreen state of the workspace and notifies Shell if it 106 // Updates the fullscreen state of the workspace and notifies Shell if it
108 // has changed. 107 // has changed.
109 void UpdateFullscreenState(); 108 void UpdateFullscreenState();
110 109
111 // Updates the bounds of the window for a stte type change from 110 // Updates the bounds of the window for a stte type change from
112 // |old_show_type|. 111 // |old_show_type|.
113 void UpdateBoundsFromStateType(wm::WindowState* window_state, 112 void UpdateBoundsFromStateType(wm::WindowState* window_state,
114 wm::WindowStateType old_state_type); 113 wm::WindowStateType old_state_type);
115 114
116 // If |window_state| is maximized or fullscreen the bounds of the 115 // If |window_state| is maximized or fullscreen the bounds of the
117 // window are set and true is returned. Does nothing otherwise. 116 // window are set and true is returned. Does nothing otherwise.
118 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state); 117 bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state);
119 118
120 // Animates the window bounds to |bounds|. 119 // Animates the window bounds to |bounds|.
121 void SetChildBoundsAnimated(wm::WmWindow* child, const gfx::Rect& bounds); 120 void SetChildBoundsAnimated(WmWindow* child, const gfx::Rect& bounds);
122 121
123 wm::WmWindow* window_; 122 WmWindow* window_;
124 wm::WmWindow* root_window_; 123 WmWindow* root_window_;
125 wm::WmRootWindowController* root_window_controller_; 124 WmRootWindowController* root_window_controller_;
126 wm::WmGlobals* globals_; 125 WmShell* shell_;
127 126
128 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate_; 127 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate_;
129 128
130 // Set of windows we're listening to. 129 // Set of windows we're listening to.
131 WindowSet windows_; 130 WindowSet windows_;
132 131
133 // The work area in the coordinates of |window_|. 132 // The work area in the coordinates of |window_|.
134 gfx::Rect work_area_in_parent_; 133 gfx::Rect work_area_in_parent_;
135 134
136 // True if this workspace is currently in fullscreen mode. 135 // True if this workspace is currently in fullscreen mode.
137 bool is_fullscreen_; 136 bool is_fullscreen_;
138 137
139 // A window which covers the full container and which gets inserted behind the 138 // A window which covers the full container and which gets inserted behind the
140 // topmost visible window. 139 // topmost visible window.
141 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_; 140 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> backdrop_delegate_;
142 141
143 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager); 142 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager);
144 }; 143 };
145 144
146 } // namespace ash 145 } // namespace ash
147 146
148 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_ 147 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698