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

Side by Side Diff: ash/shell.h

Issue 10546024: Add RootWindowController (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
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_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
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
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 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
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
304 // TODO(sky): don't expose this! 298 // TODO(sky): don't expose this!
305 internal::ShelfLayoutManager* shelf() const { return shelf_; } 299 internal::ShelfLayoutManager* shelf() const { return shelf_; }
306 300
307 internal::StatusAreaWidget* status_area_widget() const { 301 internal::StatusAreaWidget* status_area_widget() const {
308 return status_area_widget_; 302 return status_area_widget_;
309 } 303 }
310 304
311 // Convenience accessor for members of StatusAreaWidget. 305 // Convenience accessor for members of StatusAreaWidget.
312 SystemTrayDelegate* tray_delegate(); 306 SystemTrayDelegate* tray_delegate();
313 SystemTray* system_tray(); 307 SystemTray* system_tray();
314 308
315 // Returns the size of the grid. 309 // Returns the size of the grid.
316 int GetGridSize() const; 310 int GetGridSize() const;
317 311
318 // Returns true if in maximized or fullscreen mode.
319 bool IsInMaximizedMode() const;
320
321 static void set_initially_hide_cursor(bool hide) { 312 static void set_initially_hide_cursor(bool hide) {
322 initially_hide_cursor_ = hide; 313 initially_hide_cursor_ = hide;
323 } 314 }
324 315
325 internal::ResizeShadowController* resize_shadow_controller() { 316 internal::ResizeShadowController* resize_shadow_controller() {
326 return resize_shadow_controller_.get(); 317 return resize_shadow_controller_.get();
327 } 318 }
328 319
329 // Made available for tests. 320 // Made available for tests.
330 internal::ShadowController* shadow_controller() { 321 internal::ShadowController* shadow_controller() {
(...skipping 10 matching lines...) Expand all
341 332
342 #if defined(OS_CHROMEOS) 333 #if defined(OS_CHROMEOS)
343 chromeos::OutputConfigurator* output_configurator() { 334 chromeos::OutputConfigurator* output_configurator() {
344 return output_configurator_.get(); 335 return output_configurator_.get();
345 } 336 }
346 #endif // defined(OS_CHROMEOS) 337 #endif // defined(OS_CHROMEOS)
347 338
348 private: 339 private:
349 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors); 340 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
350 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate); 341 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
342 friend class internal::RootWindowController;
351 343
352 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; 344 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
353 345
354 explicit Shell(ShellDelegate* delegate); 346 explicit Shell(ShellDelegate* delegate);
355 virtual ~Shell(); 347 virtual ~Shell();
356 348
357 void Init(); 349 void Init();
358 350
359 // Initializes the layout managers and event filters. 351 // Initiailze the root window so that it can host browser windows.
360 void InitLayoutManagers(); 352 void InitRootWindow(aura::RootWindow* root);
353
354 // Initializes the layout managers and event filters specific for
355 // primary display.
356 void InitLayoutManagersForPrimaryDisplay(
357 internal::RootWindowController* root_window_controller);
361 358
362 // Disables the workspace grid layout. 359 // Disables the workspace grid layout.
363 void DisableWorkspaceGridLayout(); 360 void DisableWorkspaceGridLayout();
364 361
365 // aura::CursorManager::Delegate overrides: 362 // aura::CursorManager::Delegate overrides:
366 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; 363 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE;
367 virtual void ShowCursor(bool visible) OVERRIDE; 364 virtual void ShowCursor(bool visible) OVERRIDE;
368 365
369 static Shell* instance_; 366 static Shell* instance_;
370 367
371 // If set before the Shell is initialized, the mouse cursor will be hidden 368 // If set before the Shell is initialized, the mouse cursor will be hidden
372 // when the screen is initially created. 369 // when the screen is initially created.
373 static bool initially_hide_cursor_; 370 static bool initially_hide_cursor_;
374 371
375 scoped_ptr<aura::RootWindow> root_window_; 372 scoped_ptr<internal::RootWindowController> root_window_controller_;
376 ScreenAsh* screen_; 373 ScreenAsh* screen_;
377 374
378 // Active root window. Never become NULL. 375 // Active root window. Never become NULL.
379 aura::RootWindow* active_root_window_; 376 aura::RootWindow* active_root_window_;
380 377
381 // The CompoundEventFilter owned by aura::Env object. 378 // The CompoundEventFilter owned by aura::Env object.
382 aura::shared::CompoundEventFilter* env_filter_; 379 aura::shared::CompoundEventFilter* env_filter_;
383 380
384 std::vector<WindowAndBoundsPair> to_restore_; 381 std::vector<WindowAndBoundsPair> to_restore_;
385 382
386 #if !defined(OS_MACOSX) 383 #if !defined(OS_MACOSX)
387 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_; 384 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_;
388 385
389 scoped_ptr<AcceleratorController> accelerator_controller_; 386 scoped_ptr<AcceleratorController> accelerator_controller_;
390 #endif // !defined(OS_MACOSX) 387 #endif // !defined(OS_MACOSX)
391 388
392 scoped_ptr<ShellDelegate> delegate_; 389 scoped_ptr<ShellDelegate> delegate_;
393 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_; 390 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
394 391
395 scoped_ptr<Launcher> launcher_; 392 scoped_ptr<Launcher> launcher_;
396 393
397 scoped_ptr<internal::AppListController> app_list_controller_; 394 scoped_ptr<internal::AppListController> app_list_controller_;
398 395
399 scoped_ptr<internal::ShellContextMenu> shell_context_menu_; 396 scoped_ptr<internal::ShellContextMenu> shell_context_menu_;
400 scoped_ptr<internal::StackingController> stacking_controller_; 397 scoped_ptr<internal::StackingController> stacking_controller_;
401 scoped_ptr<internal::ActivationController> activation_controller_; 398 scoped_ptr<internal::ActivationController> activation_controller_;
402 scoped_ptr<internal::CaptureController> capture_controller_; 399 scoped_ptr<internal::CaptureController> capture_controller_;
403 scoped_ptr<internal::WindowModalityController> window_modality_controller_; 400 scoped_ptr<internal::WindowModalityController> window_modality_controller_;
404 scoped_ptr<internal::DragDropController> drag_drop_controller_; 401 scoped_ptr<internal::DragDropController> drag_drop_controller_;
405 scoped_ptr<internal::WorkspaceController> workspace_controller_;
406 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_; 402 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_;
407 scoped_ptr<internal::ShadowController> shadow_controller_; 403 scoped_ptr<internal::ShadowController> shadow_controller_;
408 scoped_ptr<internal::TooltipController> tooltip_controller_; 404 scoped_ptr<internal::TooltipController> tooltip_controller_;
409 scoped_ptr<internal::VisibilityController> visibility_controller_; 405 scoped_ptr<internal::VisibilityController> visibility_controller_;
410 scoped_ptr<DesktopBackgroundController> desktop_background_controller_; 406 scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
411 scoped_ptr<PowerButtonController> power_button_controller_; 407 scoped_ptr<PowerButtonController> power_button_controller_;
412 scoped_ptr<UserActivityDetector> user_activity_detector_; 408 scoped_ptr<UserActivityDetector> user_activity_detector_;
413 scoped_ptr<VideoDetector> video_detector_; 409 scoped_ptr<VideoDetector> video_detector_;
414 scoped_ptr<WindowCycleController> window_cycle_controller_; 410 scoped_ptr<WindowCycleController> window_cycle_controller_;
415 scoped_ptr<internal::FocusCycler> focus_cycler_; 411 scoped_ptr<internal::FocusCycler> focus_cycler_;
416 scoped_ptr<internal::EventClientImpl> event_client_;
417 scoped_ptr<internal::MonitorController> monitor_controller_; 412 scoped_ptr<internal::MonitorController> monitor_controller_;
418 scoped_ptr<HighContrastController> high_contrast_controller_; 413 scoped_ptr<HighContrastController> high_contrast_controller_;
419 scoped_ptr<internal::MagnificationController> magnification_controller_; 414 scoped_ptr<internal::MagnificationController> magnification_controller_;
420 scoped_ptr<internal::ScreenDimmer> screen_dimmer_;
421 scoped_ptr<aura::FocusManager> focus_manager_; 415 scoped_ptr<aura::FocusManager> focus_manager_;
422 scoped_ptr<aura::client::UserActionClient> user_action_client_; 416 scoped_ptr<aura::client::UserActionClient> user_action_client_;
423 417
424 // An event filter that rewrites or drops a key event. 418 // An event filter that rewrites or drops a key event.
425 scoped_ptr<internal::KeyRewriterEventFilter> key_rewriter_filter_; 419 scoped_ptr<internal::KeyRewriterEventFilter> key_rewriter_filter_;
426 420
427 // An event filter that pre-handles key events while the partial 421 // An event filter that pre-handles key events while the partial
428 // screenshot UI is active. 422 // screenshot UI is active.
429 scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_; 423 scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_;
430 424
(...skipping 24 matching lines...) Expand all
455 // The shelf for managing the launcher and the status widget in non-compact 449 // 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 450 // mode. Shell does not own the shelf. Instead, it is owned by container of
457 // the status area. 451 // the status area.
458 internal::ShelfLayoutManager* shelf_; 452 internal::ShelfLayoutManager* shelf_;
459 453
460 // Manages layout of panels. Owned by PanelContainer. 454 // Manages layout of panels. Owned by PanelContainer.
461 internal::PanelLayoutManager* panel_layout_manager_; 455 internal::PanelLayoutManager* panel_layout_manager_;
462 456
463 ObserverList<ShellObserver> observers_; 457 ObserverList<ShellObserver> observers_;
464 458
465 // Owned by aura::RootWindow, cached here for type safety.
466 internal::RootWindowLayoutManager* root_window_layout_;
467
468 // Widget containing system tray. 459 // Widget containing system tray.
469 internal::StatusAreaWidget* status_area_widget_; 460 internal::StatusAreaWidget* status_area_widget_;
470 461
471 // Used by ash/shell. 462 // Used by ash/shell.
472 content::BrowserContext* browser_context_; 463 content::BrowserContext* browser_context_;
473 464
474 DISALLOW_COPY_AND_ASSIGN(Shell); 465 DISALLOW_COPY_AND_ASSIGN(Shell);
475 }; 466 };
476 467
477 } // namespace ash 468 } // namespace ash
478 469
479 #endif // ASH_SHELL_H_ 470 #endif // ASH_SHELL_H_
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shell.cc » ('j') | ash/shell.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698