blob: ae08e7b534a020a07a4c23edde0df9f322d80061 [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// 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
3// found in the LICENSE file.
4
5#ifndef ASH_SHELL_H_
6#define ASH_SHELL_H_
7
8#include <utility>
9#include <vector>
10
11#include "ash/ash_export.h"
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000012#include "ash/shelf/shelf_types.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000013#include "ash/system/user/login_status.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000014#include "ash/wm/system_modal_container_event_filter_delegate.h"
15#include "base/basictypes.h"
16#include "base/compiler_specific.h"
17#include "base/gtest_prod_util.h"
18#include "base/memory/scoped_ptr.h"
19#include "base/observer_list.h"
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000020#include "ui/aura/client/activation_change_observer.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000021#include "ui/base/events/event_target.h"
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010022#include "ui/base/ui_base_types.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000023#include "ui/gfx/insets.h"
24#include "ui/gfx/screen.h"
25#include "ui/gfx/size.h"
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000026#include "ui/views/corewm/cursor_manager.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000027
28class CommandLine;
29
30namespace aura {
31class EventFilter;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000032class RootWindow;
33class Window;
34namespace client {
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000035class ActivationClient;
36class FocusClient;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000037class UserActionClient;
38}
Torne (Richard Coles)58218062012-11-14 11:43:16 +000039}
40namespace chromeos {
41class OutputConfigurator;
42}
43namespace content {
44class BrowserContext;
45}
46
47namespace gfx {
48class ImageSkia;
49class Point;
50class Rect;
51}
52namespace ui {
53class Layer;
54}
55namespace views {
56class NonClientFrameView;
57class Widget;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000058namespace corewm {
59class CompoundEventFilter;
60class InputMethodEventFilter;
61class ShadowController;
62class TooltipController;
63class VisibilityController;
64class WindowModalityController;
65}
Torne (Richard Coles)58218062012-11-14 11:43:16 +000066}
67
68namespace ash {
69
70class AcceleratorController;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000071class AshNativeCursorManager;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000072class CapsLockDelegate;
73class DesktopBackgroundController;
74class DisplayController;
75class HighContrastController;
76class Launcher;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000077class LauncherDelegate;
78class LauncherModel;
79class MagnificationController;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010080class MruWindowTracker;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000081class NestedDispatcherController;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000082class PartialMagnificationController;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000083class PowerButtonController;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000084class RootWindowHostFactory;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000085class ScreenAsh;
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010086class LockStateController;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010087class SessionStateDelegate;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000088class ShellDelegate;
89class ShellObserver;
90class SystemTray;
91class SystemTrayDelegate;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000092class SystemTrayNotifier;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000093class UserActivityDetector;
94class UserWallpaperDelegate;
95class VideoDetector;
96class WebNotificationTray;
97class WindowCycleController;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010098class WindowSelectorController;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000099
100namespace internal {
101class AcceleratorFilter;
102class ActivationController;
103class AppListController;
104class CaptureController;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000105class DisplayChangeObserverX11;
106class DisplayErrorObserver;
107class DisplayManager;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000108class DragDropController;
109class EventClientImpl;
110class EventRewriterEventFilter;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000111class EventTransformationHandler;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000112class FocusCycler;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100113class LocaleNotificationController;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000114class MouseCursorEventFilter;
115class OutputConfiguratorAnimation;
116class OverlayEventFilter;
117class ResizeShadowController;
Ben Murdochba5b9a62013-08-12 14:20:17 +0100118class ResolutionNotificationController;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000119class RootWindowController;
120class RootWindowLayoutManager;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100121class ScopedTargetRootWindow;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000122class ScreenPositionController;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000123class SlowAnimationEventFilter;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000124class StatusAreaWidget;
125class SystemGestureEventFilter;
126class SystemModalContainerEventFilter;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000127class TouchObserverHUD;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000128}
129
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000130namespace shell {
131class WindowWatcher;
132}
133
134namespace test {
135class ShellTestApi;
136}
137
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000138// Shell is a singleton object that presents the Shell API and implements the
139// RootWindow's delegate interface.
140//
141// Upon creation, the Shell sets itself as the RootWindow's delegate, which
142// takes ownership of the Shell.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000143class ASH_EXPORT Shell
144 : public internal::SystemModalContainerEventFilterDelegate,
145 public ui::EventTarget,
146 public aura::client::ActivationChangeObserver {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000147 public:
148 typedef std::vector<aura::RootWindow*> RootWindowList;
149 typedef std::vector<internal::RootWindowController*> RootWindowControllerList;
150
151 enum Direction {
152 FORWARD,
153 BACKWARD
154 };
155
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000156 // A shell must be explicitly created so that it can call |Init()| with the
157 // delegate set. |delegate| can be NULL (if not required for initialization).
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100158 // Takes ownership of |delegate|.
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000159 static Shell* CreateInstance(ShellDelegate* delegate);
160
161 // Should never be called before |CreateInstance()|.
162 static Shell* GetInstance();
163
164 // Returns true if the ash shell has been instantiated.
165 static bool HasInstance();
166
167 static void DeleteInstance();
168
169 // Returns the root window controller for the primary root window.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000170 // TODO(oshima): move this to |RootWindowController|
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000171 static internal::RootWindowController* GetPrimaryRootWindowController();
172
173 // Returns all root window controllers.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000174 // TODO(oshima): move this to |RootWindowController|
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000175 static RootWindowControllerList GetAllRootWindowControllers();
176
177 // Returns the primary RootWindow. The primary RootWindow is the one
178 // that has a launcher.
179 static aura::RootWindow* GetPrimaryRootWindow();
180
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100181 // Returns a RootWindow when used as a target when creating a new window.
182 // The root window of the active window is used in most cases, but can
183 // be overridden by using ScopedTargetRootWindow().
184 // If you want to get a RootWindow of the active window, just use
185 // |wm::GetActiveWindow()->GetRootWindow()|.
186 // TODO(oshima): Rename to GetTargetRootWindow() crbug.com/266378.
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000187 static aura::RootWindow* GetActiveRootWindow();
188
189 // Returns the global Screen object that's always active in ash.
190 static gfx::Screen* GetScreen();
191
192 // Returns all root windows.
193 static RootWindowList GetAllRootWindows();
194
195 static aura::Window* GetContainer(aura::RootWindow* root_window,
196 int container_id);
197 static const aura::Window* GetContainer(const aura::RootWindow* root_window,
198 int container_id);
199
200 // Returns the list of containers that match |container_id| in
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000201 // all root windows. If |priority_root| is given, the container
202 // in the |priority_root| will be inserted at the top of the list.
203 static std::vector<aura::Window*> GetContainersFromAllRootWindows(
204 int container_id,
205 aura::RootWindow* priority_root);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000206
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100207 // True if an experimental maximize mode is enabled which forces browser and
208 // application windows to be maximized only.
209 static bool IsForcedMaximizeMode();
210
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100211 void set_active_root_window(aura::RootWindow* target_root_window) {
212 target_root_window_ = target_root_window;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000213 }
214
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000215 // Shows the context menu for the background and launcher at
216 // |location_in_screen| (in screen coordinates).
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +0100217 void ShowContextMenu(const gfx::Point& location_in_screen,
218 ui::MenuSourceType source_type);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000219
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000220 // Toggles the app list. |window| specifies in which display the app
221 // list should be shown. If this is NULL, the active root window
222 // will be used.
223 void ToggleAppList(aura::Window* anchor);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000224
225 // Returns app list target visibility.
226 bool GetAppListTargetVisibility() const;
227
228 // Returns app list window or NULL if it is not visible.
229 aura::Window* GetAppListWindow();
230
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000231 // Returns true if a system-modal dialog window is currently open.
232 bool IsSystemModalWindowOpen() const;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000233
234 // For testing only: set simulation that a modal window is open
235 void SimulateModalWindowOpenForTesting(bool modal_window_open) {
236 simulate_modal_window_open_for_testing_ = modal_window_open;
237 }
238
239 // Creates a default views::NonClientFrameView for use by windows in the
240 // Ash environment.
241 views::NonClientFrameView* CreateDefaultNonClientFrameView(
242 views::Widget* widget);
243
244 // Rotates focus through containers that can receive focus.
245 void RotateFocus(Direction direction);
246
247 // Sets the work area insets of the display that contains |window|,
248 // this notifies observers too.
249 // TODO(sky): this no longer really replicates what happens and is unreliable.
250 // Remove this.
251 void SetDisplayWorkAreaInsets(aura::Window* window,
252 const gfx::Insets& insets);
253
254 // Called when the user logs in.
255 void OnLoginStateChanged(user::LoginStatus status);
256
257 // Called when the login status changes.
258 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
259 void UpdateAfterLoginStatusChange(user::LoginStatus status);
260
261 // Called when the application is exiting.
262 void OnAppTerminating();
263
264 // Called when the screen is locked (after the lock window is visible) or
265 // unlocked.
266 void OnLockStateChanged(bool locked);
267
268 // Initializes |launcher_|. Does nothing if it's already initialized.
269 void CreateLauncher();
270
271 // Show launcher view if it was created hidden (before session has started).
272 void ShowLauncher();
273
274 // Adds/removes observer.
275 void AddShellObserver(ShellObserver* observer);
276 void RemoveShellObserver(ShellObserver* observer);
277
278#if !defined(OS_MACOSX)
279 AcceleratorController* accelerator_controller() {
280 return accelerator_controller_.get();
281 }
282#endif // !defined(OS_MACOSX)
283
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000284 internal::DisplayManager* display_manager() {
285 return display_manager_.get();
286 }
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100287 views::corewm::InputMethodEventFilter* input_method_filter() {
288 return input_method_filter_.get();
289 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000290 views::corewm::CompoundEventFilter* env_filter() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000291 return env_filter_.get();
292 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000293 views::corewm::TooltipController* tooltip_controller() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000294 return tooltip_controller_.get();
295 }
296 internal::EventRewriterEventFilter* event_rewriter_filter() {
297 return event_rewriter_filter_.get();
298 }
299 internal::OverlayEventFilter* overlay_filter() {
300 return overlay_filter_.get();
301 }
302 DesktopBackgroundController* desktop_background_controller() {
303 return desktop_background_controller_.get();
304 }
305 PowerButtonController* power_button_controller() {
306 return power_button_controller_.get();
307 }
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +0100308 LockStateController* lock_state_controller() {
309 return lock_state_controller_.get();
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000310 }
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100311 MruWindowTracker* mru_window_tracker() {
312 return mru_window_tracker_.get();
313 }
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000314 UserActivityDetector* user_activity_detector() {
315 return user_activity_detector_.get();
316 }
317 VideoDetector* video_detector() {
318 return video_detector_.get();
319 }
320 WindowCycleController* window_cycle_controller() {
321 return window_cycle_controller_.get();
322 }
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100323 WindowSelectorController* window_selector_controller() {
324 return window_selector_controller_.get();
325 }
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000326 internal::FocusCycler* focus_cycler() {
327 return focus_cycler_.get();
328 }
329 DisplayController* display_controller() {
330 return display_controller_.get();
331 }
332 internal::MouseCursorEventFilter* mouse_cursor_filter() {
333 return mouse_cursor_filter_.get();
334 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000335 internal::EventTransformationHandler* event_transformation_handler() {
336 return event_transformation_handler_.get();
337 }
338 views::corewm::CursorManager* cursor_manager() { return &cursor_manager_; }
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000339
340 ShellDelegate* delegate() { return delegate_.get(); }
341
342 UserWallpaperDelegate* user_wallpaper_delegate() {
343 return user_wallpaper_delegate_.get();
344 }
345
346 CapsLockDelegate* caps_lock_delegate() {
347 return caps_lock_delegate_.get();
348 }
349
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100350 SessionStateDelegate* session_state_delegate() {
351 return session_state_delegate_.get();
352 }
353
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000354 HighContrastController* high_contrast_controller() {
355 return high_contrast_controller_.get();
356 }
357
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000358 MagnificationController* magnification_controller() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000359 return magnification_controller_.get();
360 }
361
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000362 PartialMagnificationController* partial_magnification_controller() {
363 return partial_magnification_controller_.get();
364 }
365 aura::client::ActivationClient* activation_client() {
366 return activation_client_;
367 }
368
369 ScreenAsh* screen() { return screen_; }
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000370
371 // Force the shelf to query for it's current visibility state.
372 void UpdateShelfVisibility();
373
374 // TODO(oshima): Define an interface to access shelf/launcher
375 // state, or just use Launcher.
376
377 // Sets/gets the shelf auto-hide behavior on |root_window|.
378 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior,
379 aura::RootWindow* root_window);
380 ShelfAutoHideBehavior GetShelfAutoHideBehavior(
381 aura::RootWindow* root_window) const;
382
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000383 // Sets/gets shelf's alignment on |root_window|.
384 void SetShelfAlignment(ShelfAlignment alignment,
385 aura::RootWindow* root_window);
386 ShelfAlignment GetShelfAlignment(aura::RootWindow* root_window);
387
388 // Dims or undims the screen.
389 void SetDimming(bool should_dim);
390
391 // Creates a modal background (a partially-opaque fullscreen window)
392 // on all displays for |window|.
393 void CreateModalBackground(aura::Window* window);
394
395 // Called when a modal window is removed. It will activate
396 // another modal window if any, or remove modal screens
397 // on all displays.
398 void OnModalWindowRemoved(aura::Window* removed);
399
400 // Returns WebNotificationTray on the primary root window.
401 WebNotificationTray* GetWebNotificationTray();
402
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000403 // Does the primary display have status area?
404 bool HasPrimaryStatusArea();
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000405
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000406 // Returns the system tray on primary display.
407 SystemTray* GetPrimarySystemTray();
408
409 SystemTrayDelegate* system_tray_delegate() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000410 return system_tray_delegate_.get();
411 }
412
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000413 SystemTrayNotifier* system_tray_notifier() {
414 return system_tray_notifier_.get();
415 }
416
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000417 static void set_initially_hide_cursor(bool hide) {
418 initially_hide_cursor_ = hide;
419 }
420
421 internal::ResizeShadowController* resize_shadow_controller() {
422 return resize_shadow_controller_.get();
423 }
424
425 // Made available for tests.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000426 views::corewm::ShadowController* shadow_controller() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000427 return shadow_controller_.get();
428 }
429
430 content::BrowserContext* browser_context() { return browser_context_; }
431 void set_browser_context(content::BrowserContext* browser_context) {
432 browser_context_ = browser_context;
433 }
434
435 // Initializes the root window to be used for a secondary display.
436 void InitRootWindowForSecondaryDisplay(aura::RootWindow* root);
437
438 // Starts the animation that occurs on first login.
439 void DoInitialWorkspaceAnimation();
440
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100441#if defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000442 // TODO(oshima): Move these objects to DisplayController.
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000443 chromeos::OutputConfigurator* output_configurator() {
444 return output_configurator_.get();
445 }
446 internal::OutputConfiguratorAnimation* output_configurator_animation() {
447 return output_configurator_animation_.get();
448 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000449 internal::DisplayErrorObserver* display_error_observer() {
450 return display_error_observer_.get();
451 }
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100452#endif // defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000453
Ben Murdochba5b9a62013-08-12 14:20:17 +0100454 internal::ResolutionNotificationController*
455 resolution_notification_controller() {
456 return resolution_notification_controller_.get();
457 }
458
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000459 RootWindowHostFactory* root_window_host_factory() {
460 return root_window_host_factory_.get();
461 }
462
463 LauncherModel* launcher_model() {
464 return launcher_model_.get();
465 }
466
467 // Returns the launcher delegate, creating if necesary.
468 LauncherDelegate* GetLauncherDelegate();
469
Ben Murdocheb525c52013-07-10 11:40:50 +0100470 void SetTouchHudProjectionEnabled(bool enabled);
471
472 bool is_touch_hud_projection_enabled() const {
473 return is_touch_hud_projection_enabled_;
474 }
475
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000476 private:
477 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor);
478 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
479 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
480 friend class internal::RootWindowController;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100481 friend class internal::ScopedTargetRootWindow;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000482 friend class test::ShellTestApi;
483 friend class shell::WindowWatcher;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000484
485 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
486
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100487 // Takes ownership of |delegate|.
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000488 explicit Shell(ShellDelegate* delegate);
489 virtual ~Shell();
490
491 void Init();
492
493 // Initializes the root window and root window controller so that it
Ben Murdocheb525c52013-07-10 11:40:50 +0100494 // can host browser windows. |first_run_after_boot| is true for the
495 // primary display only first time after boot.
496 void InitRootWindowController(internal::RootWindowController* root,
497 bool first_run_after_boot);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000498
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000499 // ash::internal::SystemModalContainerEventFilterDelegate overrides:
500 virtual bool CanWindowReceiveEvents(aura::Window* window) OVERRIDE;
501
502 // Overridden from ui::EventTarget:
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000503 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000504 virtual EventTarget* GetParentTarget() OVERRIDE;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000505 virtual void OnEvent(ui::Event* event) OVERRIDE;
506
507 // Overridden from aura::client::ActivationChangeObserver:
508 virtual void OnWindowActivated(aura::Window* gained_active,
509 aura::Window* lost_active) OVERRIDE;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000510
511 static Shell* instance_;
512
513 // If set before the Shell is initialized, the mouse cursor will be hidden
514 // when the screen is initially created.
515 static bool initially_hide_cursor_;
516
517 ScreenAsh* screen_;
518
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100519 // When no explicit target display/RootWindow is given, new windows are
520 // created on |scoped_target_root_window_| , unless NULL in
521 // which case they are created on |target_root_window_|.
522 // |target_root_window_| never becomes NULL during the session.
523 aura::RootWindow* target_root_window_;
524 aura::RootWindow* scoped_target_root_window_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000525
526 // The CompoundEventFilter owned by aura::Env object.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000527 scoped_ptr<views::corewm::CompoundEventFilter> env_filter_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000528
529 std::vector<WindowAndBoundsPair> to_restore_;
530
531#if !defined(OS_MACOSX)
532 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_;
533
534 scoped_ptr<AcceleratorController> accelerator_controller_;
535#endif // !defined(OS_MACOSX)
536
537 scoped_ptr<ShellDelegate> delegate_;
538 scoped_ptr<SystemTrayDelegate> system_tray_delegate_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000539 scoped_ptr<SystemTrayNotifier> system_tray_notifier_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000540 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
541 scoped_ptr<CapsLockDelegate> caps_lock_delegate_;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100542 scoped_ptr<SessionStateDelegate> session_state_delegate_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000543 scoped_ptr<LauncherDelegate> launcher_delegate_;
544
545 scoped_ptr<LauncherModel> launcher_model_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000546
547 scoped_ptr<internal::AppListController> app_list_controller_;
548
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000549 scoped_ptr<internal::ActivationController> activation_controller_;
550 scoped_ptr<internal::CaptureController> capture_controller_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000551 scoped_ptr<internal::DragDropController> drag_drop_controller_;
552 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000553 scoped_ptr<views::corewm::ShadowController> shadow_controller_;
554 scoped_ptr<views::corewm::VisibilityController> visibility_controller_;
555 scoped_ptr<views::corewm::WindowModalityController>
556 window_modality_controller_;
557 scoped_ptr<views::corewm::TooltipController> tooltip_controller_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000558 scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
559 scoped_ptr<PowerButtonController> power_button_controller_;
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +0100560 scoped_ptr<LockStateController> lock_state_controller_;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100561 scoped_ptr<MruWindowTracker> mru_window_tracker_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000562 scoped_ptr<UserActivityDetector> user_activity_detector_;
563 scoped_ptr<VideoDetector> video_detector_;
564 scoped_ptr<WindowCycleController> window_cycle_controller_;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100565 scoped_ptr<WindowSelectorController> window_selector_controller_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000566 scoped_ptr<internal::FocusCycler> focus_cycler_;
567 scoped_ptr<DisplayController> display_controller_;
568 scoped_ptr<HighContrastController> high_contrast_controller_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000569 scoped_ptr<MagnificationController> magnification_controller_;
570 scoped_ptr<PartialMagnificationController> partial_magnification_controller_;
571 scoped_ptr<aura::client::FocusClient> focus_client_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000572 scoped_ptr<aura::client::UserActionClient> user_action_client_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000573 aura::client::ActivationClient* activation_client_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000574 scoped_ptr<internal::MouseCursorEventFilter> mouse_cursor_filter_;
575 scoped_ptr<internal::ScreenPositionController> screen_position_controller_;
576 scoped_ptr<internal::SystemModalContainerEventFilter> modality_filter_;
577 scoped_ptr<internal::EventClientImpl> event_client_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000578 scoped_ptr<internal::EventTransformationHandler>
579 event_transformation_handler_;
580 scoped_ptr<RootWindowHostFactory> root_window_host_factory_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000581
582 // An event filter that rewrites or drops an event.
583 scoped_ptr<internal::EventRewriterEventFilter> event_rewriter_filter_;
584
585 // An event filter that pre-handles key events while the partial
586 // screenshot UI or the keyboard overlay is active.
587 scoped_ptr<internal::OverlayEventFilter> overlay_filter_;
588
589 // An event filter which handles system level gestures
590 scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_;
591
592#if !defined(OS_MACOSX)
593 // An event filter that pre-handles global accelerators.
594 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_;
595#endif
596
597 // An event filter that pre-handles all key events to send them to an IME.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000598 scoped_ptr<views::corewm::InputMethodEventFilter> input_method_filter_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000599
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000600 scoped_ptr<internal::DisplayManager> display_manager_;
601
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100602 scoped_ptr<internal::LocaleNotificationController>
603 locale_notification_controller_;
604
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100605#if defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000606 // Controls video output device state.
607 scoped_ptr<chromeos::OutputConfigurator> output_configurator_;
608 scoped_ptr<internal::OutputConfiguratorAnimation>
609 output_configurator_animation_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000610 scoped_ptr<internal::DisplayErrorObserver> display_error_observer_;
611
612 // Receives output change events and udpates the display manager.
613 scoped_ptr<internal::DisplayChangeObserverX11> display_change_observer_;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100614#endif // defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000615
Ben Murdochba5b9a62013-08-12 14:20:17 +0100616 scoped_ptr<internal::ResolutionNotificationController>
617 resolution_notification_controller_;
618
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000619 // |native_cursor_manager_| is owned by |cursor_manager_|, but we keep a
620 // pointer to vend to test code.
621 AshNativeCursorManager* native_cursor_manager_;
622 views::corewm::CursorManager cursor_manager_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000623
624 ObserverList<ShellObserver> observers_;
625
626 // Used by ash/shell.
627 content::BrowserContext* browser_context_;
628
629 // For testing only: simulate that a modal window is open
630 bool simulate_modal_window_open_for_testing_;
631
Ben Murdocheb525c52013-07-10 11:40:50 +0100632 bool is_touch_hud_projection_enabled_;
633
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000634 DISALLOW_COPY_AND_ASSIGN(Shell);
635};
636
637} // namespace ash
638
639#endif // ASH_SHELL_H_