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