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_ROOT_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_ROOT_WINDOW_CONTROLLER_H_ |
6 #define ASH_ROOT_WINDOW_CONTROLLER_H_ | 6 #define ASH_ROOT_WINDOW_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 namespace gfx { | 22 namespace gfx { |
23 class Point; | 23 class Point; |
24 } | 24 } |
25 | 25 |
26 namespace keyboard { | 26 namespace keyboard { |
27 class KeyboardController; | 27 class KeyboardController; |
28 } | 28 } |
29 | 29 |
30 namespace ui { | 30 namespace ui { |
31 class EventHandler; | 31 class EventHandler; |
32 class WindowTreeHost; | |
32 } | 33 } |
33 | 34 |
34 namespace views { | 35 namespace views { |
35 class Widget; | 36 class Widget; |
36 } | 37 } |
37 | 38 |
38 namespace wm { | 39 namespace wm { |
39 class ScopedCaptureClient; | 40 class ScopedCaptureClient; |
40 } | 41 } |
41 | 42 |
42 namespace ash { | 43 namespace ash { |
43 class AshTouchExplorationManager; | 44 class AshTouchExplorationManager; |
44 class AshWindowTreeHost; | 45 class AshWindowTreeHost; |
45 class BootSplashScreen; | 46 class BootSplashScreen; |
46 class DockedWindowLayoutManager; | 47 class DockedWindowLayoutManager; |
47 enum class LoginStatus; | 48 enum class LoginStatus; |
48 class PanelLayoutManager; | 49 class PanelLayoutManager; |
49 class ShelfLayoutManager; | 50 class ShelfLayoutManager; |
50 class StackingController; | 51 class StackingController; |
51 class StatusAreaWidget; | 52 class StatusAreaWidget; |
52 class SystemTray; | 53 class SystemTray; |
53 class SystemWallpaperController; | 54 class SystemWallpaperController; |
54 class TouchHudDebug; | 55 class TouchHudDebug; |
55 class TouchHudProjection; | 56 class TouchHudProjection; |
56 class WmRootWindowControllerAura; | 57 class WmRootWindowController; |
57 class WmShelf; | 58 class WmShelf; |
58 class WorkspaceController; | 59 class WorkspaceController; |
59 | 60 |
61 namespace mus { | |
62 class RootWindowController; | |
63 } | |
64 | |
60 // This class maintains the per root window state for ash. This class | 65 // This class maintains the per root window state for ash. This class |
61 // owns the root window and other dependent objects that should be | 66 // owns the root window and other dependent objects that should be |
62 // deleted upon the deletion of the root window. This object is | 67 // deleted upon the deletion of the root window. This object is |
63 // indirectly owned and deleted by |WindowTreeHostManager|. | 68 // indirectly owned and deleted by |WindowTreeHostManager|. |
64 // The RootWindowController for particular root window is stored in | 69 // The RootWindowController for particular root window is stored in |
65 // its property (RootWindowSettings) and can be obtained using | 70 // its property (RootWindowSettings) and can be obtained using |
66 // |GetRootWindowController(aura::WindowEventDispatcher*)| function. | 71 // |GetRootWindowController(aura::WindowEventDispatcher*)| function. |
67 // | |
68 // NOTE: In classic ash there is one RootWindow per display, so every RootWindow | |
69 // has a RootWindowController. In mus/mash there is one RootWindow per top-level | |
70 // Widget, so not all RootWindows have a RootWindowController. | |
71 class ASH_EXPORT RootWindowController : public ShellObserver { | 72 class ASH_EXPORT RootWindowController : public ShellObserver { |
72 public: | 73 public: |
74 // Enumerates the type of display. If there is only a single display them | |
James Cook
2017/01/10 23:23:19
nit: them -> then
sky
2017/01/10 23:35:21
Done.
| |
75 // it is primary. In a multi-display environment one monitor is deemed the | |
76 // PRIMARY and all others SECONDARY. | |
77 enum class RootWindowType { PRIMARY, SECONDARY }; | |
78 | |
79 ~RootWindowController() override; | |
80 | |
73 // Creates and Initialize the RootWindowController for primary display. | 81 // Creates and Initialize the RootWindowController for primary display. |
74 static void CreateForPrimaryDisplay(AshWindowTreeHost* host); | 82 static void CreateForPrimaryDisplay(AshWindowTreeHost* host); |
75 | 83 |
76 // Creates and Initialize the RootWindowController for secondary displays. | 84 // Creates and Initialize the RootWindowController for secondary displays. |
77 static void CreateForSecondaryDisplay(AshWindowTreeHost* host); | 85 static void CreateForSecondaryDisplay(AshWindowTreeHost* host); |
78 | 86 |
79 // Returns a RootWindowController of the window's root window. | 87 // Returns a RootWindowController of the window's root window. |
80 static RootWindowController* ForWindow(const aura::Window* window); | 88 static RootWindowController* ForWindow(const aura::Window* window); |
81 | 89 |
82 // Returns the RootWindowController of the target root window. | 90 // Returns the RootWindowController of the target root window. |
83 static RootWindowController* ForTargetRootWindow(); | 91 static RootWindowController* ForTargetRootWindow(); |
84 | 92 |
85 ~RootWindowController() override; | 93 // TODO(sky): move these to a separate class or use AshWindowTreeHost in |
86 | 94 // mash. http://crbug.com/671246. |
87 AshWindowTreeHost* ash_host() { return ash_host_.get(); } | 95 AshWindowTreeHost* ash_host() { return ash_host_.get(); } |
88 const AshWindowTreeHost* ash_host() const { return ash_host_.get(); } | 96 const AshWindowTreeHost* ash_host() const { return ash_host_.get(); } |
89 | 97 |
90 aura::WindowTreeHost* GetHost(); | 98 aura::WindowTreeHost* GetHost(); |
91 const aura::WindowTreeHost* GetHost() const; | 99 const aura::WindowTreeHost* GetHost() const; |
92 aura::Window* GetRootWindow(); | 100 aura::Window* GetRootWindow(); |
93 const aura::Window* GetRootWindow() const; | 101 const aura::Window* GetRootWindow() const; |
94 | 102 |
95 WorkspaceController* workspace_controller(); | 103 WorkspaceController* workspace_controller(); |
96 | 104 |
97 WmShelf* wm_shelf() const { return wm_shelf_.get(); } | 105 WmShelf* wm_shelf() const { return wm_shelf_.get(); } |
98 | 106 |
99 WmRootWindowControllerAura* wm_root_window_controller() { | 107 WmRootWindowController* wm_root_window_controller() { |
100 return wm_root_window_controller_; | 108 return wm_root_window_controller_.get(); |
101 } | 109 } |
102 | 110 |
103 // Get touch HUDs associated with this root window controller. | 111 // Get touch HUDs associated with this root window controller. |
104 TouchHudDebug* touch_hud_debug() const { return touch_hud_debug_; } | 112 TouchHudDebug* touch_hud_debug() const { return touch_hud_debug_; } |
105 TouchHudProjection* touch_hud_projection() const { | 113 TouchHudProjection* touch_hud_projection() const { |
106 return touch_hud_projection_; | 114 return touch_hud_projection_; |
107 } | 115 } |
108 | 116 |
109 // Set touch HUDs for this root window controller. The root window controller | 117 // Set touch HUDs for this root window controller. The root window controller |
110 // will not own the HUDs; their lifetimes are managed by themselves. Whenever | 118 // will not own the HUDs; their lifetimes are managed by themselves. Whenever |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 void DeactivateKeyboard(keyboard::KeyboardController* keyboard_controller); | 181 void DeactivateKeyboard(keyboard::KeyboardController* keyboard_controller); |
174 | 182 |
175 // Tests if a window is associated with the virtual keyboard. | 183 // Tests if a window is associated with the virtual keyboard. |
176 bool IsVirtualKeyboardWindow(aura::Window* window); | 184 bool IsVirtualKeyboardWindow(aura::Window* window); |
177 | 185 |
178 // If touch exploration is enabled, update the touch exploration | 186 // If touch exploration is enabled, update the touch exploration |
179 // controller so that synthesized touch events are anchored at this point. | 187 // controller so that synthesized touch events are anchored at this point. |
180 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); | 188 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); |
181 | 189 |
182 private: | 190 private: |
183 explicit RootWindowController(AshWindowTreeHost* host); | 191 // TODO(sky): remove this. Temporary during ash-mus unification. |
184 enum RootWindowType { PRIMARY, SECONDARY }; | 192 // http://crbug.com/671246. |
193 friend class mus::RootWindowController; | |
194 | |
195 // Creates a new RootWindowController with the specified host. Only one of | |
196 // |ash_host| or |window_tree_host| should be specified. This takes ownership | |
197 // of the supplied arguments. | |
198 // TODO(sky): mash should create AshWindowTreeHost, http://crbug.com/671246. | |
199 RootWindowController(AshWindowTreeHost* ash_host, | |
200 aura::WindowTreeHost* window_tree_host); | |
185 | 201 |
186 // Initializes the RootWindowController based on |root_window_type|. | 202 // Initializes the RootWindowController based on |root_window_type|. |
187 void Init(RootWindowType root_window_type); | 203 void Init(RootWindowType root_window_type); |
188 | 204 |
189 void InitLayoutManagers(); | 205 void InitLayoutManagers(); |
190 | 206 |
191 // Initializes |system_wallpaper_| and possibly also |boot_splash_screen_|. | 207 // Initializes |system_wallpaper_| and possibly also |boot_splash_screen_|. |
192 // The initial color is determined by the |root_window_type| and whether or | 208 // The initial color is determined by the |root_window_type| and whether or |
193 // not this is the first boot. | 209 // not this is the first boot. |
194 void CreateSystemWallpaper(RootWindowType root_window_type); | 210 void CreateSystemWallpaper(RootWindowType root_window_type); |
195 | 211 |
196 // Enables projection touch HUD. | 212 // Enables projection touch HUD. |
197 void EnableTouchHudProjection(); | 213 void EnableTouchHudProjection(); |
198 | 214 |
199 // Disables projection touch HUD. | 215 // Disables projection touch HUD. |
200 void DisableTouchHudProjection(); | 216 void DisableTouchHudProjection(); |
201 | 217 |
202 DockedWindowLayoutManager* docked_window_layout_manager(); | 218 DockedWindowLayoutManager* docked_window_layout_manager(); |
203 PanelLayoutManager* panel_layout_manager(); | 219 PanelLayoutManager* panel_layout_manager(); |
204 | 220 |
205 // Overridden from ShellObserver. | 221 // Overridden from ShellObserver. |
206 void OnLoginStateChanged(LoginStatus status) override; | 222 void OnLoginStateChanged(LoginStatus status) override; |
207 void OnTouchHudProjectionToggled(bool enabled) override; | 223 void OnTouchHudProjectionToggled(bool enabled) override; |
208 | 224 |
209 std::unique_ptr<AshWindowTreeHost> ash_host_; | 225 std::unique_ptr<AshWindowTreeHost> ash_host_; |
226 std::unique_ptr<aura::WindowTreeHost> mus_window_tree_host_; | |
227 // This comes from |ash_host_| or |mus_window_tree_host_|. | |
228 aura::WindowTreeHost* window_tree_host_; | |
210 | 229 |
211 // Owned by the root window. | 230 std::unique_ptr<WmRootWindowController> wm_root_window_controller_; |
212 WmRootWindowControllerAura* wm_root_window_controller_ = nullptr; | |
213 | 231 |
214 std::unique_ptr<StackingController> stacking_controller_; | 232 std::unique_ptr<StackingController> stacking_controller_; |
215 | 233 |
216 // The shelf controller for this root window. Exists for the entire lifetime | 234 // The shelf controller for this root window. Exists for the entire lifetime |
217 // of the RootWindowController so that it is safe for observers to be added | 235 // of the RootWindowController so that it is safe for observers to be added |
218 // to it during construction of the shelf widget and status tray. | 236 // to it during construction of the shelf widget and status tray. |
219 std::unique_ptr<WmShelf> wm_shelf_; | 237 std::unique_ptr<WmShelf> wm_shelf_; |
220 | 238 |
221 std::unique_ptr<SystemWallpaperController> system_wallpaper_; | 239 std::unique_ptr<SystemWallpaperController> system_wallpaper_; |
222 | 240 |
(...skipping 17 matching lines...) Expand all Loading... | |
240 | 258 |
241 // On classic ash, returns the RootWindowController for the given |root_window|. | 259 // On classic ash, returns the RootWindowController for the given |root_window|. |
242 // On mus ash, returns the RootWindowController for the primary display. | 260 // On mus ash, returns the RootWindowController for the primary display. |
243 // See RootWindowController class comment above. | 261 // See RootWindowController class comment above. |
244 ASH_EXPORT RootWindowController* GetRootWindowController( | 262 ASH_EXPORT RootWindowController* GetRootWindowController( |
245 const aura::Window* root_window); | 263 const aura::Window* root_window); |
246 | 264 |
247 } // namespace ash | 265 } // namespace ash |
248 | 266 |
249 #endif // ASH_ROOT_WINDOW_CONTROLLER_H_ | 267 #endif // ASH_ROOT_WINDOW_CONTROLLER_H_ |
OLD | NEW |