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 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
12 #include "ash/shell_observer.h" | 12 #include "ash/shell_observer.h" |
13 #include "ash/system/user/login_status.h" | 13 #include "ash/system/user/login_status.h" |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #include "ui/aura/window_tree_host.h" | 17 #include "ui/aura/window_tree_host.h" |
18 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
19 | 19 |
| 20 #if defined(OS_CHROMEOS) |
| 21 #include "ash/system/tray_accessibility.h" |
| 22 #include "ash/test/root_window_controller_test_api_chromeos.h" |
| 23 #endif |
| 24 |
20 class SkBitmap; | 25 class SkBitmap; |
21 | 26 |
22 namespace aura { | 27 namespace aura { |
23 class EventFilter; | 28 class EventFilter; |
24 class Window; | 29 class Window; |
25 } | 30 } |
26 | 31 |
27 namespace gfx { | 32 namespace gfx { |
28 class Point; | 33 class Point; |
29 } | 34 } |
30 | 35 |
31 namespace keyboard { | 36 namespace keyboard { |
32 class KeyboardController; | 37 class KeyboardController; |
33 } | 38 } |
34 | 39 |
35 namespace ui { | 40 namespace ui { |
36 class EventHandler; | 41 class EventHandler; |
| 42 |
| 43 #if defined(OS_CHROMEOS) |
| 44 class TouchExplorationController; |
| 45 #endif |
37 } | 46 } |
38 | 47 |
39 namespace views { | 48 namespace views { |
40 class Widget; | 49 class Widget; |
41 } | 50 } |
42 | 51 |
43 namespace wm { | 52 namespace wm { |
44 class InputMethodEventFilter; | 53 class InputMethodEventFilter; |
45 class RootWindowEventFilter; | 54 class RootWindowEventFilter; |
46 class ScopedCaptureClient; | 55 class ScopedCaptureClient; |
(...skipping 23 matching lines...) Expand all Loading... |
70 class BootSplashScreen; | 79 class BootSplashScreen; |
71 #endif | 80 #endif |
72 | 81 |
73 // This class maintains the per root window state for ash. This class | 82 // This class maintains the per root window state for ash. This class |
74 // owns the root window and other dependent objects that should be | 83 // owns the root window and other dependent objects that should be |
75 // deleted upon the deletion of the root window. This object is | 84 // deleted upon the deletion of the root window. This object is |
76 // indirectly owned and deleted by |DisplayController|. | 85 // indirectly owned and deleted by |DisplayController|. |
77 // The RootWindowController for particular root window is stored in | 86 // The RootWindowController for particular root window is stored in |
78 // its property (RootWindowSettings) and can be obtained using | 87 // its property (RootWindowSettings) and can be obtained using |
79 // |GetRootWindowController(aura::WindowEventDispatcher*)| function. | 88 // |GetRootWindowController(aura::WindowEventDispatcher*)| function. |
80 class ASH_EXPORT RootWindowController : public ShellObserver { | 89 class ASH_EXPORT RootWindowController : |
| 90 #if defined(OS_CHROMEOS) |
| 91 public AccessibilityObserver, |
| 92 #endif |
| 93 public ShellObserver { |
81 public: | 94 public: |
82 | 95 |
83 // Creates and Initialize the RootWindowController for primary display. | 96 // Creates and Initialize the RootWindowController for primary display. |
84 static void CreateForPrimaryDisplay(AshWindowTreeHost* host); | 97 static void CreateForPrimaryDisplay(AshWindowTreeHost* host); |
85 | 98 |
86 // Creates and Initialize the RootWindowController for secondary displays. | 99 // Creates and Initialize the RootWindowController for secondary displays. |
87 static void CreateForSecondaryDisplay(AshWindowTreeHost* host); | 100 static void CreateForSecondaryDisplay(AshWindowTreeHost* host); |
88 | 101 |
89 // Creates and Initialize the RootWindowController for virtual | 102 // Creates and Initialize the RootWindowController for virtual |
90 // keyboard displays. | 103 // keyboard displays. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // Activate virtual keyboard on current root window controller. | 245 // Activate virtual keyboard on current root window controller. |
233 void ActivateKeyboard(keyboard::KeyboardController* keyboard_controller); | 246 void ActivateKeyboard(keyboard::KeyboardController* keyboard_controller); |
234 | 247 |
235 // Deactivate virtual keyboard on current root window controller. | 248 // Deactivate virtual keyboard on current root window controller. |
236 void DeactivateKeyboard(keyboard::KeyboardController* keyboard_controller); | 249 void DeactivateKeyboard(keyboard::KeyboardController* keyboard_controller); |
237 | 250 |
238 // Tests if a window is associated with the virtual keyboard. | 251 // Tests if a window is associated with the virtual keyboard. |
239 bool IsVirtualKeyboardWindow(aura::Window* window); | 252 bool IsVirtualKeyboardWindow(aura::Window* window); |
240 | 253 |
241 private: | 254 private: |
| 255 #if defined(OS_CHROMEOS) |
| 256 friend class ash::test::RootWindowControllerTestApi; |
| 257 #endif |
| 258 |
242 explicit RootWindowController(AshWindowTreeHost* host); | 259 explicit RootWindowController(AshWindowTreeHost* host); |
243 enum RootWindowType { | 260 enum RootWindowType { |
244 PRIMARY, | 261 PRIMARY, |
245 SECONDARY, | 262 SECONDARY, |
246 VIRTUAL_KEYBOARD | 263 VIRTUAL_KEYBOARD |
247 }; | 264 }; |
248 | 265 |
249 // Initializes the RootWindowController. |is_primary| is true if | 266 // Initializes the RootWindowController. |is_primary| is true if |
250 // the controller is for primary display. |first_run_after_boot| is | 267 // the controller is for primary display. |first_run_after_boot| is |
251 // set to true only for primary root window after boot. | 268 // set to true only for primary root window after boot. |
252 void Init(RootWindowType root_window_type, bool first_run_after_boot); | 269 void Init(RootWindowType root_window_type, bool first_run_after_boot); |
253 | 270 |
254 void InitLayoutManagers(); | 271 void InitLayoutManagers(); |
255 | 272 |
256 // Initializes |system_background_| and possibly also |boot_splash_screen_|. | 273 // Initializes |system_background_| and possibly also |boot_splash_screen_|. |
257 // |is_first_run_after_boot| determines the background's initial color. | 274 // |is_first_run_after_boot| determines the background's initial color. |
258 void CreateSystemBackground(bool is_first_run_after_boot); | 275 void CreateSystemBackground(bool is_first_run_after_boot); |
259 | 276 |
260 // Creates each of the special window containers that holds windows of various | 277 // Creates each of the special window containers that holds windows of various |
261 // types in the shell UI. | 278 // types in the shell UI. |
262 void CreateContainersInRootWindow(aura::Window* root_window); | 279 void CreateContainersInRootWindow(aura::Window* root_window); |
263 | 280 |
| 281 #if defined(OS_CHROMEOS) |
| 282 void UpdateTouchExplorationState(); |
| 283 #endif |
| 284 |
264 // Enables projection touch HUD. | 285 // Enables projection touch HUD. |
265 void EnableTouchHudProjection(); | 286 void EnableTouchHudProjection(); |
266 | 287 |
267 // Disables projection touch HUD. | 288 // Disables projection touch HUD. |
268 void DisableTouchHudProjection(); | 289 void DisableTouchHudProjection(); |
269 | 290 |
270 // Overridden from ShellObserver. | 291 // Overridden from ShellObserver. |
271 virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE; | 292 virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE; |
272 virtual void OnTouchHudProjectionToggled(bool enabled) OVERRIDE; | 293 virtual void OnTouchHudProjectionToggled(bool enabled) OVERRIDE; |
273 | 294 |
| 295 #if defined(OS_CHROMEOS) |
| 296 // Overridden from AccessibilityObserver. |
| 297 virtual void OnAccessibilityModeChanged( |
| 298 AccessibilityNotificationVisibility notify) OVERRIDE; |
| 299 #endif |
| 300 |
274 scoped_ptr<AshWindowTreeHost> ash_host_; | 301 scoped_ptr<AshWindowTreeHost> ash_host_; |
275 RootWindowLayoutManager* root_window_layout_; | 302 RootWindowLayoutManager* root_window_layout_; |
276 | 303 |
277 scoped_ptr<StackingController> stacking_controller_; | 304 scoped_ptr<StackingController> stacking_controller_; |
278 | 305 |
279 // The shelf for managing the shelf and the status widget. | 306 // The shelf for managing the shelf and the status widget. |
280 scoped_ptr<ShelfWidget> shelf_; | 307 scoped_ptr<ShelfWidget> shelf_; |
281 | 308 |
282 // An invisible/empty window used as a event target for | 309 // An invisible/empty window used as a event target for |
283 // |MouseCursorEventFilter| before a user logs in. | 310 // |MouseCursorEventFilter| before a user logs in. |
284 // (crbug.com/266987) | 311 // (crbug.com/266987) |
285 // Its container is |LockScreenBackgroundContainer| and | 312 // Its container is |LockScreenBackgroundContainer| and |
286 // this must be deleted before the container is deleted. | 313 // this must be deleted before the container is deleted. |
287 scoped_ptr<aura::Window> mouse_event_target_; | 314 scoped_ptr<aura::Window> mouse_event_target_; |
288 | 315 |
289 // Manages layout of docked windows. Owned by DockedContainer. | 316 // Manages layout of docked windows. Owned by DockedContainer. |
290 DockedWindowLayoutManager* docked_layout_manager_; | 317 DockedWindowLayoutManager* docked_layout_manager_; |
291 | 318 |
292 // Manages layout of panels. Owned by PanelContainer. | 319 // Manages layout of panels. Owned by PanelContainer. |
293 PanelLayoutManager* panel_layout_manager_; | 320 PanelLayoutManager* panel_layout_manager_; |
294 | 321 |
295 scoped_ptr<SystemBackgroundController> system_background_; | 322 scoped_ptr<SystemBackgroundController> system_background_; |
| 323 |
296 #if defined(OS_CHROMEOS) | 324 #if defined(OS_CHROMEOS) |
297 scoped_ptr<BootSplashScreen> boot_splash_screen_; | 325 scoped_ptr<BootSplashScreen> boot_splash_screen_; |
| 326 scoped_ptr<ui::TouchExplorationController> touch_exploration_controller_; |
298 #endif | 327 #endif |
299 | 328 |
300 scoped_ptr<ScreenDimmer> screen_dimmer_; | 329 scoped_ptr<ScreenDimmer> screen_dimmer_; |
301 scoped_ptr<WorkspaceController> workspace_controller_; | 330 scoped_ptr<WorkspaceController> workspace_controller_; |
302 scoped_ptr<AlwaysOnTopController> always_on_top_controller_; | 331 scoped_ptr<AlwaysOnTopController> always_on_top_controller_; |
303 | 332 |
304 // Heads-up displays for touch events. These HUDs are not owned by the root | 333 // Heads-up displays for touch events. These HUDs are not owned by the root |
305 // window controller and manage their own lifetimes. | 334 // window controller and manage their own lifetimes. |
306 TouchHudDebug* touch_hud_debug_; | 335 TouchHudDebug* touch_hud_debug_; |
307 TouchHudProjection* touch_hud_projection_; | 336 TouchHudProjection* touch_hud_projection_; |
308 | 337 |
309 // Handles double clicks on the panel window header. | 338 // Handles double clicks on the panel window header. |
310 scoped_ptr<ui::EventHandler> panel_container_handler_; | 339 scoped_ptr<ui::EventHandler> panel_container_handler_; |
311 | 340 |
312 scoped_ptr<DesktopBackgroundWidgetController> wallpaper_controller_; | 341 scoped_ptr<DesktopBackgroundWidgetController> wallpaper_controller_; |
313 scoped_ptr<AnimatingDesktopController> animating_wallpaper_controller_; | 342 scoped_ptr<AnimatingDesktopController> animating_wallpaper_controller_; |
314 scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; | 343 scoped_ptr< ::wm::ScopedCaptureClient> capture_client_; |
315 | 344 |
316 DISALLOW_COPY_AND_ASSIGN(RootWindowController); | 345 DISALLOW_COPY_AND_ASSIGN(RootWindowController); |
317 }; | 346 }; |
318 | 347 |
319 | 348 |
320 // Gets the RootWindowController for |root_window|. | 349 // Gets the RootWindowController for |root_window|. |
321 ASH_EXPORT RootWindowController* GetRootWindowController( | 350 ASH_EXPORT RootWindowController* GetRootWindowController( |
322 const aura::Window* root_window); | 351 const aura::Window* root_window); |
323 | 352 |
324 } // ash | 353 } // ash |
325 | 354 |
326 #endif // ASH_ROOT_WINDOW_CONTROLLER_H_ | 355 #endif // ASH_ROOT_WINDOW_CONTROLLER_H_ |
OLD | NEW |