[email protected] | e0d22e8 | 2012-01-04 00:46:57 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | b65bdda | 2011-12-23 23:35:31 | [diff] [blame] | 5 | #ifndef ASH_SHELL_H_ |
| 6 | #define ASH_SHELL_H_ |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 7 | |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 8 | #include <utility> |
| 9 | #include <vector> |
| 10 | |
[email protected] | b65bdda | 2011-12-23 23:35:31 | [diff] [blame] | 11 | #include "ash/ash_export.h" |
[email protected] | 82d3954ae | 2012-04-20 09:02:22 | [diff] [blame] | 12 | #include "ash/system/user/login_status.h" |
[email protected] | 812d3d4 | 2012-06-27 19:35:31 | [diff] [blame] | 13 | #include "ash/wm/shelf_types.h" |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 14 | #include "base/basictypes.h" |
[email protected] | c45fdc7 | 2012-02-22 22:59:12 | [diff] [blame] | 15 | #include "base/compiler_specific.h" |
[email protected] | b063928 | 2011-12-22 21:12:27 | [diff] [blame] | 16 | #include "base/gtest_prod_util.h" |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 17 | #include "base/memory/scoped_ptr.h" |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 18 | #include "base/observer_list.h" |
[email protected] | 1aad332 | 2012-06-06 06:37:09 | [diff] [blame] | 19 | #include "ui/aura/cursor_delegate.h" |
[email protected] | 2eb6b89 | 2012-05-31 13:28:21 | [diff] [blame] | 20 | #include "ui/gfx/insets.h" |
[email protected] | 9ec0f45 | 2012-05-31 15:58:53 | [diff] [blame] | 21 | #include "ui/gfx/size.h" |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 22 | |
[email protected] | b063928 | 2011-12-22 21:12:27 | [diff] [blame] | 23 | class CommandLine; |
| 24 | |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 25 | namespace aura { |
[email protected] | e29014c | 2011-11-16 18:25:51 | [diff] [blame] | 26 | class EventFilter; |
[email protected] | a857dbe | 2012-05-30 22:10:14 | [diff] [blame] | 27 | class FocusManager; |
[email protected] | 35304ce | 2011-12-14 23:21:01 | [diff] [blame] | 28 | class RootWindow; |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 29 | class Window; |
[email protected] | c2885361 | 2012-05-31 22:43:44 | [diff] [blame] | 30 | namespace client { |
| 31 | class UserActionClient; |
| 32 | } |
[email protected] | 0e46c27 | 2012-05-15 18:15:23 | [diff] [blame] | 33 | namespace shared { |
[email protected] | 1aad332 | 2012-06-06 06:37:09 | [diff] [blame] | 34 | class CompoundEventFilter; |
[email protected] | 0e46c27 | 2012-05-15 18:15:23 | [diff] [blame] | 35 | class InputMethodEventFilter; |
[email protected] | 0e46c27 | 2012-05-15 18:15:23 | [diff] [blame] | 36 | } |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 37 | } |
[email protected] | 70b3e7d5 | 2012-06-02 22:12:25 | [diff] [blame] | 38 | namespace chromeos { |
| 39 | class OutputConfigurator; |
| 40 | } |
[email protected] | fa4a4583 | 2012-04-12 21:32:48 | [diff] [blame] | 41 | namespace content { |
| 42 | class BrowserContext; |
| 43 | } |
| 44 | |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 45 | namespace gfx { |
[email protected] | 9ec0f45 | 2012-05-31 15:58:53 | [diff] [blame] | 46 | class ImageSkia; |
[email protected] | b5f3060 | 2012-01-30 15:16:57 | [diff] [blame] | 47 | class Point; |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 48 | class Rect; |
| 49 | } |
[email protected] | a8bd1cb | 2012-02-17 23:05:54 | [diff] [blame] | 50 | namespace ui { |
| 51 | class Layer; |
| 52 | } |
[email protected] | 57b8bb35 | 2012-01-11 05:11:46 | [diff] [blame] | 53 | namespace views { |
| 54 | class NonClientFrameView; |
| 55 | class Widget; |
| 56 | } |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 57 | |
[email protected] | 55f59335 | 2011-12-24 05:42:46 | [diff] [blame] | 58 | namespace ash { |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 59 | |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 60 | class AcceleratorController; |
[email protected] | e70cf0ed | 2012-03-15 16:24:47 | [diff] [blame] | 61 | class DesktopBackgroundController; |
[email protected] | f48075d | 2012-05-24 11:06:51 | [diff] [blame] | 62 | class HighContrastController; |
[email protected] | 671a2ae | 2011-10-13 21:53:23 | [diff] [blame] | 63 | class Launcher; |
[email protected] | 8f80db0f | 2012-02-07 14:44:53 | [diff] [blame] | 64 | class NestedDispatcherController; |
[email protected] | e0d22e8 | 2012-01-04 00:46:57 | [diff] [blame] | 65 | class PowerButtonController; |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 66 | class ScreenAsh; |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 67 | class ShellDelegate; |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 68 | class ShellObserver; |
[email protected] | bfb41131 | 2012-02-27 20:59:27 | [diff] [blame] | 69 | class SystemTrayDelegate; |
| 70 | class SystemTray; |
[email protected] | c16b942 | 2012-06-06 21:51:11 | [diff] [blame] | 71 | class UserActivityDetector; |
[email protected] | 10b2261 | 2012-03-22 17:07:55 | [diff] [blame] | 72 | class UserWallpaperDelegate; |
[email protected] | 6aa614a | 2012-01-19 22:13:38 | [diff] [blame] | 73 | class VideoDetector; |
[email protected] | 40c4cbb | 2012-01-10 23:26:07 | [diff] [blame] | 74 | class WindowCycleController; |
[email protected] | 60fa9bba | 2011-10-28 21:21:51 | [diff] [blame] | 75 | |
| 76 | namespace internal { |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 77 | class AcceleratorFilter; |
[email protected] | 0039db9 | 2012-05-09 04:11:45 | [diff] [blame] | 78 | class ActivationController; |
| 79 | class AppListController; |
[email protected] | 60a978b7 | 2012-06-08 00:29:18 | [diff] [blame] | 80 | class CaptureController; |
[email protected] | 084b6bb | 2011-11-17 05:18:16 | [diff] [blame] | 81 | class DragDropController; |
[email protected] | b9d224c | 2012-07-13 01:09:03 | [diff] [blame] | 82 | class EventRewriterEventFilter; |
[email protected] | 3d29912a | 2012-02-07 07:41:51 | [diff] [blame] | 83 | class FocusCycler; |
[email protected] | c1c67017 | 2012-04-26 04:20:26 | [diff] [blame] | 84 | class MagnificationController; |
[email protected] | 2e236a5 | 2012-06-27 22:21:47 | [diff] [blame] | 85 | class DisplayController; |
[email protected] | 78d9630 | 2012-06-22 00:58:07 | [diff] [blame] | 86 | class MouseCursorEventFilter; |
[email protected] | 7cf8dd6 | 2012-04-22 05:14:58 | [diff] [blame] | 87 | class PanelLayoutManager; |
[email protected] | 0b0b074 | 2012-02-16 13:23:45 | [diff] [blame] | 88 | class PartialScreenshotEventFilter; |
[email protected] | e4a181cc | 2012-03-17 02:20:57 | [diff] [blame] | 89 | class ResizeShadowController; |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 90 | class RootWindowController; |
[email protected] | b0079a9 | 2012-01-25 20:13:38 | [diff] [blame] | 91 | class RootWindowLayoutManager; |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 92 | class ScreenPositionController; |
[email protected] | a54e65b | 2011-11-21 22:03:34 | [diff] [blame] | 93 | class ShadowController; |
[email protected] | 4e43763 | 2012-02-13 22:39:40 | [diff] [blame] | 94 | class ShelfLayoutManager; |
[email protected] | 0cfc18e | 2012-04-11 18:17:47 | [diff] [blame] | 95 | class ShellContextMenu; |
[email protected] | 9861f175 | 2012-06-01 07:16:14 | [diff] [blame] | 96 | class SlowAnimationEventFilter; |
[email protected] | 435b212e | 2012-04-05 19:43:37 | [diff] [blame] | 97 | class SystemGestureEventFilter; |
[email protected] | ee1e1a2 | 2011-12-15 01:51:10 | [diff] [blame] | 98 | class StackingController; |
[email protected] | 6d6546e | 2012-05-30 23:12:02 | [diff] [blame] | 99 | class StatusAreaWidget; |
[email protected] | 862deef | 2011-12-15 22:07:33 | [diff] [blame] | 100 | class TooltipController; |
[email protected] | 7307474 | 2012-05-17 01:44:41 | [diff] [blame] | 101 | class TouchObserverHUD; |
[email protected] | ddd91e9 | 2012-01-27 16:03:48 | [diff] [blame] | 102 | class VisibilityController; |
[email protected] | 8037357 | 2012-01-06 23:14:30 | [diff] [blame] | 103 | class WindowModalityController; |
[email protected] | 60fa9bba | 2011-10-28 21:21:51 | [diff] [blame] | 104 | class WorkspaceController; |
| 105 | } |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 106 | |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 107 | // Shell is a singleton object that presents the Shell API and implements the |
[email protected] | 99f07e0 | 2011-12-07 00:02:59 | [diff] [blame] | 108 | // RootWindow's delegate interface. |
[email protected] | b0079a9 | 2012-01-25 20:13:38 | [diff] [blame] | 109 | // |
| 110 | // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
| 111 | // takes ownership of the Shell. |
[email protected] | 1aad332 | 2012-06-06 06:37:09 | [diff] [blame] | 112 | class ASH_EXPORT Shell : aura::CursorDelegate { |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 113 | public: |
[email protected] | be65be36 | 2012-06-15 07:38:23 | [diff] [blame] | 114 | typedef std::vector<aura::RootWindow*> RootWindowList; |
| 115 | typedef std::vector<internal::RootWindowController*> RootWindowControllerList; |
| 116 | |
[email protected] | 3d29912a | 2012-02-07 07:41:51 | [diff] [blame] | 117 | enum Direction { |
| 118 | FORWARD, |
| 119 | BACKWARD |
| 120 | }; |
| 121 | |
[email protected] | 2b4cd30 | 2012-02-24 20:21:13 | [diff] [blame] | 122 | // Accesses private data from a Shell for testing. |
| 123 | class ASH_EXPORT TestApi { |
| 124 | public: |
| 125 | explicit TestApi(Shell* shell); |
| 126 | |
[email protected] | 2b4cd30 | 2012-02-24 20:21:13 | [diff] [blame] | 127 | internal::RootWindowLayoutManager* root_window_layout(); |
[email protected] | 0e46c27 | 2012-05-15 18:15:23 | [diff] [blame] | 128 | aura::shared::InputMethodEventFilter* input_method_event_filter(); |
[email protected] | 435b212e | 2012-04-05 19:43:37 | [diff] [blame] | 129 | internal::SystemGestureEventFilter* system_gesture_event_filter(); |
[email protected] | db913160 | 2012-02-29 19:06:32 | [diff] [blame] | 130 | internal::WorkspaceController* workspace_controller(); |
[email protected] | 2b4cd30 | 2012-02-24 20:21:13 | [diff] [blame] | 131 | |
| 132 | private: |
| 133 | Shell* shell_; // not owned |
| 134 | |
| 135 | DISALLOW_COPY_AND_ASSIGN(TestApi); |
| 136 | }; |
| 137 | |
[email protected] | 3266c2b9 | 2011-11-14 00:06:08 | [diff] [blame] | 138 | // A shell must be explicitly created so that it can call |Init()| with the |
| 139 | // delegate set. |delegate| can be NULL (if not required for initialization). |
| 140 | static Shell* CreateInstance(ShellDelegate* delegate); |
| 141 | |
| 142 | // Should never be called before |CreateInstance()|. |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 143 | static Shell* GetInstance(); |
[email protected] | 3266c2b9 | 2011-11-14 00:06:08 | [diff] [blame] | 144 | |
[email protected] | b3b7bcd | 2012-03-06 19:35:45 | [diff] [blame] | 145 | // Returns true if the ash shell has been instantiated. |
| 146 | static bool HasInstance(); |
| 147 | |
[email protected] | ef589af | 2011-12-03 01:07:15 | [diff] [blame] | 148 | static void DeleteInstance(); |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 149 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 150 | // Returns the root window controller for the primary root window. |
| 151 | static internal::RootWindowController* GetPrimaryRootWindowController(); |
| 152 | |
[email protected] | be65be36 | 2012-06-15 07:38:23 | [diff] [blame] | 153 | // Returns all root window controllers. In non extended desktop |
| 154 | // mode, this return a RootWindowController for the primary root window only. |
| 155 | static RootWindowControllerList GetAllRootWindowControllers(); |
| 156 | |
| 157 | // Returns the primary RootWindow. The primary RootWindow is the one |
[email protected] | 42713f7 | 2012-05-25 00:41:50 | [diff] [blame] | 158 | // that has a launcher. |
| 159 | static aura::RootWindow* GetPrimaryRootWindow(); |
[email protected] | e73bd780 | 2012-02-17 20:10:34 | [diff] [blame] | 160 | |
[email protected] | be65be36 | 2012-06-15 07:38:23 | [diff] [blame] | 161 | // Returns the active RootWindow. The active RootWindow is the one that |
[email protected] | a857dbe | 2012-05-30 22:10:14 | [diff] [blame] | 162 | // contains the current active window as a decendant child. The active |
| 163 | // RootWindow remains the same even when the active window becomes NULL, |
| 164 | // until the another window who has a different root window becomes active. |
| 165 | static aura::RootWindow* GetActiveRootWindow(); |
| 166 | |
[email protected] | be65be36 | 2012-06-15 07:38:23 | [diff] [blame] | 167 | // Returns the RootWindow at |point| in the virtual screen coordinates. |
[email protected] | f18e8452 | 2012-06-05 00:34:18 | [diff] [blame] | 168 | // Returns NULL if the root window does not exist at the given |
| 169 | // point. |
| 170 | static aura::RootWindow* GetRootWindowAt(const gfx::Point& point); |
| 171 | |
[email protected] | 20c5976 | 2012-06-23 01:10:24 | [diff] [blame] | 172 | // Returns the RootWindow that shares the most area with |rect| in |
| 173 | // the virtual scren coordinates. |
| 174 | static aura::RootWindow* GetRootWindowMatching(const gfx::Rect& rect); |
| 175 | |
[email protected] | be65be36 | 2012-06-15 07:38:23 | [diff] [blame] | 176 | // Returns all root windows. In non extended desktop mode, this |
| 177 | // returns the primary root window only. |
| 178 | static RootWindowList GetAllRootWindows(); |
| 179 | |
[email protected] | 7b0f750 | 2012-06-11 00:12:39 | [diff] [blame] | 180 | static aura::Window* GetContainer(aura::RootWindow* root_window, |
| 181 | int container_id); |
| 182 | |
| 183 | // Returns the list of containers that match |container_id| in |
| 184 | // all root windows. |
| 185 | static std::vector<aura::Window*> GetAllContainers(int container_id); |
| 186 | |
[email protected] | a857dbe | 2012-05-30 22:10:14 | [diff] [blame] | 187 | void set_active_root_window(aura::RootWindow* active_root_window) { |
| 188 | active_root_window_ = active_root_window; |
| 189 | } |
| 190 | |
[email protected] | 1aad332 | 2012-06-06 06:37:09 | [diff] [blame] | 191 | // Adds or removes |filter| from the aura::Env's CompoundEventFilter. |
| 192 | void AddEnvEventFilter(aura::EventFilter* filter); |
| 193 | void RemoveEnvEventFilter(aura::EventFilter* filter); |
| 194 | size_t GetEnvEventFilterCount() const; |
[email protected] | e29014c | 2011-11-16 18:25:51 | [diff] [blame] | 195 | |
[email protected] | b5f3060 | 2012-01-30 15:16:57 | [diff] [blame] | 196 | // Shows the background menu over |widget|. |
| 197 | void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 198 | |
[email protected] | ae4987d | 2011-11-21 22:52:44 | [diff] [blame] | 199 | // Toggles app list. |
| 200 | void ToggleAppList(); |
| 201 | |
[email protected] | 7510d108 | 2012-03-30 21:58:34 | [diff] [blame] | 202 | // Returns app list target visibility. |
| 203 | bool GetAppListTargetVisibility() const; |
| 204 | |
[email protected] | 1e51a9d | 2012-04-09 23:31:11 | [diff] [blame] | 205 | // Returns app list window or NULL if it is not visible. |
| 206 | aura::Window* GetAppListWindow(); |
| 207 | |
[email protected] | f7eb89c | 2011-12-13 09:48:54 | [diff] [blame] | 208 | // Returns true if the screen is locked. |
| 209 | bool IsScreenLocked() const; |
| 210 | |
[email protected] | 40c4cbb | 2012-01-10 23:26:07 | [diff] [blame] | 211 | // Returns true if a modal dialog window is currently open. |
| 212 | bool IsModalWindowOpen() const; |
| 213 | |
[email protected] | 57b8bb35 | 2012-01-11 05:11:46 | [diff] [blame] | 214 | // Creates a default views::NonClientFrameView for use by windows in the |
| 215 | // Ash environment. |
| 216 | views::NonClientFrameView* CreateDefaultNonClientFrameView( |
| 217 | views::Widget* widget); |
| 218 | |
[email protected] | d9456cb | 2012-03-21 16:41:04 | [diff] [blame] | 219 | // Rotates focus through containers that can receive focus. |
[email protected] | 3d29912a | 2012-02-07 07:41:51 | [diff] [blame] | 220 | void RotateFocus(Direction direction); |
| 221 | |
[email protected] | 2e236a5 | 2012-06-27 22:21:47 | [diff] [blame] | 222 | // Sets the work area insets of the display that contains |window|, |
[email protected] | 8a45c97 | 2012-03-14 18:22:44 | [diff] [blame] | 223 | // this notifies observers too. |
[email protected] | 27f6af6 | 2012-03-21 05:34:40 | [diff] [blame] | 224 | // TODO(sky): this no longer really replicates what happens and is unreliable. |
| 225 | // Remove this. |
[email protected] | 2e236a5 | 2012-06-27 22:21:47 | [diff] [blame] | 226 | void SetDisplayWorkAreaInsets(aura::Window* window, |
[email protected] | 8a45c97 | 2012-03-14 18:22:44 | [diff] [blame] | 227 | const gfx::Insets& insets); |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 228 | |
[email protected] | 82d3954ae | 2012-04-20 09:02:22 | [diff] [blame] | 229 | // Called when the user logs in. |
| 230 | void OnLoginStateChanged(user::LoginStatus status); |
| 231 | |
| 232 | // Called when the application is exiting. |
| 233 | void OnAppTerminating(); |
| 234 | |
| 235 | // Called when the screen is locked (after the lock window is visible) or |
| 236 | // unlocked. |
| 237 | void OnLockStateChanged(bool locked); |
| 238 | |
[email protected] | d9456cb | 2012-03-21 16:41:04 | [diff] [blame] | 239 | // Initializes |launcher_|. Does nothing if it's already initialized. |
| 240 | void CreateLauncher(); |
| 241 | |
[email protected] | 7e1df2f6 | 2012-07-19 19:17:18 | [diff] [blame] | 242 | // Show launcher view if it was created hidden (before session has started). |
| 243 | void ShowLauncher(); |
| 244 | |
[email protected] | d9456cb | 2012-03-21 16:41:04 | [diff] [blame] | 245 | // Adds/removes observer. |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 246 | void AddShellObserver(ShellObserver* observer); |
| 247 | void RemoveShellObserver(ShellObserver* observer); |
| 248 | |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 249 | #if !defined(OS_MACOSX) |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 250 | AcceleratorController* accelerator_controller() { |
[email protected] | 745816be | 2011-11-22 05:08:30 | [diff] [blame] | 251 | return accelerator_controller_.get(); |
| 252 | } |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 253 | #endif // !defined(OS_MACOSX) |
| 254 | |
[email protected] | 1aad332 | 2012-06-06 06:37:09 | [diff] [blame] | 255 | aura::shared::CompoundEventFilter* env_filter() { |
| 256 | return env_filter_; |
[email protected] | 627a62f | 2012-02-14 22:59:14 | [diff] [blame] | 257 | } |
[email protected] | 862deef | 2011-12-15 22:07:33 | [diff] [blame] | 258 | internal::TooltipController* tooltip_controller() { |
| 259 | return tooltip_controller_.get(); |
[email protected] | 4a229e90 | 2011-12-01 21:21:11 | [diff] [blame] | 260 | } |
[email protected] | b9d224c | 2012-07-13 01:09:03 | [diff] [blame] | 261 | internal::EventRewriterEventFilter* event_rewriter_filter() { |
| 262 | return event_rewriter_filter_.get(); |
[email protected] | 42f06f9 | 2012-03-27 00:57:57 | [diff] [blame] | 263 | } |
[email protected] | 0b0b074 | 2012-02-16 13:23:45 | [diff] [blame] | 264 | internal::PartialScreenshotEventFilter* partial_screenshot_filter() { |
| 265 | return partial_screenshot_filter_.get(); |
| 266 | } |
[email protected] | e70cf0ed | 2012-03-15 16:24:47 | [diff] [blame] | 267 | DesktopBackgroundController* desktop_background_controller() { |
| 268 | return desktop_background_controller_.get(); |
| 269 | } |
[email protected] | e0d22e8 | 2012-01-04 00:46:57 | [diff] [blame] | 270 | PowerButtonController* power_button_controller() { |
| 271 | return power_button_controller_.get(); |
| 272 | } |
[email protected] | c16b942 | 2012-06-06 21:51:11 | [diff] [blame] | 273 | UserActivityDetector* user_activity_detector() { |
| 274 | return user_activity_detector_.get(); |
| 275 | } |
[email protected] | 6aa614a | 2012-01-19 22:13:38 | [diff] [blame] | 276 | VideoDetector* video_detector() { |
| 277 | return video_detector_.get(); |
| 278 | } |
[email protected] | 40c4cbb | 2012-01-10 23:26:07 | [diff] [blame] | 279 | WindowCycleController* window_cycle_controller() { |
| 280 | return window_cycle_controller_.get(); |
| 281 | } |
[email protected] | 2d51154 | 2012-03-07 09:13:34 | [diff] [blame] | 282 | internal::FocusCycler* focus_cycler() { |
| 283 | return focus_cycler_.get(); |
| 284 | } |
[email protected] | 2e236a5 | 2012-06-27 22:21:47 | [diff] [blame] | 285 | internal::DisplayController* display_controller() { |
| 286 | return display_controller_.get(); |
[email protected] | 3e1cdd31 | 2012-06-07 03:48:41 | [diff] [blame] | 287 | } |
[email protected] | 4a229e90 | 2011-12-01 21:21:11 | [diff] [blame] | 288 | |
[email protected] | 3266c2b9 | 2011-11-14 00:06:08 | [diff] [blame] | 289 | ShellDelegate* delegate() { return delegate_.get(); } |
[email protected] | aa54218b | 2012-06-12 16:51:42 | [diff] [blame] | 290 | |
[email protected] | 10b2261 | 2012-03-22 17:07:55 | [diff] [blame] | 291 | UserWallpaperDelegate* user_wallpaper_delegate() { |
| 292 | return user_wallpaper_delegate_.get(); |
| 293 | } |
[email protected] | 35304ce | 2011-12-14 23:21:01 | [diff] [blame] | 294 | |
[email protected] | f48075d | 2012-05-24 11:06:51 | [diff] [blame] | 295 | HighContrastController* high_contrast_controller() { |
| 296 | return high_contrast_controller_.get(); |
| 297 | } |
| 298 | |
[email protected] | c1c67017 | 2012-04-26 04:20:26 | [diff] [blame] | 299 | internal::MagnificationController* magnification_controller() { |
| 300 | return magnification_controller_.get(); |
| 301 | } |
[email protected] | f48075d | 2012-05-24 11:06:51 | [diff] [blame] | 302 | |
[email protected] | 671a2ae | 2011-10-13 21:53:23 | [diff] [blame] | 303 | Launcher* launcher() { return launcher_.get(); } |
| 304 | |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 305 | const ScreenAsh* screen() { return screen_; } |
| 306 | |
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 307 | // Force the shelf to query for it's current visibility state. |
| 308 | void UpdateShelfVisibility(); |
| 309 | |
[email protected] | 09f3fc8 | 2012-03-26 23:26:56 | [diff] [blame] | 310 | // Sets/gets the shelf auto-hide behavior. |
| 311 | void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior); |
| 312 | ShelfAutoHideBehavior GetShelfAutoHideBehavior() const; |
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 313 | |
[email protected] | 5544450 | 2012-05-10 15:43:53 | [diff] [blame] | 314 | void SetShelfAlignment(ShelfAlignment alignment); |
| 315 | ShelfAlignment GetShelfAlignment(); |
| 316 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 317 | // Dims or undims the screen. |
| 318 | void SetDimming(bool should_dim); |
| 319 | |
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 320 | // TODO(sky): don't expose this! |
[email protected] | 4e43763 | 2012-02-13 22:39:40 | [diff] [blame] | 321 | internal::ShelfLayoutManager* shelf() const { return shelf_; } |
| 322 | |
[email protected] | 6d6546e | 2012-05-30 23:12:02 | [diff] [blame] | 323 | internal::StatusAreaWidget* status_area_widget() const { |
| 324 | return status_area_widget_; |
| 325 | } |
| 326 | |
[email protected] | aa54218b | 2012-06-12 16:51:42 | [diff] [blame] | 327 | // Convenience accessor for members of StatusAreaWidget. |
| 328 | SystemTrayDelegate* tray_delegate(); |
| 329 | SystemTray* system_tray(); |
[email protected] | bfb41131 | 2012-02-27 20:59:27 | [diff] [blame] | 330 | |
[email protected] | 85d43f0 | 2012-03-14 21:11:19 | [diff] [blame] | 331 | // Returns the size of the grid. |
| 332 | int GetGridSize() const; |
| 333 | |
[email protected] | 9488d4d | 2012-02-29 18:32:37 | [diff] [blame] | 334 | static void set_initially_hide_cursor(bool hide) { |
| 335 | initially_hide_cursor_ = hide; |
| 336 | } |
| 337 | |
[email protected] | e4a181cc | 2012-03-17 02:20:57 | [diff] [blame] | 338 | internal::ResizeShadowController* resize_shadow_controller() { |
| 339 | return resize_shadow_controller_.get(); |
| 340 | } |
| 341 | |
[email protected] | a54e65b | 2011-11-21 22:03:34 | [diff] [blame] | 342 | // Made available for tests. |
| 343 | internal::ShadowController* shadow_controller() { |
| 344 | return shadow_controller_.get(); |
| 345 | } |
| 346 | |
[email protected] | fa4a4583 | 2012-04-12 21:32:48 | [diff] [blame] | 347 | content::BrowserContext* browser_context() { return browser_context_; } |
| 348 | void set_browser_context(content::BrowserContext* browser_context) { |
| 349 | browser_context_ = browser_context; |
| 350 | } |
| 351 | |
[email protected] | 2e236a5 | 2012-06-27 22:21:47 | [diff] [blame] | 352 | // Initializes the root window to be used for a secondary display. |
| 353 | void InitRootWindowForSecondaryDisplay(aura::RootWindow* root); |
[email protected] | a857dbe | 2012-05-30 22:10:14 | [diff] [blame] | 354 | |
[email protected] | 70b3e7d5 | 2012-06-02 22:12:25 | [diff] [blame] | 355 | #if defined(OS_CHROMEOS) |
| 356 | chromeos::OutputConfigurator* output_configurator() { |
| 357 | return output_configurator_.get(); |
| 358 | } |
| 359 | #endif // defined(OS_CHROMEOS) |
| 360 | |
[email protected] | 2b4cd30 | 2012-02-24 20:21:13 | [diff] [blame] | 361 | private: |
[email protected] | c39be8f | 2012-06-15 22:58:36 | [diff] [blame] | 362 | FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor); |
[email protected] | 1aad332 | 2012-06-06 06:37:09 | [diff] [blame] | 363 | FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors); |
| 364 | FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 365 | friend class internal::RootWindowController; |
[email protected] | ad0c872 | 2012-03-02 20:17:45 | [diff] [blame] | 366 | |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 367 | typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; |
| 368 | |
[email protected] | 3266c2b9 | 2011-11-14 00:06:08 | [diff] [blame] | 369 | explicit Shell(ShellDelegate* delegate); |
| 370 | virtual ~Shell(); |
| 371 | |
| 372 | void Init(); |
[email protected] | b063928 | 2011-12-22 21:12:27 | [diff] [blame] | 373 | |
[email protected] | be65be36 | 2012-06-15 07:38:23 | [diff] [blame] | 374 | // Initializes the root window and root window controller so that it |
| 375 | // can host browser windows. |
| 376 | void InitRootWindowController(internal::RootWindowController* root); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 377 | |
| 378 | // Initializes the layout managers and event filters specific for |
| 379 | // primary display. |
| 380 | void InitLayoutManagersForPrimaryDisplay( |
| 381 | internal::RootWindowController* root_window_controller); |
[email protected] | 1b62b89 | 2012-01-17 17:08:15 | [diff] [blame] | 382 | |
[email protected] | ad0c872 | 2012-03-02 20:17:45 | [diff] [blame] | 383 | // Disables the workspace grid layout. |
| 384 | void DisableWorkspaceGridLayout(); |
| 385 | |
[email protected] | 1aad332 | 2012-06-06 06:37:09 | [diff] [blame] | 386 | // aura::CursorManager::Delegate overrides: |
| 387 | virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
| 388 | virtual void ShowCursor(bool visible) OVERRIDE; |
| 389 | |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 390 | static Shell* instance_; |
| 391 | |
[email protected] | 9488d4d | 2012-02-29 18:32:37 | [diff] [blame] | 392 | // If set before the Shell is initialized, the mouse cursor will be hidden |
| 393 | // when the screen is initially created. |
| 394 | static bool initially_hide_cursor_; |
| 395 | |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 396 | ScreenAsh* screen_; |
[email protected] | 58482fa | 2012-03-02 14:57:39 | [diff] [blame] | 397 | |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame^] | 398 | // Active root window. Never becomes NULL during the session. |
[email protected] | a857dbe | 2012-05-30 22:10:14 | [diff] [blame] | 399 | aura::RootWindow* active_root_window_; |
| 400 | |
[email protected] | 1aad332 | 2012-06-06 06:37:09 | [diff] [blame] | 401 | // The CompoundEventFilter owned by aura::Env object. |
| 402 | aura::shared::CompoundEventFilter* env_filter_; |
[email protected] | 627a62f | 2012-02-14 22:59:14 | [diff] [blame] | 403 | |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 404 | std::vector<WindowAndBoundsPair> to_restore_; |
| 405 | |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 406 | #if !defined(OS_MACOSX) |
[email protected] | 8f80db0f | 2012-02-07 14:44:53 | [diff] [blame] | 407 | scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_; |
| 408 | |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 409 | scoped_ptr<AcceleratorController> accelerator_controller_; |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 410 | #endif // !defined(OS_MACOSX) |
[email protected] | 745816be | 2011-11-22 05:08:30 | [diff] [blame] | 411 | |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 412 | scoped_ptr<ShellDelegate> delegate_; |
[email protected] | 10b2261 | 2012-03-22 17:07:55 | [diff] [blame] | 413 | scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_; |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 414 | |
[email protected] | 671a2ae | 2011-10-13 21:53:23 | [diff] [blame] | 415 | scoped_ptr<Launcher> launcher_; |
| 416 | |
[email protected] | 0039db9 | 2012-05-09 04:11:45 | [diff] [blame] | 417 | scoped_ptr<internal::AppListController> app_list_controller_; |
[email protected] | ae4987d | 2011-11-21 22:52:44 | [diff] [blame] | 418 | |
[email protected] | 0cfc18e | 2012-04-11 18:17:47 | [diff] [blame] | 419 | scoped_ptr<internal::ShellContextMenu> shell_context_menu_; |
[email protected] | ee1e1a2 | 2011-12-15 01:51:10 | [diff] [blame] | 420 | scoped_ptr<internal::StackingController> stacking_controller_; |
[email protected] | 9fc206d | 2011-12-13 00:05:33 | [diff] [blame] | 421 | scoped_ptr<internal::ActivationController> activation_controller_; |
[email protected] | 60a978b7 | 2012-06-08 00:29:18 | [diff] [blame] | 422 | scoped_ptr<internal::CaptureController> capture_controller_; |
[email protected] | 8037357 | 2012-01-06 23:14:30 | [diff] [blame] | 423 | scoped_ptr<internal::WindowModalityController> window_modality_controller_; |
[email protected] | 084b6bb | 2011-11-17 05:18:16 | [diff] [blame] | 424 | scoped_ptr<internal::DragDropController> drag_drop_controller_; |
[email protected] | e4a181cc | 2012-03-17 02:20:57 | [diff] [blame] | 425 | scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_; |
[email protected] | a54e65b | 2011-11-21 22:03:34 | [diff] [blame] | 426 | scoped_ptr<internal::ShadowController> shadow_controller_; |
[email protected] | 862deef | 2011-12-15 22:07:33 | [diff] [blame] | 427 | scoped_ptr<internal::TooltipController> tooltip_controller_; |
[email protected] | ddd91e9 | 2012-01-27 16:03:48 | [diff] [blame] | 428 | scoped_ptr<internal::VisibilityController> visibility_controller_; |
[email protected] | e70cf0ed | 2012-03-15 16:24:47 | [diff] [blame] | 429 | scoped_ptr<DesktopBackgroundController> desktop_background_controller_; |
[email protected] | e0d22e8 | 2012-01-04 00:46:57 | [diff] [blame] | 430 | scoped_ptr<PowerButtonController> power_button_controller_; |
[email protected] | c16b942 | 2012-06-06 21:51:11 | [diff] [blame] | 431 | scoped_ptr<UserActivityDetector> user_activity_detector_; |
[email protected] | 6aa614a | 2012-01-19 22:13:38 | [diff] [blame] | 432 | scoped_ptr<VideoDetector> video_detector_; |
[email protected] | 40c4cbb | 2012-01-10 23:26:07 | [diff] [blame] | 433 | scoped_ptr<WindowCycleController> window_cycle_controller_; |
[email protected] | 3d29912a | 2012-02-07 07:41:51 | [diff] [blame] | 434 | scoped_ptr<internal::FocusCycler> focus_cycler_; |
[email protected] | 2e236a5 | 2012-06-27 22:21:47 | [diff] [blame] | 435 | scoped_ptr<internal::DisplayController> display_controller_; |
[email protected] | f48075d | 2012-05-24 11:06:51 | [diff] [blame] | 436 | scoped_ptr<HighContrastController> high_contrast_controller_; |
[email protected] | c1c67017 | 2012-04-26 04:20:26 | [diff] [blame] | 437 | scoped_ptr<internal::MagnificationController> magnification_controller_; |
[email protected] | a857dbe | 2012-05-30 22:10:14 | [diff] [blame] | 438 | scoped_ptr<aura::FocusManager> focus_manager_; |
[email protected] | c2885361 | 2012-05-31 22:43:44 | [diff] [blame] | 439 | scoped_ptr<aura::client::UserActionClient> user_action_client_; |
[email protected] | 78d9630 | 2012-06-22 00:58:07 | [diff] [blame] | 440 | scoped_ptr<internal::MouseCursorEventFilter> mouse_cursor_filter_; |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 441 | scoped_ptr<internal::ScreenPositionController> screen_position_controller_; |
[email protected] | ae18b911 | 2011-11-07 16:59:13 | [diff] [blame] | 442 | |
[email protected] | b9d224c | 2012-07-13 01:09:03 | [diff] [blame] | 443 | // An event filter that rewrites or drops an event. |
| 444 | scoped_ptr<internal::EventRewriterEventFilter> event_rewriter_filter_; |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 445 | |
[email protected] | 0b0b074 | 2012-02-16 13:23:45 | [diff] [blame] | 446 | // An event filter that pre-handles key events while the partial |
| 447 | // screenshot UI is active. |
| 448 | scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_; |
| 449 | |
[email protected] | 435b212e | 2012-04-05 19:43:37 | [diff] [blame] | 450 | // An event filter which handles system level gestures |
| 451 | scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_; |
| 452 | |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 453 | #if !defined(OS_MACOSX) |
[email protected] | 745816be | 2011-11-22 05:08:30 | [diff] [blame] | 454 | // An event filter that pre-handles global accelerators. |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 455 | scoped_ptr<internal::AcceleratorFilter> accelerator_filter_; |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 456 | #endif |
[email protected] | 745816be | 2011-11-22 05:08:30 | [diff] [blame] | 457 | |
[email protected] | 42f06f9 | 2012-03-27 00:57:57 | [diff] [blame] | 458 | // An event filter that pre-handles all key events to send them to an IME. |
[email protected] | 0e46c27 | 2012-05-15 18:15:23 | [diff] [blame] | 459 | scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; |
[email protected] | 42f06f9 | 2012-03-27 00:57:57 | [diff] [blame] | 460 | |
[email protected] | 7307474 | 2012-05-17 01:44:41 | [diff] [blame] | 461 | // An event filter that silently keeps track of all touch events and controls |
| 462 | // a heads-up display. This is enabled only if --ash-touch-hud flag is used. |
| 463 | scoped_ptr<internal::TouchObserverHUD> touch_observer_hud_; |
| 464 | |
[email protected] | 70b3e7d5 | 2012-06-02 22:12:25 | [diff] [blame] | 465 | #if defined(OS_CHROMEOS) |
| 466 | // Controls video output device state. |
| 467 | scoped_ptr<chromeos::OutputConfigurator> output_configurator_; |
| 468 | #endif // defined(OS_CHROMEOS) |
| 469 | |
[email protected] | 4e43763 | 2012-02-13 22:39:40 | [diff] [blame] | 470 | // The shelf for managing the launcher and the status widget in non-compact |
| 471 | // mode. Shell does not own the shelf. Instead, it is owned by container of |
| 472 | // the status area. |
| 473 | internal::ShelfLayoutManager* shelf_; |
| 474 | |
[email protected] | 7cf8dd6 | 2012-04-22 05:14:58 | [diff] [blame] | 475 | // Manages layout of panels. Owned by PanelContainer. |
| 476 | internal::PanelLayoutManager* panel_layout_manager_; |
| 477 | |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 478 | ObserverList<ShellObserver> observers_; |
| 479 | |
[email protected] | 6d6546e | 2012-05-30 23:12:02 | [diff] [blame] | 480 | // Widget containing system tray. |
| 481 | internal::StatusAreaWidget* status_area_widget_; |
| 482 | |
[email protected] | fa4a4583 | 2012-04-12 21:32:48 | [diff] [blame] | 483 | // Used by ash/shell. |
| 484 | content::BrowserContext* browser_context_; |
| 485 | |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 486 | DISALLOW_COPY_AND_ASSIGN(Shell); |
| 487 | }; |
| 488 | |
[email protected] | 55f59335 | 2011-12-24 05:42:46 | [diff] [blame] | 489 | } // namespace ash |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 490 | |
[email protected] | b65bdda | 2011-12-23 23:35:31 | [diff] [blame] | 491 | #endif // ASH_SHELL_H_ |