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