blob: c3adade53bc6522b1c4fc1dc0376c4596a49202e [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;
118class RootWindowController;
119class RootWindowLayoutManager;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100120class ScopedTargetRootWindow;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000121class ScreenPositionController;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000122class SlowAnimationEventFilter;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000123class StatusAreaWidget;
124class SystemGestureEventFilter;
125class SystemModalContainerEventFilter;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000126class TouchObserverHUD;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000127}
128
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000129namespace shell {
130class WindowWatcher;
131}
132
133namespace test {
134class ShellTestApi;
135}
136
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000137// Shell is a singleton object that presents the Shell API and implements the
138// RootWindow's delegate interface.
139//
140// Upon creation, the Shell sets itself as the RootWindow's delegate, which
141// takes ownership of the Shell.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000142class ASH_EXPORT Shell
143 : public internal::SystemModalContainerEventFilterDelegate,
144 public ui::EventTarget,
145 public aura::client::ActivationChangeObserver {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000146 public:
147 typedef std::vector<aura::RootWindow*> RootWindowList;
148 typedef std::vector<internal::RootWindowController*> RootWindowControllerList;
149
150 enum Direction {
151 FORWARD,
152 BACKWARD
153 };
154
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000155 // A shell must be explicitly created so that it can call |Init()| with the
156 // delegate set. |delegate| can be NULL (if not required for initialization).
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100157 // Takes ownership of |delegate|.
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000158 static Shell* CreateInstance(ShellDelegate* delegate);
159
160 // Should never be called before |CreateInstance()|.
161 static Shell* GetInstance();
162
163 // Returns true if the ash shell has been instantiated.
164 static bool HasInstance();
165
166 static void DeleteInstance();
167
168 // Returns the root window controller for the primary root window.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000169 // TODO(oshima): move this to |RootWindowController|
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000170 static internal::RootWindowController* GetPrimaryRootWindowController();
171
172 // Returns all root window controllers.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000173 // TODO(oshima): move this to |RootWindowController|
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000174 static RootWindowControllerList GetAllRootWindowControllers();
175
176 // Returns the primary RootWindow. The primary RootWindow is the one
177 // that has a launcher.
178 static aura::RootWindow* GetPrimaryRootWindow();
179
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100180 // Returns a RootWindow when used as a target when creating a new window.
181 // The root window of the active window is used in most cases, but can
182 // be overridden by using ScopedTargetRootWindow().
183 // If you want to get a RootWindow of the active window, just use
184 // |wm::GetActiveWindow()->GetRootWindow()|.
185 // TODO(oshima): Rename to GetTargetRootWindow() crbug.com/266378.
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000186 static aura::RootWindow* GetActiveRootWindow();
187
188 // Returns the global Screen object that's always active in ash.
189 static gfx::Screen* GetScreen();
190
191 // Returns all root windows.
192 static RootWindowList GetAllRootWindows();
193
194 static aura::Window* GetContainer(aura::RootWindow* root_window,
195 int container_id);
196 static const aura::Window* GetContainer(const aura::RootWindow* root_window,
197 int container_id);
198
199 // Returns the list of containers that match |container_id| in
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000200 // all root windows. If |priority_root| is given, the container
201 // in the |priority_root| will be inserted at the top of the list.
202 static std::vector<aura::Window*> GetContainersFromAllRootWindows(
203 int container_id,
204 aura::RootWindow* priority_root);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000205
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100206 // True if an experimental maximize mode is enabled which forces browser and
207 // application windows to be maximized only.
208 static bool IsForcedMaximizeMode();
209
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100210 void set_active_root_window(aura::RootWindow* target_root_window) {
211 target_root_window_ = target_root_window;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000212 }
213
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000214 // Shows the context menu for the background and launcher at
215 // |location_in_screen| (in screen coordinates).
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +0100216 void ShowContextMenu(const gfx::Point& location_in_screen,
217 ui::MenuSourceType source_type);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000218
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000219 // Toggles the app list. |window| specifies in which display the app
220 // list should be shown. If this is NULL, the active root window
221 // will be used.
222 void ToggleAppList(aura::Window* anchor);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000223
224 // Returns app list target visibility.
225 bool GetAppListTargetVisibility() const;
226
227 // Returns app list window or NULL if it is not visible.
228 aura::Window* GetAppListWindow();
229
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000230 // Returns true if a system-modal dialog window is currently open.
231 bool IsSystemModalWindowOpen() const;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000232
233 // For testing only: set simulation that a modal window is open
234 void SimulateModalWindowOpenForTesting(bool modal_window_open) {
235 simulate_modal_window_open_for_testing_ = modal_window_open;
236 }
237
238 // Creates a default views::NonClientFrameView for use by windows in the
239 // Ash environment.
240 views::NonClientFrameView* CreateDefaultNonClientFrameView(
241 views::Widget* widget);
242
243 // Rotates focus through containers that can receive focus.
244 void RotateFocus(Direction direction);
245
246 // Sets the work area insets of the display that contains |window|,
247 // this notifies observers too.
248 // TODO(sky): this no longer really replicates what happens and is unreliable.
249 // Remove this.
250 void SetDisplayWorkAreaInsets(aura::Window* window,
251 const gfx::Insets& insets);
252
253 // Called when the user logs in.
254 void OnLoginStateChanged(user::LoginStatus status);
255
256 // Called when the login status changes.
257 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
258 void UpdateAfterLoginStatusChange(user::LoginStatus status);
259
260 // Called when the application is exiting.
261 void OnAppTerminating();
262
263 // Called when the screen is locked (after the lock window is visible) or
264 // unlocked.
265 void OnLockStateChanged(bool locked);
266
267 // Initializes |launcher_|. Does nothing if it's already initialized.
268 void CreateLauncher();
269
270 // Show launcher view if it was created hidden (before session has started).
271 void ShowLauncher();
272
273 // Adds/removes observer.
274 void AddShellObserver(ShellObserver* observer);
275 void RemoveShellObserver(ShellObserver* observer);
276
277#if !defined(OS_MACOSX)
278 AcceleratorController* accelerator_controller() {
279 return accelerator_controller_.get();
280 }
281#endif // !defined(OS_MACOSX)
282
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000283 internal::DisplayManager* display_manager() {
284 return display_manager_.get();
285 }
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100286 views::corewm::InputMethodEventFilter* input_method_filter() {
287 return input_method_filter_.get();
288 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000289 views::corewm::CompoundEventFilter* env_filter() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000290 return env_filter_.get();
291 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000292 views::corewm::TooltipController* tooltip_controller() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000293 return tooltip_controller_.get();
294 }
295 internal::EventRewriterEventFilter* event_rewriter_filter() {
296 return event_rewriter_filter_.get();
297 }
298 internal::OverlayEventFilter* overlay_filter() {
299 return overlay_filter_.get();
300 }
301 DesktopBackgroundController* desktop_background_controller() {
302 return desktop_background_controller_.get();
303 }
304 PowerButtonController* power_button_controller() {
305 return power_button_controller_.get();
306 }
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +0100307 LockStateController* lock_state_controller() {
308 return lock_state_controller_.get();
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000309 }
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100310 MruWindowTracker* mru_window_tracker() {
311 return mru_window_tracker_.get();
312 }
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000313 UserActivityDetector* user_activity_detector() {
314 return user_activity_detector_.get();
315 }
316 VideoDetector* video_detector() {
317 return video_detector_.get();
318 }
319 WindowCycleController* window_cycle_controller() {
320 return window_cycle_controller_.get();
321 }
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100322 WindowSelectorController* window_selector_controller() {
323 return window_selector_controller_.get();
324 }
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000325 internal::FocusCycler* focus_cycler() {
326 return focus_cycler_.get();
327 }
328 DisplayController* display_controller() {
329 return display_controller_.get();
330 }
331 internal::MouseCursorEventFilter* mouse_cursor_filter() {
332 return mouse_cursor_filter_.get();
333 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000334 internal::EventTransformationHandler* event_transformation_handler() {
335 return event_transformation_handler_.get();
336 }
337 views::corewm::CursorManager* cursor_manager() { return &cursor_manager_; }
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000338
339 ShellDelegate* delegate() { return delegate_.get(); }
340
341 UserWallpaperDelegate* user_wallpaper_delegate() {
342 return user_wallpaper_delegate_.get();
343 }
344
345 CapsLockDelegate* caps_lock_delegate() {
346 return caps_lock_delegate_.get();
347 }
348
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100349 SessionStateDelegate* session_state_delegate() {
350 return session_state_delegate_.get();
351 }
352
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000353 HighContrastController* high_contrast_controller() {
354 return high_contrast_controller_.get();
355 }
356
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000357 MagnificationController* magnification_controller() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000358 return magnification_controller_.get();
359 }
360
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000361 PartialMagnificationController* partial_magnification_controller() {
362 return partial_magnification_controller_.get();
363 }
364 aura::client::ActivationClient* activation_client() {
365 return activation_client_;
366 }
367
368 ScreenAsh* screen() { return screen_; }
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000369
370 // Force the shelf to query for it's current visibility state.
371 void UpdateShelfVisibility();
372
373 // TODO(oshima): Define an interface to access shelf/launcher
374 // state, or just use Launcher.
375
376 // Sets/gets the shelf auto-hide behavior on |root_window|.
377 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior,
378 aura::RootWindow* root_window);
379 ShelfAutoHideBehavior GetShelfAutoHideBehavior(
380 aura::RootWindow* root_window) const;
381
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000382 // Sets/gets shelf's alignment on |root_window|.
383 void SetShelfAlignment(ShelfAlignment alignment,
384 aura::RootWindow* root_window);
385 ShelfAlignment GetShelfAlignment(aura::RootWindow* root_window);
386
387 // Dims or undims the screen.
388 void SetDimming(bool should_dim);
389
390 // Creates a modal background (a partially-opaque fullscreen window)
391 // on all displays for |window|.
392 void CreateModalBackground(aura::Window* window);
393
394 // Called when a modal window is removed. It will activate
395 // another modal window if any, or remove modal screens
396 // on all displays.
397 void OnModalWindowRemoved(aura::Window* removed);
398
399 // Returns WebNotificationTray on the primary root window.
400 WebNotificationTray* GetWebNotificationTray();
401
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000402 // Does the primary display have status area?
403 bool HasPrimaryStatusArea();
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000404
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000405 // Returns the system tray on primary display.
406 SystemTray* GetPrimarySystemTray();
407
408 SystemTrayDelegate* system_tray_delegate() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000409 return system_tray_delegate_.get();
410 }
411
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000412 SystemTrayNotifier* system_tray_notifier() {
413 return system_tray_notifier_.get();
414 }
415
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000416 static void set_initially_hide_cursor(bool hide) {
417 initially_hide_cursor_ = hide;
418 }
419
420 internal::ResizeShadowController* resize_shadow_controller() {
421 return resize_shadow_controller_.get();
422 }
423
424 // Made available for tests.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000425 views::corewm::ShadowController* shadow_controller() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000426 return shadow_controller_.get();
427 }
428
429 content::BrowserContext* browser_context() { return browser_context_; }
430 void set_browser_context(content::BrowserContext* browser_context) {
431 browser_context_ = browser_context;
432 }
433
434 // Initializes the root window to be used for a secondary display.
435 void InitRootWindowForSecondaryDisplay(aura::RootWindow* root);
436
437 // Starts the animation that occurs on first login.
438 void DoInitialWorkspaceAnimation();
439
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100440#if defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000441 // TODO(oshima): Move these objects to DisplayController.
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000442 chromeos::OutputConfigurator* output_configurator() {
443 return output_configurator_.get();
444 }
445 internal::OutputConfiguratorAnimation* output_configurator_animation() {
446 return output_configurator_animation_.get();
447 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000448 internal::DisplayErrorObserver* display_error_observer() {
449 return display_error_observer_.get();
450 }
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100451#endif // defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000452
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000453 RootWindowHostFactory* root_window_host_factory() {
454 return root_window_host_factory_.get();
455 }
456
457 LauncherModel* launcher_model() {
458 return launcher_model_.get();
459 }
460
461 // Returns the launcher delegate, creating if necesary.
462 LauncherDelegate* GetLauncherDelegate();
463
Ben Murdocheb525c52013-07-10 11:40:50 +0100464 void SetTouchHudProjectionEnabled(bool enabled);
465
466 bool is_touch_hud_projection_enabled() const {
467 return is_touch_hud_projection_enabled_;
468 }
469
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000470 private:
471 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor);
472 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
473 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
474 friend class internal::RootWindowController;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100475 friend class internal::ScopedTargetRootWindow;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000476 friend class test::ShellTestApi;
477 friend class shell::WindowWatcher;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000478
479 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
480
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100481 // Takes ownership of |delegate|.
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000482 explicit Shell(ShellDelegate* delegate);
483 virtual ~Shell();
484
485 void Init();
486
487 // Initializes the root window and root window controller so that it
Ben Murdocheb525c52013-07-10 11:40:50 +0100488 // can host browser windows. |first_run_after_boot| is true for the
489 // primary display only first time after boot.
490 void InitRootWindowController(internal::RootWindowController* root,
491 bool first_run_after_boot);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000492
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000493 // ash::internal::SystemModalContainerEventFilterDelegate overrides:
494 virtual bool CanWindowReceiveEvents(aura::Window* window) OVERRIDE;
495
496 // Overridden from ui::EventTarget:
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000497 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000498 virtual EventTarget* GetParentTarget() OVERRIDE;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000499 virtual void OnEvent(ui::Event* event) OVERRIDE;
500
501 // Overridden from aura::client::ActivationChangeObserver:
502 virtual void OnWindowActivated(aura::Window* gained_active,
503 aura::Window* lost_active) OVERRIDE;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000504
505 static Shell* instance_;
506
507 // If set before the Shell is initialized, the mouse cursor will be hidden
508 // when the screen is initially created.
509 static bool initially_hide_cursor_;
510
511 ScreenAsh* screen_;
512
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100513 // When no explicit target display/RootWindow is given, new windows are
514 // created on |scoped_target_root_window_| , unless NULL in
515 // which case they are created on |target_root_window_|.
516 // |target_root_window_| never becomes NULL during the session.
517 aura::RootWindow* target_root_window_;
518 aura::RootWindow* scoped_target_root_window_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000519
520 // The CompoundEventFilter owned by aura::Env object.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000521 scoped_ptr<views::corewm::CompoundEventFilter> env_filter_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000522
523 std::vector<WindowAndBoundsPair> to_restore_;
524
525#if !defined(OS_MACOSX)
526 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_;
527
528 scoped_ptr<AcceleratorController> accelerator_controller_;
529#endif // !defined(OS_MACOSX)
530
531 scoped_ptr<ShellDelegate> delegate_;
532 scoped_ptr<SystemTrayDelegate> system_tray_delegate_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000533 scoped_ptr<SystemTrayNotifier> system_tray_notifier_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000534 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
535 scoped_ptr<CapsLockDelegate> caps_lock_delegate_;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100536 scoped_ptr<SessionStateDelegate> session_state_delegate_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000537 scoped_ptr<LauncherDelegate> launcher_delegate_;
538
539 scoped_ptr<LauncherModel> launcher_model_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000540
541 scoped_ptr<internal::AppListController> app_list_controller_;
542
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000543 scoped_ptr<internal::ActivationController> activation_controller_;
544 scoped_ptr<internal::CaptureController> capture_controller_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000545 scoped_ptr<internal::DragDropController> drag_drop_controller_;
546 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000547 scoped_ptr<views::corewm::ShadowController> shadow_controller_;
548 scoped_ptr<views::corewm::VisibilityController> visibility_controller_;
549 scoped_ptr<views::corewm::WindowModalityController>
550 window_modality_controller_;
551 scoped_ptr<views::corewm::TooltipController> tooltip_controller_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000552 scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
553 scoped_ptr<PowerButtonController> power_button_controller_;
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +0100554 scoped_ptr<LockStateController> lock_state_controller_;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100555 scoped_ptr<MruWindowTracker> mru_window_tracker_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000556 scoped_ptr<UserActivityDetector> user_activity_detector_;
557 scoped_ptr<VideoDetector> video_detector_;
558 scoped_ptr<WindowCycleController> window_cycle_controller_;
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100559 scoped_ptr<WindowSelectorController> window_selector_controller_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000560 scoped_ptr<internal::FocusCycler> focus_cycler_;
561 scoped_ptr<DisplayController> display_controller_;
562 scoped_ptr<HighContrastController> high_contrast_controller_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000563 scoped_ptr<MagnificationController> magnification_controller_;
564 scoped_ptr<PartialMagnificationController> partial_magnification_controller_;
565 scoped_ptr<aura::client::FocusClient> focus_client_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000566 scoped_ptr<aura::client::UserActionClient> user_action_client_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000567 aura::client::ActivationClient* activation_client_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000568 scoped_ptr<internal::MouseCursorEventFilter> mouse_cursor_filter_;
569 scoped_ptr<internal::ScreenPositionController> screen_position_controller_;
570 scoped_ptr<internal::SystemModalContainerEventFilter> modality_filter_;
571 scoped_ptr<internal::EventClientImpl> event_client_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000572 scoped_ptr<internal::EventTransformationHandler>
573 event_transformation_handler_;
574 scoped_ptr<RootWindowHostFactory> root_window_host_factory_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000575
576 // An event filter that rewrites or drops an event.
577 scoped_ptr<internal::EventRewriterEventFilter> event_rewriter_filter_;
578
579 // An event filter that pre-handles key events while the partial
580 // screenshot UI or the keyboard overlay is active.
581 scoped_ptr<internal::OverlayEventFilter> overlay_filter_;
582
583 // An event filter which handles system level gestures
584 scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_;
585
586#if !defined(OS_MACOSX)
587 // An event filter that pre-handles global accelerators.
588 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_;
589#endif
590
591 // An event filter that pre-handles all key events to send them to an IME.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000592 scoped_ptr<views::corewm::InputMethodEventFilter> input_method_filter_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000593
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000594 scoped_ptr<internal::DisplayManager> display_manager_;
595
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100596 scoped_ptr<internal::LocaleNotificationController>
597 locale_notification_controller_;
598
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100599#if defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000600 // Controls video output device state.
601 scoped_ptr<chromeos::OutputConfigurator> output_configurator_;
602 scoped_ptr<internal::OutputConfiguratorAnimation>
603 output_configurator_animation_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000604 scoped_ptr<internal::DisplayErrorObserver> display_error_observer_;
605
606 // Receives output change events and udpates the display manager.
607 scoped_ptr<internal::DisplayChangeObserverX11> display_change_observer_;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100608#endif // defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000609
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000610 // |native_cursor_manager_| is owned by |cursor_manager_|, but we keep a
611 // pointer to vend to test code.
612 AshNativeCursorManager* native_cursor_manager_;
613 views::corewm::CursorManager cursor_manager_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000614
615 ObserverList<ShellObserver> observers_;
616
617 // Used by ash/shell.
618 content::BrowserContext* browser_context_;
619
620 // For testing only: simulate that a modal window is open
621 bool simulate_modal_window_open_for_testing_;
622
Ben Murdocheb525c52013-07-10 11:40:50 +0100623 bool is_touch_hud_projection_enabled_;
624
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000625 DISALLOW_COPY_AND_ASSIGN(Shell);
626};
627
628} // namespace ash
629
630#endif // ASH_SHELL_H_