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

Side by Side Diff: ash/root_window_controller.h

Issue 2620913003: Removes WmRootWindowController subclasses (Closed)
Patch Set: WmLookupAura::GetRootWindowControllerWithDisplayId needs to handle null Created 3 years, 11 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_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
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 enum class RootWindowType { PRIMARY, SECONDARY };
James Cook 2017/01/10 22:41:14 nit: not your fault, but please document. Does SEC
sky 2017/01/10 23:06:56 Yes. Added comment.
75
76 ~RootWindowController() override;
77
73 // Creates and Initialize the RootWindowController for primary display. 78 // Creates and Initialize the RootWindowController for primary display.
74 static void CreateForPrimaryDisplay(AshWindowTreeHost* host); 79 static void CreateForPrimaryDisplay(AshWindowTreeHost* host);
75 80
76 // Creates and Initialize the RootWindowController for secondary displays. 81 // Creates and Initialize the RootWindowController for secondary displays.
77 static void CreateForSecondaryDisplay(AshWindowTreeHost* host); 82 static void CreateForSecondaryDisplay(AshWindowTreeHost* host);
78 83
79 // Returns a RootWindowController of the window's root window. 84 // Returns a RootWindowController of the window's root window.
80 static RootWindowController* ForWindow(const aura::Window* window); 85 static RootWindowController* ForWindow(const aura::Window* window);
81 86
82 // Returns the RootWindowController of the target root window. 87 // Returns the RootWindowController of the target root window.
83 static RootWindowController* ForTargetRootWindow(); 88 static RootWindowController* ForTargetRootWindow();
84 89
85 ~RootWindowController() override; 90 // TODO(sky): move these to a separate class or use AshWindowTreeHost in
86 91 // mash. http://crbug.com/671246.
87 AshWindowTreeHost* ash_host() { return ash_host_.get(); } 92 AshWindowTreeHost* ash_host() { return ash_host_.get(); }
88 const AshWindowTreeHost* ash_host() const { return ash_host_.get(); } 93 const AshWindowTreeHost* ash_host() const { return ash_host_.get(); }
89 94
90 aura::WindowTreeHost* GetHost(); 95 aura::WindowTreeHost* GetHost();
91 const aura::WindowTreeHost* GetHost() const; 96 const aura::WindowTreeHost* GetHost() const;
92 aura::Window* GetRootWindow(); 97 aura::Window* GetRootWindow();
93 const aura::Window* GetRootWindow() const; 98 const aura::Window* GetRootWindow() const;
94 99
95 WorkspaceController* workspace_controller(); 100 WorkspaceController* workspace_controller();
96 101
97 WmShelf* wm_shelf() const { return wm_shelf_.get(); } 102 WmShelf* wm_shelf() const { return wm_shelf_.get(); }
98 103
99 WmRootWindowControllerAura* wm_root_window_controller() { 104 WmRootWindowController* wm_root_window_controller() {
100 return wm_root_window_controller_; 105 return wm_root_window_controller_.get();
101 } 106 }
102 107
103 // Get touch HUDs associated with this root window controller. 108 // Get touch HUDs associated with this root window controller.
104 TouchHudDebug* touch_hud_debug() const { return touch_hud_debug_; } 109 TouchHudDebug* touch_hud_debug() const { return touch_hud_debug_; }
105 TouchHudProjection* touch_hud_projection() const { 110 TouchHudProjection* touch_hud_projection() const {
106 return touch_hud_projection_; 111 return touch_hud_projection_;
107 } 112 }
108 113
109 // Set touch HUDs for this root window controller. The root window controller 114 // 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 115 // will not own the HUDs; their lifetimes are managed by themselves. Whenever
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 void DeactivateKeyboard(keyboard::KeyboardController* keyboard_controller); 178 void DeactivateKeyboard(keyboard::KeyboardController* keyboard_controller);
174 179
175 // Tests if a window is associated with the virtual keyboard. 180 // Tests if a window is associated with the virtual keyboard.
176 bool IsVirtualKeyboardWindow(aura::Window* window); 181 bool IsVirtualKeyboardWindow(aura::Window* window);
177 182
178 // If touch exploration is enabled, update the touch exploration 183 // If touch exploration is enabled, update the touch exploration
179 // controller so that synthesized touch events are anchored at this point. 184 // controller so that synthesized touch events are anchored at this point.
180 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point); 185 void SetTouchAccessibilityAnchorPoint(const gfx::Point& anchor_point);
181 186
182 private: 187 private:
183 explicit RootWindowController(AshWindowTreeHost* host); 188 // TODO(sky): remove this. Temporary during ash-mus unification.
184 enum RootWindowType { PRIMARY, SECONDARY }; 189 // http://crbug.com/671246.
190 friend class mus::RootWindowController;
191
192 // Creates a new RootWindowController with the specified host. Only one of
193 // |ash_host| or |window_tree_host| should be specified. This takes ownership
194 // of the supplied arguments.
195 // TODO(sky): mash should create AshWindowTreeHost, http://crbug.com/671246.
196 RootWindowController(AshWindowTreeHost* ash_host,
197 aura::WindowTreeHost* window_tree_host);
185 198
186 // Initializes the RootWindowController based on |root_window_type|. 199 // Initializes the RootWindowController based on |root_window_type|.
187 void Init(RootWindowType root_window_type); 200 void Init(RootWindowType root_window_type);
188 201
189 void InitLayoutManagers(); 202 void InitLayoutManagers();
190 203
191 // Initializes |system_wallpaper_| and possibly also |boot_splash_screen_|. 204 // Initializes |system_wallpaper_| and possibly also |boot_splash_screen_|.
192 // The initial color is determined by the |root_window_type| and whether or 205 // The initial color is determined by the |root_window_type| and whether or
193 // not this is the first boot. 206 // not this is the first boot.
194 void CreateSystemWallpaper(RootWindowType root_window_type); 207 void CreateSystemWallpaper(RootWindowType root_window_type);
195 208
196 // Enables projection touch HUD. 209 // Enables projection touch HUD.
197 void EnableTouchHudProjection(); 210 void EnableTouchHudProjection();
198 211
199 // Disables projection touch HUD. 212 // Disables projection touch HUD.
200 void DisableTouchHudProjection(); 213 void DisableTouchHudProjection();
201 214
202 DockedWindowLayoutManager* docked_window_layout_manager(); 215 DockedWindowLayoutManager* docked_window_layout_manager();
203 PanelLayoutManager* panel_layout_manager(); 216 PanelLayoutManager* panel_layout_manager();
204 217
205 // Overridden from ShellObserver. 218 // Overridden from ShellObserver.
206 void OnLoginStateChanged(LoginStatus status) override; 219 void OnLoginStateChanged(LoginStatus status) override;
207 void OnTouchHudProjectionToggled(bool enabled) override; 220 void OnTouchHudProjectionToggled(bool enabled) override;
208 221
209 std::unique_ptr<AshWindowTreeHost> ash_host_; 222 std::unique_ptr<AshWindowTreeHost> ash_host_;
223 std::unique_ptr<aura::WindowTreeHost> owned_window_tree_host_;
James Cook 2017/01/10 22:41:14 should this be called aura_window_tree_host_ or mu
sky 2017/01/10 23:06:56 I went with mus_window_tree_host_.
224 // This comes from |ash_host_| or |owned_window_tree_host_|.
225 aura::WindowTreeHost* window_tree_host_;
210 226
211 // Owned by the root window. 227 std::unique_ptr<WmRootWindowController> wm_root_window_controller_;
212 WmRootWindowControllerAura* wm_root_window_controller_ = nullptr;
213 228
214 std::unique_ptr<StackingController> stacking_controller_; 229 std::unique_ptr<StackingController> stacking_controller_;
215 230
216 // The shelf controller for this root window. Exists for the entire lifetime 231 // 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 232 // 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. 233 // to it during construction of the shelf widget and status tray.
219 std::unique_ptr<WmShelf> wm_shelf_; 234 std::unique_ptr<WmShelf> wm_shelf_;
220 235
221 std::unique_ptr<SystemWallpaperController> system_wallpaper_; 236 std::unique_ptr<SystemWallpaperController> system_wallpaper_;
222 237
(...skipping 17 matching lines...) Expand all
240 255
241 // On classic ash, returns the RootWindowController for the given |root_window|. 256 // On classic ash, returns the RootWindowController for the given |root_window|.
242 // On mus ash, returns the RootWindowController for the primary display. 257 // On mus ash, returns the RootWindowController for the primary display.
243 // See RootWindowController class comment above. 258 // See RootWindowController class comment above.
244 ASH_EXPORT RootWindowController* GetRootWindowController( 259 ASH_EXPORT RootWindowController* GetRootWindowController(
245 const aura::Window* root_window); 260 const aura::Window* root_window);
246 261
247 } // namespace ash 262 } // namespace ash
248 263
249 #endif // ASH_ROOT_WINDOW_CONTROLLER_H_ 264 #endif // ASH_ROOT_WINDOW_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698