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_SHELL_H_ | 5 #ifndef ASH_SHELL_H_ |
6 #define ASH_SHELL_H_ | 6 #define ASH_SHELL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 class UserWallpaperDelegate; | 73 class UserWallpaperDelegate; |
74 class VideoDetector; | 74 class VideoDetector; |
75 class WindowCycleController; | 75 class WindowCycleController; |
76 | 76 |
77 namespace internal { | 77 namespace internal { |
78 class AcceleratorFilter; | 78 class AcceleratorFilter; |
79 class ActivationController; | 79 class ActivationController; |
80 class AppListController; | 80 class AppListController; |
81 class CaptureController; | 81 class CaptureController; |
82 class DragDropController; | 82 class DragDropController; |
83 class EventClientImpl; | |
84 class FocusCycler; | 83 class FocusCycler; |
85 class KeyRewriterEventFilter; | 84 class KeyRewriterEventFilter; |
86 class MagnificationController; | 85 class MagnificationController; |
87 class MonitorController; | 86 class MonitorController; |
88 class PanelLayoutManager; | 87 class PanelLayoutManager; |
89 class PartialScreenshotEventFilter; | 88 class PartialScreenshotEventFilter; |
90 class ResizeShadowController; | 89 class ResizeShadowController; |
| 90 class RootWindowController; |
91 class RootWindowLayoutManager; | 91 class RootWindowLayoutManager; |
92 class ScreenDimmer; | |
93 class ShadowController; | 92 class ShadowController; |
94 class ShelfLayoutManager; | 93 class ShelfLayoutManager; |
95 class ShellContextMenu; | 94 class ShellContextMenu; |
96 class SlowAnimationEventFilter; | 95 class SlowAnimationEventFilter; |
97 class SystemGestureEventFilter; | 96 class SystemGestureEventFilter; |
98 class StackingController; | 97 class StackingController; |
99 class StatusAreaWidget; | 98 class StatusAreaWidget; |
100 class TooltipController; | 99 class TooltipController; |
101 class TouchObserverHUD; | 100 class TouchObserverHUD; |
102 class VisibilityController; | 101 class VisibilityController; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 static Shell* CreateInstance(ShellDelegate* delegate); | 136 static Shell* CreateInstance(ShellDelegate* delegate); |
138 | 137 |
139 // Should never be called before |CreateInstance()|. | 138 // Should never be called before |CreateInstance()|. |
140 static Shell* GetInstance(); | 139 static Shell* GetInstance(); |
141 | 140 |
142 // Returns true if the ash shell has been instantiated. | 141 // Returns true if the ash shell has been instantiated. |
143 static bool HasInstance(); | 142 static bool HasInstance(); |
144 | 143 |
145 static void DeleteInstance(); | 144 static void DeleteInstance(); |
146 | 145 |
| 146 // Returns the root window controller for the primary root window. |
| 147 static internal::RootWindowController* GetPrimaryRootWindowController(); |
| 148 |
147 // Gets the primary RootWindow. The primary RootWindow is the one | 149 // Gets the primary RootWindow. The primary RootWindow is the one |
148 // that has a launcher. | 150 // that has a launcher. |
149 static aura::RootWindow* GetPrimaryRootWindow(); | 151 static aura::RootWindow* GetPrimaryRootWindow(); |
150 | 152 |
151 // Gets the active RootWindow. The active RootWindow is the one that | 153 // Gets the active RootWindow. The active RootWindow is the one that |
152 // contains the current active window as a decendant child. The active | 154 // contains the current active window as a decendant child. The active |
153 // RootWindow remains the same even when the active window becomes NULL, | 155 // RootWindow remains the same even when the active window becomes NULL, |
154 // until the another window who has a different root window becomes active. | 156 // until the another window who has a different root window becomes active. |
155 static aura::RootWindow* GetActiveRootWindow(); | 157 static aura::RootWindow* GetActiveRootWindow(); |
156 | 158 |
157 // Gets the RootWindow at |point| in the virtual screen coordinates. | 159 // Gets the RootWindow at |point| in the virtual screen coordinates. |
158 // Returns NULL if the root window does not exist at the given | 160 // Returns NULL if the root window does not exist at the given |
159 // point. | 161 // point. |
160 static aura::RootWindow* GetRootWindowAt(const gfx::Point& point); | 162 static aura::RootWindow* GetRootWindowAt(const gfx::Point& point); |
161 | 163 |
162 static aura::Window* GetContainer(aura::RootWindow* root_window, | 164 static aura::Window* GetContainer(aura::RootWindow* root_window, |
163 int container_id); | 165 int container_id); |
164 | 166 |
165 // Returns the list of containers that match |container_id| in | 167 // Returns the list of containers that match |container_id| in |
166 // all root windows. | 168 // all root windows. |
167 static std::vector<aura::Window*> GetAllContainers(int container_id); | 169 static std::vector<aura::Window*> GetAllContainers(int container_id); |
168 | 170 |
169 void set_active_root_window(aura::RootWindow* active_root_window) { | 171 void set_active_root_window(aura::RootWindow* active_root_window) { |
170 active_root_window_ = active_root_window; | 172 active_root_window_ = active_root_window; |
171 } | 173 } |
172 | 174 |
173 internal::RootWindowLayoutManager* root_window_layout() const { | |
174 return root_window_layout_; | |
175 } | |
176 | |
177 // Adds or removes |filter| from the aura::Env's CompoundEventFilter. | 175 // Adds or removes |filter| from the aura::Env's CompoundEventFilter. |
178 void AddEnvEventFilter(aura::EventFilter* filter); | 176 void AddEnvEventFilter(aura::EventFilter* filter); |
179 void RemoveEnvEventFilter(aura::EventFilter* filter); | 177 void RemoveEnvEventFilter(aura::EventFilter* filter); |
180 size_t GetEnvEventFilterCount() const; | 178 size_t GetEnvEventFilterCount() const; |
181 | 179 |
182 // Shows the background menu over |widget|. | 180 // Shows the background menu over |widget|. |
183 void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); | 181 void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); |
184 | 182 |
185 // Toggles app list. | 183 // Toggles app list. |
186 void ToggleAppList(); | 184 void ToggleAppList(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 274 } |
277 | 275 |
278 HighContrastController* high_contrast_controller() { | 276 HighContrastController* high_contrast_controller() { |
279 return high_contrast_controller_.get(); | 277 return high_contrast_controller_.get(); |
280 } | 278 } |
281 | 279 |
282 internal::MagnificationController* magnification_controller() { | 280 internal::MagnificationController* magnification_controller() { |
283 return magnification_controller_.get(); | 281 return magnification_controller_.get(); |
284 } | 282 } |
285 | 283 |
286 internal::ScreenDimmer* screen_dimmer() { | |
287 return screen_dimmer_.get(); | |
288 } | |
289 | |
290 Launcher* launcher() { return launcher_.get(); } | 284 Launcher* launcher() { return launcher_.get(); } |
291 | 285 |
292 const ScreenAsh* screen() { return screen_; } | 286 const ScreenAsh* screen() { return screen_; } |
293 | 287 |
294 // Force the shelf to query for it's current visibility state. | 288 // Force the shelf to query for it's current visibility state. |
295 void UpdateShelfVisibility(); | 289 void UpdateShelfVisibility(); |
296 | 290 |
297 // Sets/gets the shelf auto-hide behavior. | 291 // Sets/gets the shelf auto-hide behavior. |
298 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior); | 292 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior); |
299 ShelfAutoHideBehavior GetShelfAutoHideBehavior() const; | 293 ShelfAutoHideBehavior GetShelfAutoHideBehavior() const; |
300 | 294 |
301 void SetShelfAlignment(ShelfAlignment alignment); | 295 void SetShelfAlignment(ShelfAlignment alignment); |
302 ShelfAlignment GetShelfAlignment(); | 296 ShelfAlignment GetShelfAlignment(); |
303 | 297 |
| 298 // Dims or undims the screen. |
| 299 void SetDimming(bool should_dim); |
| 300 |
304 // TODO(sky): don't expose this! | 301 // TODO(sky): don't expose this! |
305 internal::ShelfLayoutManager* shelf() const { return shelf_; } | 302 internal::ShelfLayoutManager* shelf() const { return shelf_; } |
306 | 303 |
307 internal::StatusAreaWidget* status_area_widget() const { | 304 internal::StatusAreaWidget* status_area_widget() const { |
308 return status_area_widget_; | 305 return status_area_widget_; |
309 } | 306 } |
310 | 307 |
311 // Convenience accessor for members of StatusAreaWidget. | 308 // Convenience accessor for members of StatusAreaWidget. |
312 SystemTrayDelegate* tray_delegate(); | 309 SystemTrayDelegate* tray_delegate(); |
313 SystemTray* system_tray(); | 310 SystemTray* system_tray(); |
314 | 311 |
315 // Returns the size of the grid. | 312 // Returns the size of the grid. |
316 int GetGridSize() const; | 313 int GetGridSize() const; |
317 | 314 |
318 // Returns true if in maximized or fullscreen mode. | |
319 bool IsInMaximizedMode() const; | |
320 | |
321 static void set_initially_hide_cursor(bool hide) { | 315 static void set_initially_hide_cursor(bool hide) { |
322 initially_hide_cursor_ = hide; | 316 initially_hide_cursor_ = hide; |
323 } | 317 } |
324 | 318 |
325 internal::ResizeShadowController* resize_shadow_controller() { | 319 internal::ResizeShadowController* resize_shadow_controller() { |
326 return resize_shadow_controller_.get(); | 320 return resize_shadow_controller_.get(); |
327 } | 321 } |
328 | 322 |
329 // Made available for tests. | 323 // Made available for tests. |
330 internal::ShadowController* shadow_controller() { | 324 internal::ShadowController* shadow_controller() { |
(...skipping 10 matching lines...) Expand all Loading... |
341 | 335 |
342 #if defined(OS_CHROMEOS) | 336 #if defined(OS_CHROMEOS) |
343 chromeos::OutputConfigurator* output_configurator() { | 337 chromeos::OutputConfigurator* output_configurator() { |
344 return output_configurator_.get(); | 338 return output_configurator_.get(); |
345 } | 339 } |
346 #endif // defined(OS_CHROMEOS) | 340 #endif // defined(OS_CHROMEOS) |
347 | 341 |
348 private: | 342 private: |
349 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors); | 343 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors); |
350 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate); | 344 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate); |
| 345 friend class internal::RootWindowController; |
351 | 346 |
352 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; | 347 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; |
353 | 348 |
354 explicit Shell(ShellDelegate* delegate); | 349 explicit Shell(ShellDelegate* delegate); |
355 virtual ~Shell(); | 350 virtual ~Shell(); |
356 | 351 |
357 void Init(); | 352 void Init(); |
358 | 353 |
359 // Initializes the layout managers and event filters. | 354 // Initiailze the root window so that it can host browser windows. |
360 void InitLayoutManagers(); | 355 void InitRootWindow(aura::RootWindow* root); |
| 356 |
| 357 // Initializes the layout managers and event filters specific for |
| 358 // primary display. |
| 359 void InitLayoutManagersForPrimaryDisplay( |
| 360 internal::RootWindowController* root_window_controller); |
361 | 361 |
362 // Disables the workspace grid layout. | 362 // Disables the workspace grid layout. |
363 void DisableWorkspaceGridLayout(); | 363 void DisableWorkspaceGridLayout(); |
364 | 364 |
365 // aura::CursorManager::Delegate overrides: | 365 // aura::CursorManager::Delegate overrides: |
366 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; | 366 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
367 virtual void ShowCursor(bool visible) OVERRIDE; | 367 virtual void ShowCursor(bool visible) OVERRIDE; |
368 | 368 |
369 static Shell* instance_; | 369 static Shell* instance_; |
370 | 370 |
371 // If set before the Shell is initialized, the mouse cursor will be hidden | 371 // If set before the Shell is initialized, the mouse cursor will be hidden |
372 // when the screen is initially created. | 372 // when the screen is initially created. |
373 static bool initially_hide_cursor_; | 373 static bool initially_hide_cursor_; |
374 | 374 |
375 scoped_ptr<aura::RootWindow> root_window_; | 375 scoped_ptr<internal::RootWindowController> root_window_controller_; |
376 ScreenAsh* screen_; | 376 ScreenAsh* screen_; |
377 | 377 |
378 // Active root window. Never become NULL. | 378 // Active root window. Never become NULL. |
379 aura::RootWindow* active_root_window_; | 379 aura::RootWindow* active_root_window_; |
380 | 380 |
381 // The CompoundEventFilter owned by aura::Env object. | 381 // The CompoundEventFilter owned by aura::Env object. |
382 aura::shared::CompoundEventFilter* env_filter_; | 382 aura::shared::CompoundEventFilter* env_filter_; |
383 | 383 |
384 std::vector<WindowAndBoundsPair> to_restore_; | 384 std::vector<WindowAndBoundsPair> to_restore_; |
385 | 385 |
386 #if !defined(OS_MACOSX) | 386 #if !defined(OS_MACOSX) |
387 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_; | 387 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_; |
388 | 388 |
389 scoped_ptr<AcceleratorController> accelerator_controller_; | 389 scoped_ptr<AcceleratorController> accelerator_controller_; |
390 #endif // !defined(OS_MACOSX) | 390 #endif // !defined(OS_MACOSX) |
391 | 391 |
392 scoped_ptr<ShellDelegate> delegate_; | 392 scoped_ptr<ShellDelegate> delegate_; |
393 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_; | 393 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_; |
394 | 394 |
395 scoped_ptr<Launcher> launcher_; | 395 scoped_ptr<Launcher> launcher_; |
396 | 396 |
397 scoped_ptr<internal::AppListController> app_list_controller_; | 397 scoped_ptr<internal::AppListController> app_list_controller_; |
398 | 398 |
399 scoped_ptr<internal::ShellContextMenu> shell_context_menu_; | 399 scoped_ptr<internal::ShellContextMenu> shell_context_menu_; |
400 scoped_ptr<internal::StackingController> stacking_controller_; | 400 scoped_ptr<internal::StackingController> stacking_controller_; |
401 scoped_ptr<internal::ActivationController> activation_controller_; | 401 scoped_ptr<internal::ActivationController> activation_controller_; |
402 scoped_ptr<internal::CaptureController> capture_controller_; | 402 scoped_ptr<internal::CaptureController> capture_controller_; |
403 scoped_ptr<internal::WindowModalityController> window_modality_controller_; | 403 scoped_ptr<internal::WindowModalityController> window_modality_controller_; |
404 scoped_ptr<internal::DragDropController> drag_drop_controller_; | 404 scoped_ptr<internal::DragDropController> drag_drop_controller_; |
405 scoped_ptr<internal::WorkspaceController> workspace_controller_; | |
406 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_; | 405 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_; |
407 scoped_ptr<internal::ShadowController> shadow_controller_; | 406 scoped_ptr<internal::ShadowController> shadow_controller_; |
408 scoped_ptr<internal::TooltipController> tooltip_controller_; | 407 scoped_ptr<internal::TooltipController> tooltip_controller_; |
409 scoped_ptr<internal::VisibilityController> visibility_controller_; | 408 scoped_ptr<internal::VisibilityController> visibility_controller_; |
410 scoped_ptr<DesktopBackgroundController> desktop_background_controller_; | 409 scoped_ptr<DesktopBackgroundController> desktop_background_controller_; |
411 scoped_ptr<PowerButtonController> power_button_controller_; | 410 scoped_ptr<PowerButtonController> power_button_controller_; |
412 scoped_ptr<UserActivityDetector> user_activity_detector_; | 411 scoped_ptr<UserActivityDetector> user_activity_detector_; |
413 scoped_ptr<VideoDetector> video_detector_; | 412 scoped_ptr<VideoDetector> video_detector_; |
414 scoped_ptr<WindowCycleController> window_cycle_controller_; | 413 scoped_ptr<WindowCycleController> window_cycle_controller_; |
415 scoped_ptr<internal::FocusCycler> focus_cycler_; | 414 scoped_ptr<internal::FocusCycler> focus_cycler_; |
416 scoped_ptr<internal::EventClientImpl> event_client_; | |
417 scoped_ptr<internal::MonitorController> monitor_controller_; | 415 scoped_ptr<internal::MonitorController> monitor_controller_; |
418 scoped_ptr<HighContrastController> high_contrast_controller_; | 416 scoped_ptr<HighContrastController> high_contrast_controller_; |
419 scoped_ptr<internal::MagnificationController> magnification_controller_; | 417 scoped_ptr<internal::MagnificationController> magnification_controller_; |
420 scoped_ptr<internal::ScreenDimmer> screen_dimmer_; | |
421 scoped_ptr<aura::FocusManager> focus_manager_; | 418 scoped_ptr<aura::FocusManager> focus_manager_; |
422 scoped_ptr<aura::client::UserActionClient> user_action_client_; | 419 scoped_ptr<aura::client::UserActionClient> user_action_client_; |
423 | 420 |
424 // An event filter that rewrites or drops a key event. | 421 // An event filter that rewrites or drops a key event. |
425 scoped_ptr<internal::KeyRewriterEventFilter> key_rewriter_filter_; | 422 scoped_ptr<internal::KeyRewriterEventFilter> key_rewriter_filter_; |
426 | 423 |
427 // An event filter that pre-handles key events while the partial | 424 // An event filter that pre-handles key events while the partial |
428 // screenshot UI is active. | 425 // screenshot UI is active. |
429 scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_; | 426 scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_; |
430 | 427 |
(...skipping 24 matching lines...) Expand all Loading... |
455 // The shelf for managing the launcher and the status widget in non-compact | 452 // The shelf for managing the launcher and the status widget in non-compact |
456 // mode. Shell does not own the shelf. Instead, it is owned by container of | 453 // mode. Shell does not own the shelf. Instead, it is owned by container of |
457 // the status area. | 454 // the status area. |
458 internal::ShelfLayoutManager* shelf_; | 455 internal::ShelfLayoutManager* shelf_; |
459 | 456 |
460 // Manages layout of panels. Owned by PanelContainer. | 457 // Manages layout of panels. Owned by PanelContainer. |
461 internal::PanelLayoutManager* panel_layout_manager_; | 458 internal::PanelLayoutManager* panel_layout_manager_; |
462 | 459 |
463 ObserverList<ShellObserver> observers_; | 460 ObserverList<ShellObserver> observers_; |
464 | 461 |
465 // Owned by aura::RootWindow, cached here for type safety. | |
466 internal::RootWindowLayoutManager* root_window_layout_; | |
467 | |
468 // Widget containing system tray. | 462 // Widget containing system tray. |
469 internal::StatusAreaWidget* status_area_widget_; | 463 internal::StatusAreaWidget* status_area_widget_; |
470 | 464 |
471 // Used by ash/shell. | 465 // Used by ash/shell. |
472 content::BrowserContext* browser_context_; | 466 content::BrowserContext* browser_context_; |
473 | 467 |
474 DISALLOW_COPY_AND_ASSIGN(Shell); | 468 DISALLOW_COPY_AND_ASSIGN(Shell); |
475 }; | 469 }; |
476 | 470 |
477 } // namespace ash | 471 } // namespace ash |
478 | 472 |
479 #endif // ASH_SHELL_H_ | 473 #endif // ASH_SHELL_H_ |
OLD | NEW |