blob: a602cdf3cd1891281c046b52474d11b29faa75ea [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
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010030namespace app_list {
31class ApplicationDragAndDropHost;
32}
Torne (Richard Coles)58218062012-11-14 11:43:16 +000033namespace aura {
34class EventFilter;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000035class RootWindow;
36class Window;
37namespace client {
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000038class ActivationClient;
39class FocusClient;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000040class UserActionClient;
41}
Torne (Richard Coles)58218062012-11-14 11:43:16 +000042}
43namespace chromeos {
44class OutputConfigurator;
45}
46namespace content {
47class BrowserContext;
48}
49
50namespace gfx {
51class ImageSkia;
52class Point;
53class Rect;
54}
55namespace ui {
56class Layer;
57}
58namespace views {
59class NonClientFrameView;
60class Widget;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000061namespace corewm {
62class CompoundEventFilter;
63class InputMethodEventFilter;
64class ShadowController;
65class TooltipController;
66class VisibilityController;
67class WindowModalityController;
68}
Torne (Richard Coles)58218062012-11-14 11:43:16 +000069}
70
71namespace ash {
72
73class AcceleratorController;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000074class AshNativeCursorManager;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000075class CapsLockDelegate;
76class DesktopBackgroundController;
77class DisplayController;
78class HighContrastController;
79class Launcher;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000080class LauncherDelegate;
81class LauncherModel;
82class MagnificationController;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000083class NestedDispatcherController;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000084class PartialMagnificationController;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000085class PowerButtonController;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000086class RootWindowHostFactory;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000087class ScreenAsh;
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010088class LockStateController;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010089class SessionStateDelegate;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000090class ShellDelegate;
91class ShellObserver;
92class SystemTray;
93class SystemTrayDelegate;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000094class SystemTrayNotifier;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000095class UserActivityDetector;
96class UserWallpaperDelegate;
97class VideoDetector;
98class WebNotificationTray;
99class WindowCycleController;
100
101namespace internal {
102class AcceleratorFilter;
103class ActivationController;
104class AppListController;
105class CaptureController;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000106class DisplayChangeObserverX11;
107class DisplayErrorObserver;
108class DisplayManager;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000109class DragDropController;
110class EventClientImpl;
111class EventRewriterEventFilter;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000112class EventTransformationHandler;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000113class FocusCycler;
Torne (Richard Coles)90dce4d2013-05-29 14:40:03 +0100114class MirrorWindowController;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000115class MouseCursorEventFilter;
116class OutputConfiguratorAnimation;
117class OverlayEventFilter;
118class ResizeShadowController;
119class RootWindowController;
120class RootWindowLayoutManager;
121class 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 +0000127class WorkspaceController;
128}
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
181 // Returns the active RootWindow. The active RootWindow is the one that
182 // contains the current active window as a decendant child. The active
183 // RootWindow remains the same even when the active window becomes NULL,
184 // until the another window who has a different root window becomes active.
185 static aura::RootWindow* GetActiveRootWindow();
186
187 // Returns the global Screen object that's always active in ash.
188 static gfx::Screen* GetScreen();
189
190 // Returns all root windows.
191 static RootWindowList GetAllRootWindows();
192
193 static aura::Window* GetContainer(aura::RootWindow* root_window,
194 int container_id);
195 static const aura::Window* GetContainer(const aura::RootWindow* root_window,
196 int container_id);
197
198 // Returns the list of containers that match |container_id| in
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000199 // all root windows. If |priority_root| is given, the container
200 // in the |priority_root| will be inserted at the top of the list.
201 static std::vector<aura::Window*> GetContainersFromAllRootWindows(
202 int container_id,
203 aura::RootWindow* priority_root);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000204
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100205 // True if an experimental maximize mode is enabled which forces browser and
206 // application windows to be maximized only.
207 static bool IsForcedMaximizeMode();
208
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000209 void set_active_root_window(aura::RootWindow* active_root_window) {
210 active_root_window_ = active_root_window;
211 }
212
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000213 // Shows the context menu for the background and launcher at
214 // |location_in_screen| (in screen coordinates).
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +0100215 void ShowContextMenu(const gfx::Point& location_in_screen,
216 ui::MenuSourceType source_type);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000217
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000218 // Toggles the app list. |window| specifies in which display the app
219 // list should be shown. If this is NULL, the active root window
220 // will be used.
221 void ToggleAppList(aura::Window* anchor);
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000222
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100223 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop
224 // operations outside the application list.
225 void SetDragAndDropHostOfCurrentAppList(
226 app_list::ApplicationDragAndDropHost* drag_and_drop_host);
227
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000228 // Returns app list target visibility.
229 bool GetAppListTargetVisibility() const;
230
231 // Returns app list window or NULL if it is not visible.
232 aura::Window* GetAppListWindow();
233
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000234 // Returns true if a system-modal dialog window is currently open.
235 bool IsSystemModalWindowOpen() const;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000236
237 // For testing only: set simulation that a modal window is open
238 void SimulateModalWindowOpenForTesting(bool modal_window_open) {
239 simulate_modal_window_open_for_testing_ = modal_window_open;
240 }
241
242 // Creates a default views::NonClientFrameView for use by windows in the
243 // Ash environment.
244 views::NonClientFrameView* CreateDefaultNonClientFrameView(
245 views::Widget* widget);
246
247 // Rotates focus through containers that can receive focus.
248 void RotateFocus(Direction direction);
249
250 // Sets the work area insets of the display that contains |window|,
251 // this notifies observers too.
252 // TODO(sky): this no longer really replicates what happens and is unreliable.
253 // Remove this.
254 void SetDisplayWorkAreaInsets(aura::Window* window,
255 const gfx::Insets& insets);
256
257 // Called when the user logs in.
258 void OnLoginStateChanged(user::LoginStatus status);
259
260 // Called when the login status changes.
261 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
262 void UpdateAfterLoginStatusChange(user::LoginStatus status);
263
264 // Called when the application is exiting.
265 void OnAppTerminating();
266
267 // Called when the screen is locked (after the lock window is visible) or
268 // unlocked.
269 void OnLockStateChanged(bool locked);
270
271 // Initializes |launcher_|. Does nothing if it's already initialized.
272 void CreateLauncher();
273
274 // Show launcher view if it was created hidden (before session has started).
275 void ShowLauncher();
276
277 // Adds/removes observer.
278 void AddShellObserver(ShellObserver* observer);
279 void RemoveShellObserver(ShellObserver* observer);
280
281#if !defined(OS_MACOSX)
282 AcceleratorController* accelerator_controller() {
283 return accelerator_controller_.get();
284 }
285#endif // !defined(OS_MACOSX)
286
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000287 internal::DisplayManager* display_manager() {
288 return display_manager_.get();
289 }
Torne (Richard Coles)90dce4d2013-05-29 14:40:03 +0100290 internal::MirrorWindowController* mirror_window_controller() {
291 return mirror_window_controller_.get();
292 }
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100293 views::corewm::InputMethodEventFilter* input_method_filter() {
294 return input_method_filter_.get();
295 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000296 views::corewm::CompoundEventFilter* env_filter() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000297 return env_filter_.get();
298 }
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000299 views::corewm::TooltipController* tooltip_controller() {
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000300 return tooltip_controller_.get();
301 }
302 internal::EventRewriterEventFilter* event_rewriter_filter() {
303 return event_rewriter_filter_.get();
304 }
305 internal::OverlayEventFilter* overlay_filter() {
306 return overlay_filter_.get();
307 }
308 DesktopBackgroundController* desktop_background_controller() {
309 return desktop_background_controller_.get();
310 }
311 PowerButtonController* power_button_controller() {
312 return power_button_controller_.get();
313 }
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +0100314 LockStateController* lock_state_controller() {
315 return lock_state_controller_.get();
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000316 }
317 UserActivityDetector* user_activity_detector() {
318 return user_activity_detector_.get();
319 }
320 VideoDetector* video_detector() {
321 return video_detector_.get();
322 }
323 WindowCycleController* window_cycle_controller() {
324 return window_cycle_controller_.get();
325 }
326 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
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000454 RootWindowHostFactory* root_window_host_factory() {
455 return root_window_host_factory_.get();
456 }
457
458 LauncherModel* launcher_model() {
459 return launcher_model_.get();
460 }
461
462 // Returns the launcher delegate, creating if necesary.
463 LauncherDelegate* GetLauncherDelegate();
464
Ben Murdocheb525c52013-07-10 11:40:50 +0100465 void SetTouchHudProjectionEnabled(bool enabled);
466
467 bool is_touch_hud_projection_enabled() const {
468 return is_touch_hud_projection_enabled_;
469 }
470
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000471 private:
472 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor);
473 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
474 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
475 friend class internal::RootWindowController;
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
513 // Active root window. Never becomes NULL during the session.
514 aura::RootWindow* active_root_window_;
515
516 // The CompoundEventFilter owned by aura::Env object.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000517 scoped_ptr<views::corewm::CompoundEventFilter> env_filter_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000518
519 std::vector<WindowAndBoundsPair> to_restore_;
520
521#if !defined(OS_MACOSX)
522 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_;
523
524 scoped_ptr<AcceleratorController> accelerator_controller_;
525#endif // !defined(OS_MACOSX)
526
527 scoped_ptr<ShellDelegate> delegate_;
528 scoped_ptr<SystemTrayDelegate> system_tray_delegate_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000529 scoped_ptr<SystemTrayNotifier> system_tray_notifier_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000530 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
531 scoped_ptr<CapsLockDelegate> caps_lock_delegate_;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100532 scoped_ptr<SessionStateDelegate> session_state_delegate_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000533 scoped_ptr<LauncherDelegate> launcher_delegate_;
534
535 scoped_ptr<LauncherModel> launcher_model_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000536
537 scoped_ptr<internal::AppListController> app_list_controller_;
538
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000539 scoped_ptr<internal::ActivationController> activation_controller_;
540 scoped_ptr<internal::CaptureController> capture_controller_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000541 scoped_ptr<internal::DragDropController> drag_drop_controller_;
542 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000543 scoped_ptr<views::corewm::ShadowController> shadow_controller_;
544 scoped_ptr<views::corewm::VisibilityController> visibility_controller_;
545 scoped_ptr<views::corewm::WindowModalityController>
546 window_modality_controller_;
547 scoped_ptr<views::corewm::TooltipController> tooltip_controller_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000548 scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
549 scoped_ptr<PowerButtonController> power_button_controller_;
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +0100550 scoped_ptr<LockStateController> lock_state_controller_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000551 scoped_ptr<UserActivityDetector> user_activity_detector_;
552 scoped_ptr<VideoDetector> video_detector_;
553 scoped_ptr<WindowCycleController> window_cycle_controller_;
554 scoped_ptr<internal::FocusCycler> focus_cycler_;
555 scoped_ptr<DisplayController> display_controller_;
556 scoped_ptr<HighContrastController> high_contrast_controller_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000557 scoped_ptr<MagnificationController> magnification_controller_;
558 scoped_ptr<PartialMagnificationController> partial_magnification_controller_;
559 scoped_ptr<aura::client::FocusClient> focus_client_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000560 scoped_ptr<aura::client::UserActionClient> user_action_client_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000561 aura::client::ActivationClient* activation_client_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000562 scoped_ptr<internal::MouseCursorEventFilter> mouse_cursor_filter_;
563 scoped_ptr<internal::ScreenPositionController> screen_position_controller_;
564 scoped_ptr<internal::SystemModalContainerEventFilter> modality_filter_;
565 scoped_ptr<internal::EventClientImpl> event_client_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000566 scoped_ptr<internal::EventTransformationHandler>
567 event_transformation_handler_;
568 scoped_ptr<RootWindowHostFactory> root_window_host_factory_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000569
570 // An event filter that rewrites or drops an event.
571 scoped_ptr<internal::EventRewriterEventFilter> event_rewriter_filter_;
572
573 // An event filter that pre-handles key events while the partial
574 // screenshot UI or the keyboard overlay is active.
575 scoped_ptr<internal::OverlayEventFilter> overlay_filter_;
576
577 // An event filter which handles system level gestures
578 scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_;
579
580#if !defined(OS_MACOSX)
581 // An event filter that pre-handles global accelerators.
582 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_;
583#endif
584
585 // An event filter that pre-handles all key events to send them to an IME.
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000586 scoped_ptr<views::corewm::InputMethodEventFilter> input_method_filter_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000587
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000588 scoped_ptr<internal::DisplayManager> display_manager_;
Torne (Richard Coles)90dce4d2013-05-29 14:40:03 +0100589 scoped_ptr<internal::MirrorWindowController> mirror_window_controller_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000590
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100591#if defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000592 // Controls video output device state.
593 scoped_ptr<chromeos::OutputConfigurator> output_configurator_;
594 scoped_ptr<internal::OutputConfiguratorAnimation>
595 output_configurator_animation_;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000596 scoped_ptr<internal::DisplayErrorObserver> display_error_observer_;
597
598 // Receives output change events and udpates the display manager.
599 scoped_ptr<internal::DisplayChangeObserverX11> display_change_observer_;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100600#endif // defined(OS_CHROMEOS) && defined(USE_X11)
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000601
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000602 // |native_cursor_manager_| is owned by |cursor_manager_|, but we keep a
603 // pointer to vend to test code.
604 AshNativeCursorManager* native_cursor_manager_;
605 views::corewm::CursorManager cursor_manager_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000606
607 ObserverList<ShellObserver> observers_;
608
609 // Used by ash/shell.
610 content::BrowserContext* browser_context_;
611
612 // For testing only: simulate that a modal window is open
613 bool simulate_modal_window_open_for_testing_;
614
Ben Murdocheb525c52013-07-10 11:40:50 +0100615 bool is_touch_hud_projection_enabled_;
616
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000617 DISALLOW_COPY_AND_ASSIGN(Shell);
618};
619
620} // namespace ash
621
622#endif // ASH_SHELL_H_