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
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"
12#include "ash/metrics/user_metrics_recorder.h"
13#include "ash/shelf/shelf_types.h"
14#include "ash/system/user/login_status.h"
15#include "ash/wm/cursor_manager_chromeos.h"
16#include "ash/wm/system_modal_container_event_filter_delegate.h"
17#include "base/basictypes.h"
18#include "base/compiler_specific.h"
19#include "base/gtest_prod_util.h"
20#include "base/memory/scoped_ptr.h"
21#include "base/memory/weak_ptr.h"
22#include "base/observer_list.h"
23#include "ui/aura/window.h"
24#include "ui/base/ui_base_types.h"
25#include "ui/events/event_target.h"
26#include "ui/gfx/insets.h"
27#include "ui/gfx/screen.h"
28#include "ui/gfx/size.h"
29#include "ui/wm/core/cursor_manager.h"
30#include "ui/wm/public/activation_change_observer.h"
31
32namespace app_list {
33class AppListView;
34}
35namespace aura {
36class EventFilter;
37class RootWindow;
38class Window;
39namespace client {
40class ActivationClient;
41class FocusClient;
42}
43}
44
45namespace gfx {
46class ImageSkia;
47class Point;
48class Rect;
49}
50
51namespace ui {
52class DisplayConfigurator;
53class Layer;
54class UserActivityPowerManagerNotifier;
55}
56namespace views {
57class NonClientFrameView;
58class Widget;
59namespace corewm {
60class TooltipController;
61}
62}
63
64namespace wm {
65class AcceleratorFilter;
66class CompoundEventFilter;
67class InputMethodEventFilter;
68class NestedAcceleratorController;
69class ShadowController;
70class VisibilityController;
71class UserActivityDetector;
72class WindowModalityController;
73}
74
75namespace ash {
76
77class AcceleratorController;
78class AccelerometerController;
79class AccessibilityDelegate;
80class AppListController;
81class AshNativeCursorManager;
82class AutoclickController;
83class BluetoothNotificationController;
84class CaptureController;
85class DesktopBackgroundController;
86class DisplayChangeObserver;
87class DisplayConfiguratorAnimation;
88class DisplayController;
89class DisplayErrorObserver;
90class DisplayManager;
91class DragDropController;
92class EventClientImpl;
93class EventRewriterEventFilter;
94class EventTransformationHandler;
95class FirstRunHelper;
96class FocusCycler;
97class GPUSupport;
98class HighContrastController;
99class KeyboardUMAEventFilter;
100class LastWindowClosedLogoutReminder;
101class LocaleNotificationController;
102class LockStateController;
103class LogoutConfirmationController;
104class MagnificationController;
105class MaximizeModeController;
106class MaximizeModeWindowManager;
107class MediaDelegate;
108class MouseCursorEventFilter;
109class MruWindowTracker;
110class NewWindowDelegate;
111class OverlayEventFilter;
112class PartialMagnificationController;
113class PowerButtonController;
114class PowerEventObserver;
115class ProjectingObserver;
116class ResizeShadowController;
117class ResolutionNotificationController;
118class RootWindowController;
119class ScopedTargetRootWindow;
120class ScreenAsh;
121class ScreenPositionController;
122class SessionStateDelegate;
123class Shelf;
124class ShelfDelegate;
125class ShelfItemDelegateManager;
126class ShelfModel;
127class ShelfWindowWatcher;
128class ShellDelegate;
129struct ShellInitParams;
130class ShellObserver;
131class SlowAnimationEventFilter;
132class StatusAreaWidget;
133class StickyKeysController;
134class SystemGestureEventFilter;
135class SystemModalContainerEventFilter;
136class SystemTray;
137class SystemTrayDelegate;
138class SystemTrayNotifier;
139class ToplevelWindowEventHandler;
140class TouchTransformerController;
141class TouchObserverHUD;
142class UserActivityDetector;
143class UserWallpaperDelegate;
144class VirtualKeyboardController;
145class VideoActivityNotifier;
146class VideoDetector;
147class WebNotificationTray;
148class WindowCycleController;
149class WindowPositioner;
150class WindowSelectorController;
151
152namespace shell {
153class WindowWatcher;
154}
155
156namespace test {
157class ShellTestApi;
158}
159
160// Shell is a singleton object that presents the Shell API and implements the
161// RootWindow's delegate interface.
162//
163// Upon creation, the Shell sets itself as the RootWindow's delegate, which
164// takes ownership of the Shell.
165class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
166                         public ui::EventTarget,
167                         public aura::client::ActivationChangeObserver {
168 public:
169  typedef std::vector<RootWindowController*> RootWindowControllerList;
170
171  enum Direction {
172    FORWARD,
173    BACKWARD
174  };
175
176  // A shell must be explicitly created so that it can call |Init()| with the
177  // delegate set. |delegate| can be NULL (if not required for initialization).
178  // Takes ownership of |delegate|.
179  static Shell* CreateInstance(const ShellInitParams& init_params);
180
181  // Should never be called before |CreateInstance()|.
182  static Shell* GetInstance();
183
184  // Returns true if the ash shell has been instantiated.
185  static bool HasInstance();
186
187  static void DeleteInstance();
188
189  // Returns the root window controller for the primary root window.
190  // TODO(oshima): move this to |RootWindowController|
191  static RootWindowController* GetPrimaryRootWindowController();
192
193  // Returns all root window controllers.
194  // TODO(oshima): move this to |RootWindowController|
195  static RootWindowControllerList GetAllRootWindowControllers();
196
197  // Returns the primary root Window. The primary root Window is the one that
198  // has a launcher.
199  static aura::Window* GetPrimaryRootWindow();
200
201  // Returns a root Window when used as a target when creating a new window.
202  // The root window of the active window is used in most cases, but can
203  // be overridden by using ScopedTargetRootWindow().
204  // If you want to get the root Window of the active window, just use
205  // |wm::GetActiveWindow()->GetRootWindow()|.
206  static aura::Window* GetTargetRootWindow();
207
208  // Returns the global Screen object that's always active in ash.
209  static gfx::Screen* GetScreen();
210
211  // Returns all root windows.
212  static aura::Window::Windows GetAllRootWindows();
213
214  static aura::Window* GetContainer(aura::Window* root_window,
215                                    int container_id);
216  static const aura::Window* GetContainer(const aura::Window* root_window,
217                                          int container_id);
218
219  // Returns the list of containers that match |container_id| in
220  // all root windows. If |priority_root| is given, the container
221  // in the |priority_root| will be inserted at the top of the list.
222  static std::vector<aura::Window*> GetContainersFromAllRootWindows(
223      int container_id,
224      aura::Window* priority_root);
225
226  void set_target_root_window(aura::Window* target_root_window) {
227    target_root_window_ = target_root_window;
228  }
229
230  // Shows the context menu for the background and launcher at
231  // |location_in_screen| (in screen coordinates).
232  void ShowContextMenu(const gfx::Point& location_in_screen,
233                       ui::MenuSourceType source_type);
234
235  // Shows the app list. |window| specifies in which display the app
236  // list should be shown. If this is NULL, the active root window
237  // will be used.
238  void ShowAppList(aura::Window* anchor);
239
240  // Dismisses the app list.
241  void DismissAppList();
242
243  // Shows the app list if it's not visible. Dismisses it otherwise.
244  void ToggleAppList(aura::Window* anchor);
245
246  // Returns app list target visibility.
247  bool GetAppListTargetVisibility() const;
248
249  // Returns app list window or NULL if it is not visible.
250  aura::Window* GetAppListWindow();
251
252  // Returns app list view or NULL if it is not visible.
253  app_list::AppListView* GetAppListView();
254
255  // Returns true if a system-modal dialog window is currently open.
256  bool IsSystemModalWindowOpen() const;
257
258  // For testing only: set simulation that a modal window is open
259  void SimulateModalWindowOpenForTesting(bool modal_window_open) {
260    simulate_modal_window_open_for_testing_ = modal_window_open;
261  }
262
263  // Creates a default views::NonClientFrameView for use by windows in the
264  // Ash environment.
265  views::NonClientFrameView* CreateDefaultNonClientFrameView(
266      views::Widget* widget);
267
268  // Rotates focus through containers that can receive focus.
269  void RotateFocus(Direction direction);
270
271  // Sets the work area insets of the display that contains |window|,
272  // this notifies observers too.
273  // TODO(sky): this no longer really replicates what happens and is unreliable.
274  // Remove this.
275  void SetDisplayWorkAreaInsets(aura::Window* window,
276                                const gfx::Insets& insets);
277
278  // Called when the user logs in.
279  void OnLoginStateChanged(user::LoginStatus status);
280
281  // Called after the logged-in user's profile is ready.
282  void OnLoginUserProfilePrepared();
283
284  // Called when the login status changes.
285  // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
286  void UpdateAfterLoginStatusChange(user::LoginStatus status);
287
288  // Called when the application is exiting.
289  void OnAppTerminating();
290
291  // Called when the screen is locked (after the lock window is visible) or
292  // unlocked.
293  void OnLockStateChanged(bool locked);
294
295  // Called when a casting session is started or stopped.
296  void OnCastingSessionStartedOrStopped(bool started);
297
298  // Called when the overview mode is about to be started (before the windows
299  // get re-arranged).
300  void OnOverviewModeStarting();
301
302  // Called before the overview mode is ending (before the windows get arranged
303  // to their final position).
304  void OnOverviewModeEnding();
305
306  // Called after maximize mode has started, windows might still animate though.
307  void OnMaximizeModeStarted();
308
309  // Called after maximize mode has ended, windows might still be returning to
310  // their original position.
311  void OnMaximizeModeEnded();
312
313  // Called when a root window is created.
314  void OnRootWindowAdded(aura::Window* root_window);
315
316  // Initializes |shelf_|.  Does nothing if it's already initialized.
317  void CreateShelf();
318
319  // Called when the shelf is created for |root_window|.
320  void OnShelfCreatedForRootWindow(aura::Window* root_window);
321
322  // Creates a virtual keyboard. Deletes the old virtual keyboard if it already
323  // exists.
324  void CreateKeyboard();
325
326  // Deactivates the virtual keyboard.
327  void DeactivateKeyboard();
328
329  // Show shelf view if it was created hidden (before session has started).
330  void ShowShelf();
331
332  // Adds/removes observer.
333  void AddShellObserver(ShellObserver* observer);
334  void RemoveShellObserver(ShellObserver* observer);
335
336#if defined(OS_CHROMEOS)
337  // Test if MaximizeModeWindowManager is not enabled, and if
338  // MaximizeModeController is not currently setting a display rotation. Or if
339  // the |resolution_notification_controller_| is not showing its confirmation
340  // dialog. If true then changes to display settings can be saved.
341  bool ShouldSaveDisplaySettings();
342#endif
343
344  AcceleratorController* accelerator_controller() {
345    return accelerator_controller_.get();
346  }
347
348  DisplayManager* display_manager() { return display_manager_.get(); }
349  ::wm::InputMethodEventFilter* input_method_filter() {
350    return input_method_filter_.get();
351  }
352  ::wm::CompoundEventFilter* env_filter() {
353    return env_filter_.get();
354  }
355  views::corewm::TooltipController* tooltip_controller() {
356    return tooltip_controller_.get();
357  }
358  OverlayEventFilter* overlay_filter() { return overlay_filter_.get(); }
359  DesktopBackgroundController* desktop_background_controller() {
360    return desktop_background_controller_.get();
361  }
362  PowerButtonController* power_button_controller() {
363    return power_button_controller_.get();
364  }
365  LockStateController* lock_state_controller() {
366    return lock_state_controller_.get();
367  }
368  MruWindowTracker* mru_window_tracker() {
369    return mru_window_tracker_.get();
370  }
371  ::wm::UserActivityDetector* user_activity_detector() {
372    return user_activity_detector_.get();
373  }
374  VideoDetector* video_detector() {
375    return video_detector_.get();
376  }
377  WindowCycleController* window_cycle_controller() {
378    return window_cycle_controller_.get();
379  }
380  WindowSelectorController* window_selector_controller() {
381    return window_selector_controller_.get();
382  }
383  FocusCycler* focus_cycler() { return focus_cycler_.get(); }
384  DisplayController* display_controller() {
385    return display_controller_.get();
386  }
387#if defined(OS_CHROMEOS) && defined(USE_X11)
388  TouchTransformerController* touch_transformer_controller() {
389    return touch_transformer_controller_.get();
390  }
391#endif  // defined(OS_CHROMEOS) && defined(USE_X11)
392  MouseCursorEventFilter* mouse_cursor_filter() {
393    return mouse_cursor_filter_.get();
394  }
395  EventTransformationHandler* event_transformation_handler() {
396    return event_transformation_handler_.get();
397  }
398  ::wm::CursorManager* cursor_manager() { return &cursor_manager_; }
399
400  ShellDelegate* delegate() { return delegate_.get(); }
401
402  UserWallpaperDelegate* user_wallpaper_delegate() {
403    return user_wallpaper_delegate_.get();
404  }
405
406  SessionStateDelegate* session_state_delegate() {
407    return session_state_delegate_.get();
408  }
409
410  AccessibilityDelegate* accessibility_delegate() {
411    return accessibility_delegate_.get();
412  }
413
414  NewWindowDelegate* new_window_delegate() {
415    return new_window_delegate_.get();
416  }
417
418  MediaDelegate* media_delegate() {
419    return media_delegate_.get();
420  }
421
422  HighContrastController* high_contrast_controller() {
423    return high_contrast_controller_.get();
424  }
425
426  MagnificationController* magnification_controller() {
427    return magnification_controller_.get();
428  }
429
430  PartialMagnificationController* partial_magnification_controller() {
431    return partial_magnification_controller_.get();
432  }
433
434  AutoclickController* autoclick_controller() {
435    return autoclick_controller_.get();
436  }
437
438  aura::client::ActivationClient* activation_client() {
439    return activation_client_;
440  }
441
442  ShelfItemDelegateManager* shelf_item_delegate_manager() {
443    return shelf_item_delegate_manager_.get();
444  }
445
446  // Force the shelf to query for it's current visibility state.
447  void UpdateShelfVisibility();
448
449  // TODO(oshima): Define an interface to access shelf/launcher
450  // state, or just use Launcher.
451
452  // Sets/gets the shelf auto-hide behavior on |root_window|.
453  void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior,
454                                aura::Window* root_window);
455  ShelfAutoHideBehavior GetShelfAutoHideBehavior(
456      aura::Window* root_window) const;
457
458  // Sets/gets shelf's alignment on |root_window|.
459  void SetShelfAlignment(ShelfAlignment alignment,
460                         aura::Window* root_window);
461  ShelfAlignment GetShelfAlignment(const aura::Window* root_window);
462
463  // Dims or undims the screen.
464  void SetDimming(bool should_dim);
465
466  // Notifies |observers_| when entering or exiting fullscreen mode in
467  // |root_window|.
468  void NotifyFullscreenStateChange(bool is_fullscreen,
469                                   aura::Window* root_window);
470
471  // Creates a modal background (a partially-opaque fullscreen window)
472  // on all displays for |window|.
473  void CreateModalBackground(aura::Window* window);
474
475  // Called when a modal window is removed. It will activate
476  // another modal window if any, or remove modal screens
477  // on all displays.
478  void OnModalWindowRemoved(aura::Window* removed);
479
480  // Returns WebNotificationTray on the primary root window.
481  WebNotificationTray* GetWebNotificationTray();
482
483  // Does the primary display have status area?
484  bool HasPrimaryStatusArea();
485
486  // Returns the system tray on primary display.
487  SystemTray* GetPrimarySystemTray();
488
489  SystemTrayDelegate* system_tray_delegate() {
490    return system_tray_delegate_.get();
491  }
492
493  SystemTrayNotifier* system_tray_notifier() {
494    return system_tray_notifier_.get();
495  }
496
497  static void set_initially_hide_cursor(bool hide) {
498    initially_hide_cursor_ = hide;
499  }
500
501  ResizeShadowController* resize_shadow_controller() {
502    return resize_shadow_controller_.get();
503  }
504
505  // Made available for tests.
506  ::wm::ShadowController* shadow_controller() {
507    return shadow_controller_.get();
508  }
509
510  // Starts the animation that occurs on first login.
511  void DoInitialWorkspaceAnimation();
512
513  AccelerometerController* accelerometer_controller() {
514    return accelerometer_controller_.get();
515  }
516
517  MaximizeModeController* maximize_mode_controller() {
518    return maximize_mode_controller_.get();
519  }
520
521#if defined(OS_CHROMEOS)
522  // TODO(oshima): Move these objects to DisplayController.
523  ui::DisplayConfigurator* display_configurator() {
524    return display_configurator_.get();
525  }
526  DisplayConfiguratorAnimation* display_configurator_animation() {
527    return display_configurator_animation_.get();
528  }
529  DisplayErrorObserver* display_error_observer() {
530    return display_error_observer_.get();
531  }
532
533  ResolutionNotificationController* resolution_notification_controller() {
534    return resolution_notification_controller_.get();
535  }
536
537  LogoutConfirmationController* logout_confirmation_controller() {
538    return logout_confirmation_controller_.get();
539  }
540#endif  // defined(OS_CHROMEOS)
541
542  ShelfModel* shelf_model() {
543    return shelf_model_.get();
544  }
545
546  WindowPositioner* window_positioner() {
547    return window_positioner_.get();
548  }
549
550  // Returns the launcher delegate, creating if necesary.
551  ShelfDelegate* GetShelfDelegate();
552
553  UserMetricsRecorder* metrics() {
554    return user_metrics_recorder_.get();
555  }
556
557  void SetTouchHudProjectionEnabled(bool enabled);
558
559  bool is_touch_hud_projection_enabled() const {
560    return is_touch_hud_projection_enabled_;
561  }
562
563#if defined(OS_CHROMEOS)
564  // Creates instance of FirstRunHelper. Caller is responsible for deleting
565  // returned object.
566  ash::FirstRunHelper* CreateFirstRunHelper();
567
568  // Toggles cursor compositing on/off. Native cursor is disabled when cursor
569  // compositing is enabled, and vice versa.
570  void SetCursorCompositingEnabled(bool enabled);
571
572  StickyKeysController* sticky_keys_controller() {
573    return sticky_keys_controller_.get();
574  }
575#endif  // defined(OS_CHROMEOS)
576
577  GPUSupport* gpu_support() { return gpu_support_.get(); }
578
579 private:
580  FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor);
581  FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
582  FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
583  friend class RootWindowController;
584  friend class ScopedTargetRootWindow;
585  friend class test::ShellTestApi;
586  friend class shell::WindowWatcher;
587
588  typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
589
590  // Takes ownership of |delegate|.
591  explicit Shell(ShellDelegate* delegate);
592  virtual ~Shell();
593
594  void Init(const ShellInitParams& init_params);
595
596  // Initializes virtual keyboard controller.
597  void InitKeyboard();
598
599  // Initializes the root window so that it can host browser windows.
600  void InitRootWindow(aura::Window* root_window);
601
602  // ash::SystemModalContainerEventFilterDelegate overrides:
603  virtual bool CanWindowReceiveEvents(aura::Window* window) OVERRIDE;
604
605  // Overridden from ui::EventTarget:
606  virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE;
607  virtual EventTarget* GetParentTarget() OVERRIDE;
608  virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE;
609  virtual ui::EventTargeter* GetEventTargeter() OVERRIDE;
610  virtual void OnEvent(ui::Event* event) OVERRIDE;
611
612  // Overridden from aura::client::ActivationChangeObserver:
613  virtual void OnWindowActivated(aura::Window* gained_active,
614                                 aura::Window* lost_active) OVERRIDE;
615
616  static Shell* instance_;
617
618  // If set before the Shell is initialized, the mouse cursor will be hidden
619  // when the screen is initially created.
620  static bool initially_hide_cursor_;
621
622  // When no explicit target display/RootWindow is given, new windows are
623  // created on |scoped_target_root_window_| , unless NULL in
624  // which case they are created on |target_root_window_|.
625  // |target_root_window_| never becomes NULL during the session.
626  aura::Window* target_root_window_;
627  aura::Window* scoped_target_root_window_;
628
629  // The CompoundEventFilter owned by aura::Env object.
630  scoped_ptr< ::wm::CompoundEventFilter> env_filter_;
631
632  std::vector<WindowAndBoundsPair> to_restore_;
633
634  scoped_ptr<UserMetricsRecorder> user_metrics_recorder_;
635  scoped_ptr< ::wm::NestedAcceleratorController> nested_accelerator_controller_;
636  scoped_ptr<AcceleratorController> accelerator_controller_;
637  scoped_ptr<ShellDelegate> delegate_;
638  scoped_ptr<SystemTrayDelegate> system_tray_delegate_;
639  scoped_ptr<SystemTrayNotifier> system_tray_notifier_;
640  scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
641  scoped_ptr<SessionStateDelegate> session_state_delegate_;
642  scoped_ptr<AccessibilityDelegate> accessibility_delegate_;
643  scoped_ptr<NewWindowDelegate> new_window_delegate_;
644  scoped_ptr<MediaDelegate> media_delegate_;
645  scoped_ptr<ShelfDelegate> shelf_delegate_;
646  scoped_ptr<ShelfItemDelegateManager> shelf_item_delegate_manager_;
647  scoped_ptr<ShelfWindowWatcher> shelf_window_watcher_;
648
649  scoped_ptr<ShelfModel> shelf_model_;
650  scoped_ptr<WindowPositioner> window_positioner_;
651
652  scoped_ptr<AppListController> app_list_controller_;
653
654  scoped_ptr<DragDropController> drag_drop_controller_;
655  scoped_ptr<ResizeShadowController> resize_shadow_controller_;
656  scoped_ptr< ::wm::ShadowController> shadow_controller_;
657  scoped_ptr< ::wm::VisibilityController> visibility_controller_;
658  scoped_ptr< ::wm::WindowModalityController> window_modality_controller_;
659  scoped_ptr<views::corewm::TooltipController> tooltip_controller_;
660  scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
661  scoped_ptr<PowerButtonController> power_button_controller_;
662  scoped_ptr<LockStateController> lock_state_controller_;
663  scoped_ptr<MruWindowTracker> mru_window_tracker_;
664  scoped_ptr< ::wm::UserActivityDetector> user_activity_detector_;
665  scoped_ptr<VideoDetector> video_detector_;
666  scoped_ptr<WindowCycleController> window_cycle_controller_;
667  scoped_ptr<WindowSelectorController> window_selector_controller_;
668  scoped_ptr<FocusCycler> focus_cycler_;
669  scoped_ptr<DisplayController> display_controller_;
670  scoped_ptr<VirtualKeyboardController> virtual_keyboard_controller_;
671  scoped_ptr<HighContrastController> high_contrast_controller_;
672  scoped_ptr<MagnificationController> magnification_controller_;
673  scoped_ptr<PartialMagnificationController> partial_magnification_controller_;
674  scoped_ptr<AutoclickController> autoclick_controller_;
675  scoped_ptr<aura::client::FocusClient> focus_client_;
676  aura::client::ActivationClient* activation_client_;
677
678  scoped_ptr<MouseCursorEventFilter> mouse_cursor_filter_;
679  scoped_ptr<ScreenPositionController> screen_position_controller_;
680  scoped_ptr<SystemModalContainerEventFilter> modality_filter_;
681  scoped_ptr<EventClientImpl> event_client_;
682  scoped_ptr<EventTransformationHandler> event_transformation_handler_;
683
684  // An event filter that pre-handles key events while the partial
685  // screenshot UI or the keyboard overlay is active.
686  scoped_ptr<OverlayEventFilter> overlay_filter_;
687
688  // An event filter for logging keyboard-related metrics.
689  scoped_ptr<KeyboardUMAEventFilter> keyboard_metrics_filter_;
690
691  // An event filter which handles moving and resizing windows.
692  scoped_ptr<ToplevelWindowEventHandler> toplevel_window_event_handler_;
693
694  // An event filter which handles system level gestures
695  scoped_ptr<SystemGestureEventFilter> system_gesture_filter_;
696
697  // An event filter that pre-handles global accelerators.
698  scoped_ptr< ::wm::AcceleratorFilter> accelerator_filter_;
699
700  // An event filter that pre-handles all key events to send them to an IME.
701  scoped_ptr< ::wm::InputMethodEventFilter> input_method_filter_;
702
703  scoped_ptr<DisplayManager> display_manager_;
704  scoped_ptr<base::WeakPtrFactory<DisplayManager> >
705      weak_display_manager_factory_;
706
707  scoped_ptr<LocaleNotificationController> locale_notification_controller_;
708
709  scoped_ptr<AccelerometerController> accelerometer_controller_;
710
711#if defined(OS_CHROMEOS)
712  scoped_ptr<PowerEventObserver> power_event_observer_;
713  scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
714  scoped_ptr<VideoActivityNotifier> video_activity_notifier_;
715  scoped_ptr<StickyKeysController> sticky_keys_controller_;
716  scoped_ptr<ResolutionNotificationController>
717      resolution_notification_controller_;
718  scoped_ptr<BluetoothNotificationController>
719      bluetooth_notification_controller_;
720  scoped_ptr<LogoutConfirmationController> logout_confirmation_controller_;
721  scoped_ptr<LastWindowClosedLogoutReminder>
722      last_window_closed_logout_reminder_;
723  // Controls video output device state.
724  scoped_ptr<ui::DisplayConfigurator> display_configurator_;
725  scoped_ptr<DisplayConfiguratorAnimation> display_configurator_animation_;
726  scoped_ptr<DisplayErrorObserver> display_error_observer_;
727  scoped_ptr<ProjectingObserver> projecting_observer_;
728
729  // Listens for output changes and updates the display manager.
730  scoped_ptr<DisplayChangeObserver> display_change_observer_;
731
732#if defined(USE_X11)
733  scoped_ptr<ui::EventHandler> magnifier_key_scroll_handler_;
734  scoped_ptr<ui::EventHandler> speech_feedback_handler_;
735  scoped_ptr<TouchTransformerController> touch_transformer_controller_;
736#endif  // defined(USE_X11)
737#endif  // defined(OS_CHROMEOS)
738
739  scoped_ptr<MaximizeModeController> maximize_mode_controller_;
740
741  // |native_cursor_manager_| is owned by |cursor_manager_|, but we keep a
742  // pointer to vend to test code.
743  AshNativeCursorManager* native_cursor_manager_;
744
745// Cursor may be hidden on certain key events in ChromeOS, whereas we never hide
746// the cursor on Windows.
747#if defined(OS_CHROMEOS)
748  CursorManager cursor_manager_;
749#else  // !defined(OS_CHROMEOS)
750  ::wm::CursorManager cursor_manager_;
751#endif  // defined(OS_CHROMEOS)
752
753  ObserverList<ShellObserver> observers_;
754
755  // For testing only: simulate that a modal window is open
756  bool simulate_modal_window_open_for_testing_;
757
758  bool is_touch_hud_projection_enabled_;
759
760  // Injected content::GPUDataManager support.
761  scoped_ptr<GPUSupport> gpu_support_;
762
763  DISALLOW_COPY_AND_ASSIGN(Shell);
764};
765
766}  // namespace ash
767
768#endif  // ASH_SHELL_H_
769