[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 | #pragma once |
| 8 | |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 9 | #include <utility> |
| 10 | #include <vector> |
| 11 | |
[email protected] | b65bdda | 2011-12-23 23:35:31 | [diff] [blame] | 12 | #include "ash/ash_export.h" |
[email protected] | 82d3954ae | 2012-04-20 09:02:22 | [diff] [blame] | 13 | #include "ash/system/user/login_status.h" |
[email protected] | 09f3fc8 | 2012-03-26 23:26:56 | [diff] [blame] | 14 | #include "ash/wm/shelf_auto_hide_behavior.h" |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 15 | #include "base/basictypes.h" |
[email protected] | c45fdc7 | 2012-02-22 22:59:12 | [diff] [blame] | 16 | #include "base/compiler_specific.h" |
[email protected] | b063928 | 2011-12-22 21:12:27 | [diff] [blame] | 17 | #include "base/gtest_prod_util.h" |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 18 | #include "base/memory/scoped_ptr.h" |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 19 | #include "base/observer_list.h" |
[email protected] | 0c4011b | 2012-02-11 02:10:42 | [diff] [blame] | 20 | #include "ui/gfx/size.h" |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 21 | #include "ui/gfx/insets.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; |
[email protected] | e70cf0ed | 2012-03-15 16:24:47 | [diff] [blame] | 24 | class SkBitmap; |
[email protected] | b063928 | 2011-12-22 21:12:27 | [diff] [blame] | 25 | |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 26 | namespace aura { |
[email protected] | e29014c | 2011-11-16 18:25:51 | [diff] [blame] | 27 | class EventFilter; |
[email protected] | e050ef14 | 2012-03-21 01:04:24 | [diff] [blame] | 28 | class Monitor; |
[email protected] | 35304ce | 2011-12-14 23:21:01 | [diff] [blame] | 29 | class RootWindow; |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 30 | class Window; |
[email protected] | 0e46c27 | 2012-05-15 18:15:23 | [diff] [blame] | 31 | namespace shared { |
| 32 | class InputMethodEventFilter; |
| 33 | class RootWindowEventFilter; |
| 34 | } |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 35 | } |
[email protected] | fa4a4583 | 2012-04-12 21:32:48 | [diff] [blame] | 36 | namespace content { |
| 37 | class BrowserContext; |
| 38 | } |
| 39 | |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 40 | namespace gfx { |
[email protected] | b5f3060 | 2012-01-30 15:16:57 | [diff] [blame] | 41 | class Point; |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 42 | class Rect; |
| 43 | } |
[email protected] | a8bd1cb | 2012-02-17 23:05:54 | [diff] [blame] | 44 | namespace ui { |
| 45 | class Layer; |
| 46 | } |
[email protected] | 57b8bb35 | 2012-01-11 05:11:46 | [diff] [blame] | 47 | namespace views { |
| 48 | class NonClientFrameView; |
| 49 | class Widget; |
| 50 | } |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 51 | |
[email protected] | 55f59335 | 2011-12-24 05:42:46 | [diff] [blame] | 52 | namespace ash { |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 53 | |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 54 | class AcceleratorController; |
[email protected] | e70cf0ed | 2012-03-15 16:24:47 | [diff] [blame] | 55 | class DesktopBackgroundController; |
[email protected] | 671a2ae | 2011-10-13 21:53:23 | [diff] [blame] | 56 | class Launcher; |
[email protected] | 8f80db0f | 2012-02-07 14:44:53 | [diff] [blame] | 57 | class NestedDispatcherController; |
[email protected] | e0d22e8 | 2012-01-04 00:46:57 | [diff] [blame] | 58 | class PowerButtonController; |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 59 | class ScreenAsh; |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 60 | class ShellDelegate; |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 61 | class ShellObserver; |
[email protected] | bfb41131 | 2012-02-27 20:59:27 | [diff] [blame] | 62 | class SystemTrayDelegate; |
| 63 | class SystemTray; |
[email protected] | 10b2261 | 2012-03-22 17:07:55 | [diff] [blame] | 64 | class UserWallpaperDelegate; |
[email protected] | 6aa614a | 2012-01-19 22:13:38 | [diff] [blame] | 65 | class VideoDetector; |
[email protected] | 40c4cbb | 2012-01-10 23:26:07 | [diff] [blame] | 66 | class WindowCycleController; |
[email protected] | 60fa9bba | 2011-10-28 21:21:51 | [diff] [blame] | 67 | |
| 68 | namespace internal { |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 69 | class AcceleratorFilter; |
[email protected] | 0039db9 | 2012-05-09 04:11:45 | [diff] [blame] | 70 | class ActivationController; |
| 71 | class AppListController; |
[email protected] | 084b6bb | 2011-11-17 05:18:16 | [diff] [blame] | 72 | class DragDropController; |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 73 | class EventClientImpl; |
[email protected] | 3d29912a | 2012-02-07 07:41:51 | [diff] [blame] | 74 | class FocusCycler; |
[email protected] | 42f06f9 | 2012-03-27 00:57:57 | [diff] [blame] | 75 | class KeyRewriterEventFilter; |
[email protected] | c1c67017 | 2012-04-26 04:20:26 | [diff] [blame] | 76 | class MagnificationController; |
[email protected] | e050ef14 | 2012-03-21 01:04:24 | [diff] [blame] | 77 | class MonitorController; |
[email protected] | 7cf8dd6 | 2012-04-22 05:14:58 | [diff] [blame] | 78 | class PanelLayoutManager; |
[email protected] | 0b0b074 | 2012-02-16 13:23:45 | [diff] [blame] | 79 | class PartialScreenshotEventFilter; |
[email protected] | e4a181cc | 2012-03-17 02:20:57 | [diff] [blame] | 80 | class ResizeShadowController; |
[email protected] | b0079a9 | 2012-01-25 20:13:38 | [diff] [blame] | 81 | class RootWindowLayoutManager; |
[email protected] | 4299321 | 2012-04-30 23:42:04 | [diff] [blame] | 82 | class ScreenDimmer; |
[email protected] | a54e65b | 2011-11-21 22:03:34 | [diff] [blame] | 83 | class ShadowController; |
[email protected] | 4e43763 | 2012-02-13 22:39:40 | [diff] [blame] | 84 | class ShelfLayoutManager; |
[email protected] | 0cfc18e | 2012-04-11 18:17:47 | [diff] [blame] | 85 | class ShellContextMenu; |
[email protected] | 435b212e | 2012-04-05 19:43:37 | [diff] [blame] | 86 | class SystemGestureEventFilter; |
[email protected] | ee1e1a2 | 2011-12-15 01:51:10 | [diff] [blame] | 87 | class StackingController; |
[email protected] | 862deef | 2011-12-15 22:07:33 | [diff] [blame] | 88 | class TooltipController; |
[email protected] | 7307474 | 2012-05-17 01:44:41 | [diff] [blame^] | 89 | class TouchObserverHUD; |
[email protected] | ddd91e9 | 2012-01-27 16:03:48 | [diff] [blame] | 90 | class VisibilityController; |
[email protected] | 8037357 | 2012-01-06 23:14:30 | [diff] [blame] | 91 | class WindowModalityController; |
[email protected] | 60fa9bba | 2011-10-28 21:21:51 | [diff] [blame] | 92 | class WorkspaceController; |
| 93 | } |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 94 | |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 95 | // Shell is a singleton object that presents the Shell API and implements the |
[email protected] | 99f07e0 | 2011-12-07 00:02:59 | [diff] [blame] | 96 | // RootWindow's delegate interface. |
[email protected] | b0079a9 | 2012-01-25 20:13:38 | [diff] [blame] | 97 | // |
| 98 | // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
| 99 | // takes ownership of the Shell. |
[email protected] | e050ef14 | 2012-03-21 01:04:24 | [diff] [blame] | 100 | class ASH_EXPORT Shell { |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 101 | public: |
[email protected] | 3d29912a | 2012-02-07 07:41:51 | [diff] [blame] | 102 | enum Direction { |
| 103 | FORWARD, |
| 104 | BACKWARD |
| 105 | }; |
| 106 | |
[email protected] | 2b4cd30 | 2012-02-24 20:21:13 | [diff] [blame] | 107 | // Accesses private data from a Shell for testing. |
| 108 | class ASH_EXPORT TestApi { |
| 109 | public: |
| 110 | explicit TestApi(Shell* shell); |
| 111 | |
[email protected] | 2b4cd30 | 2012-02-24 20:21:13 | [diff] [blame] | 112 | internal::RootWindowLayoutManager* root_window_layout(); |
[email protected] | 0e46c27 | 2012-05-15 18:15:23 | [diff] [blame] | 113 | aura::shared::InputMethodEventFilter* input_method_event_filter(); |
[email protected] | 435b212e | 2012-04-05 19:43:37 | [diff] [blame] | 114 | internal::SystemGestureEventFilter* system_gesture_event_filter(); |
[email protected] | db913160 | 2012-02-29 19:06:32 | [diff] [blame] | 115 | internal::WorkspaceController* workspace_controller(); |
[email protected] | 2b4cd30 | 2012-02-24 20:21:13 | [diff] [blame] | 116 | |
| 117 | private: |
| 118 | Shell* shell_; // not owned |
| 119 | |
| 120 | DISALLOW_COPY_AND_ASSIGN(TestApi); |
| 121 | }; |
| 122 | |
[email protected] | 3266c2b9 | 2011-11-14 00:06:08 | [diff] [blame] | 123 | // A shell must be explicitly created so that it can call |Init()| with the |
| 124 | // delegate set. |delegate| can be NULL (if not required for initialization). |
| 125 | static Shell* CreateInstance(ShellDelegate* delegate); |
| 126 | |
| 127 | // Should never be called before |CreateInstance()|. |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 128 | static Shell* GetInstance(); |
[email protected] | 3266c2b9 | 2011-11-14 00:06:08 | [diff] [blame] | 129 | |
[email protected] | b3b7bcd | 2012-03-06 19:35:45 | [diff] [blame] | 130 | // Returns true if the ash shell has been instantiated. |
| 131 | static bool HasInstance(); |
| 132 | |
[email protected] | ef589af | 2011-12-03 01:07:15 | [diff] [blame] | 133 | static void DeleteInstance(); |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 134 | |
[email protected] | d9456cb | 2012-03-21 16:41:04 | [diff] [blame] | 135 | // Gets the singleton RootWindow used by the Shell. |
[email protected] | e73bd780 | 2012-02-17 20:10:34 | [diff] [blame] | 136 | static aura::RootWindow* GetRootWindow(); |
| 137 | |
[email protected] | e70cf0ed | 2012-03-15 16:24:47 | [diff] [blame] | 138 | internal::RootWindowLayoutManager* root_window_layout() const { |
| 139 | return root_window_layout_; |
[email protected] | a8bd1cb | 2012-02-17 23:05:54 | [diff] [blame] | 140 | } |
| 141 | |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 142 | aura::Window* GetContainer(int container_id); |
| 143 | const aura::Window* GetContainer(int container_id) const; |
| 144 | |
[email protected] | 99f07e0 | 2011-12-07 00:02:59 | [diff] [blame] | 145 | // Adds or removes |filter| from the RootWindowEventFilter. |
| 146 | void AddRootWindowEventFilter(aura::EventFilter* filter); |
| 147 | void RemoveRootWindowEventFilter(aura::EventFilter* filter); |
[email protected] | 2c45610 | 2011-12-26 06:26:34 | [diff] [blame] | 148 | size_t GetRootWindowEventFilterCount() const; |
[email protected] | e29014c | 2011-11-16 18:25:51 | [diff] [blame] | 149 | |
[email protected] | b5f3060 | 2012-01-30 15:16:57 | [diff] [blame] | 150 | // Shows the background menu over |widget|. |
| 151 | void ShowBackgroundMenu(views::Widget* widget, const gfx::Point& location); |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 152 | |
[email protected] | ae4987d | 2011-11-21 22:52:44 | [diff] [blame] | 153 | // Toggles app list. |
| 154 | void ToggleAppList(); |
| 155 | |
[email protected] | 7510d108 | 2012-03-30 21:58:34 | [diff] [blame] | 156 | // Returns app list target visibility. |
| 157 | bool GetAppListTargetVisibility() const; |
| 158 | |
[email protected] | 1e51a9d | 2012-04-09 23:31:11 | [diff] [blame] | 159 | // Returns app list window or NULL if it is not visible. |
| 160 | aura::Window* GetAppListWindow(); |
| 161 | |
[email protected] | f7eb89c | 2011-12-13 09:48:54 | [diff] [blame] | 162 | // Returns true if the screen is locked. |
| 163 | bool IsScreenLocked() const; |
| 164 | |
[email protected] | 40c4cbb | 2012-01-10 23:26:07 | [diff] [blame] | 165 | // Returns true if a modal dialog window is currently open. |
| 166 | bool IsModalWindowOpen() const; |
| 167 | |
[email protected] | 57b8bb35 | 2012-01-11 05:11:46 | [diff] [blame] | 168 | // Creates a default views::NonClientFrameView for use by windows in the |
| 169 | // Ash environment. |
| 170 | views::NonClientFrameView* CreateDefaultNonClientFrameView( |
| 171 | views::Widget* widget); |
| 172 | |
[email protected] | d9456cb | 2012-03-21 16:41:04 | [diff] [blame] | 173 | // Rotates focus through containers that can receive focus. |
[email protected] | 3d29912a | 2012-02-07 07:41:51 | [diff] [blame] | 174 | void RotateFocus(Direction direction); |
| 175 | |
[email protected] | 8a45c97 | 2012-03-14 18:22:44 | [diff] [blame] | 176 | // Sets the work area insets of the monitor that contains |window|, |
| 177 | // this notifies observers too. |
[email protected] | 27f6af6 | 2012-03-21 05:34:40 | [diff] [blame] | 178 | // TODO(sky): this no longer really replicates what happens and is unreliable. |
| 179 | // Remove this. |
[email protected] | 8a45c97 | 2012-03-14 18:22:44 | [diff] [blame] | 180 | void SetMonitorWorkAreaInsets(aura::Window* window, |
| 181 | const gfx::Insets& insets); |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 182 | |
[email protected] | 82d3954ae | 2012-04-20 09:02:22 | [diff] [blame] | 183 | // Called when the user logs in. |
| 184 | void OnLoginStateChanged(user::LoginStatus status); |
| 185 | |
| 186 | // Called when the application is exiting. |
| 187 | void OnAppTerminating(); |
| 188 | |
| 189 | // Called when the screen is locked (after the lock window is visible) or |
| 190 | // unlocked. |
| 191 | void OnLockStateChanged(bool locked); |
| 192 | |
[email protected] | d9456cb | 2012-03-21 16:41:04 | [diff] [blame] | 193 | // Initializes |launcher_|. Does nothing if it's already initialized. |
| 194 | void CreateLauncher(); |
| 195 | |
| 196 | // Adds/removes observer. |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 197 | void AddShellObserver(ShellObserver* observer); |
| 198 | void RemoveShellObserver(ShellObserver* observer); |
| 199 | |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 200 | #if !defined(OS_MACOSX) |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 201 | AcceleratorController* accelerator_controller() { |
[email protected] | 745816be | 2011-11-22 05:08:30 | [diff] [blame] | 202 | return accelerator_controller_.get(); |
| 203 | } |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 204 | #endif // !defined(OS_MACOSX) |
| 205 | |
[email protected] | 0e46c27 | 2012-05-15 18:15:23 | [diff] [blame] | 206 | aura::shared::RootWindowEventFilter* root_filter() { |
[email protected] | 627a62f | 2012-02-14 22:59:14 | [diff] [blame] | 207 | return root_filter_; |
| 208 | } |
[email protected] | 862deef | 2011-12-15 22:07:33 | [diff] [blame] | 209 | internal::TooltipController* tooltip_controller() { |
| 210 | return tooltip_controller_.get(); |
[email protected] | 4a229e90 | 2011-12-01 21:21:11 | [diff] [blame] | 211 | } |
[email protected] | 42f06f9 | 2012-03-27 00:57:57 | [diff] [blame] | 212 | internal::KeyRewriterEventFilter* key_rewriter_filter() { |
| 213 | return key_rewriter_filter_.get(); |
| 214 | } |
[email protected] | 0b0b074 | 2012-02-16 13:23:45 | [diff] [blame] | 215 | internal::PartialScreenshotEventFilter* partial_screenshot_filter() { |
| 216 | return partial_screenshot_filter_.get(); |
| 217 | } |
[email protected] | e70cf0ed | 2012-03-15 16:24:47 | [diff] [blame] | 218 | DesktopBackgroundController* desktop_background_controller() { |
| 219 | return desktop_background_controller_.get(); |
| 220 | } |
[email protected] | e0d22e8 | 2012-01-04 00:46:57 | [diff] [blame] | 221 | PowerButtonController* power_button_controller() { |
| 222 | return power_button_controller_.get(); |
| 223 | } |
[email protected] | 6aa614a | 2012-01-19 22:13:38 | [diff] [blame] | 224 | VideoDetector* video_detector() { |
| 225 | return video_detector_.get(); |
| 226 | } |
[email protected] | 40c4cbb | 2012-01-10 23:26:07 | [diff] [blame] | 227 | WindowCycleController* window_cycle_controller() { |
| 228 | return window_cycle_controller_.get(); |
| 229 | } |
[email protected] | 2d51154 | 2012-03-07 09:13:34 | [diff] [blame] | 230 | internal::FocusCycler* focus_cycler() { |
| 231 | return focus_cycler_.get(); |
| 232 | } |
[email protected] | 4a229e90 | 2011-12-01 21:21:11 | [diff] [blame] | 233 | |
[email protected] | 3266c2b9 | 2011-11-14 00:06:08 | [diff] [blame] | 234 | ShellDelegate* delegate() { return delegate_.get(); } |
[email protected] | bfb41131 | 2012-02-27 20:59:27 | [diff] [blame] | 235 | SystemTrayDelegate* tray_delegate() { return tray_delegate_.get(); } |
[email protected] | 10b2261 | 2012-03-22 17:07:55 | [diff] [blame] | 236 | UserWallpaperDelegate* user_wallpaper_delegate() { |
| 237 | return user_wallpaper_delegate_.get(); |
| 238 | } |
[email protected] | 35304ce | 2011-12-14 23:21:01 | [diff] [blame] | 239 | |
[email protected] | c1c67017 | 2012-04-26 04:20:26 | [diff] [blame] | 240 | internal::MagnificationController* magnification_controller() { |
| 241 | return magnification_controller_.get(); |
| 242 | } |
[email protected] | 4299321 | 2012-04-30 23:42:04 | [diff] [blame] | 243 | internal::ScreenDimmer* screen_dimmer() { |
| 244 | return screen_dimmer_.get(); |
| 245 | } |
[email protected] | c1c67017 | 2012-04-26 04:20:26 | [diff] [blame] | 246 | |
[email protected] | 671a2ae | 2011-10-13 21:53:23 | [diff] [blame] | 247 | Launcher* launcher() { return launcher_.get(); } |
| 248 | |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 249 | const ScreenAsh* screen() { return screen_; } |
| 250 | |
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 251 | // Force the shelf to query for it's current visibility state. |
| 252 | void UpdateShelfVisibility(); |
| 253 | |
[email protected] | 09f3fc8 | 2012-03-26 23:26:56 | [diff] [blame] | 254 | // Sets/gets the shelf auto-hide behavior. |
| 255 | void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior); |
| 256 | ShelfAutoHideBehavior GetShelfAutoHideBehavior() const; |
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 257 | |
[email protected] | 5544450 | 2012-05-10 15:43:53 | [diff] [blame] | 258 | void SetShelfAlignment(ShelfAlignment alignment); |
| 259 | ShelfAlignment GetShelfAlignment(); |
| 260 | |
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 261 | // TODO(sky): don't expose this! |
[email protected] | 4e43763 | 2012-02-13 22:39:40 | [diff] [blame] | 262 | internal::ShelfLayoutManager* shelf() const { return shelf_; } |
| 263 | |
[email protected] | bfb41131 | 2012-02-27 20:59:27 | [diff] [blame] | 264 | SystemTray* tray() const { return tray_.get(); } |
| 265 | |
[email protected] | 85d43f0 | 2012-03-14 21:11:19 | [diff] [blame] | 266 | // Returns the size of the grid. |
| 267 | int GetGridSize() const; |
| 268 | |
[email protected] | 9628e0af | 2012-04-12 20:40:56 | [diff] [blame] | 269 | // Returns true if in maximized or fullscreen mode. |
| 270 | bool IsInMaximizedMode() const; |
| 271 | |
[email protected] | 9488d4d | 2012-02-29 18:32:37 | [diff] [blame] | 272 | static void set_initially_hide_cursor(bool hide) { |
| 273 | initially_hide_cursor_ = hide; |
| 274 | } |
| 275 | |
[email protected] | e4a181cc | 2012-03-17 02:20:57 | [diff] [blame] | 276 | internal::ResizeShadowController* resize_shadow_controller() { |
| 277 | return resize_shadow_controller_.get(); |
| 278 | } |
| 279 | |
[email protected] | a54e65b | 2011-11-21 22:03:34 | [diff] [blame] | 280 | // Made available for tests. |
| 281 | internal::ShadowController* shadow_controller() { |
| 282 | return shadow_controller_.get(); |
| 283 | } |
| 284 | |
[email protected] | fa4a4583 | 2012-04-12 21:32:48 | [diff] [blame] | 285 | content::BrowserContext* browser_context() { return browser_context_; } |
| 286 | void set_browser_context(content::BrowserContext* browser_context) { |
| 287 | browser_context_ = browser_context; |
| 288 | } |
| 289 | |
[email protected] | 2b4cd30 | 2012-02-24 20:21:13 | [diff] [blame] | 290 | private: |
[email protected] | ad0c872 | 2012-03-02 20:17:45 | [diff] [blame] | 291 | FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, MouseEventCursors); |
| 292 | FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, TransformActivate); |
| 293 | |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 294 | typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; |
| 295 | |
[email protected] | 3266c2b9 | 2011-11-14 00:06:08 | [diff] [blame] | 296 | explicit Shell(ShellDelegate* delegate); |
| 297 | virtual ~Shell(); |
| 298 | |
| 299 | void Init(); |
[email protected] | b063928 | 2011-12-22 21:12:27 | [diff] [blame] | 300 | |
[email protected] | c73d133 | 2012-03-08 17:11:04 | [diff] [blame] | 301 | // Initializes the layout managers and event filters. |
| 302 | void InitLayoutManagers(); |
[email protected] | 1b62b89 | 2012-01-17 17:08:15 | [diff] [blame] | 303 | |
[email protected] | ad0c872 | 2012-03-02 20:17:45 | [diff] [blame] | 304 | // Disables the workspace grid layout. |
| 305 | void DisableWorkspaceGridLayout(); |
| 306 | |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 307 | static Shell* instance_; |
| 308 | |
[email protected] | 9488d4d | 2012-02-29 18:32:37 | [diff] [blame] | 309 | // If set before the Shell is initialized, the mouse cursor will be hidden |
| 310 | // when the screen is initially created. |
| 311 | static bool initially_hide_cursor_; |
| 312 | |
[email protected] | 58482fa | 2012-03-02 14:57:39 | [diff] [blame] | 313 | scoped_ptr<aura::RootWindow> root_window_; |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 314 | ScreenAsh* screen_; |
[email protected] | 58482fa | 2012-03-02 14:57:39 | [diff] [blame] | 315 | |
[email protected] | 0e46c27 | 2012-05-15 18:15:23 | [diff] [blame] | 316 | aura::shared::RootWindowEventFilter* root_filter_; // not owned |
[email protected] | 627a62f | 2012-02-14 22:59:14 | [diff] [blame] | 317 | |
[email protected] | cac10fc6 | 2011-10-07 23:22:56 | [diff] [blame] | 318 | std::vector<WindowAndBoundsPair> to_restore_; |
| 319 | |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 320 | #if !defined(OS_MACOSX) |
[email protected] | 8f80db0f | 2012-02-07 14:44:53 | [diff] [blame] | 321 | scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_; |
| 322 | |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 323 | scoped_ptr<AcceleratorController> accelerator_controller_; |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 324 | #endif // !defined(OS_MACOSX) |
[email protected] | 745816be | 2011-11-22 05:08:30 | [diff] [blame] | 325 | |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 326 | scoped_ptr<ShellDelegate> delegate_; |
[email protected] | bfb41131 | 2012-02-27 20:59:27 | [diff] [blame] | 327 | scoped_ptr<SystemTrayDelegate> tray_delegate_; |
[email protected] | 10b2261 | 2012-03-22 17:07:55 | [diff] [blame] | 328 | scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_; |
[email protected] | 2b99f8c | 2011-10-11 19:42:24 | [diff] [blame] | 329 | |
[email protected] | 671a2ae | 2011-10-13 21:53:23 | [diff] [blame] | 330 | scoped_ptr<Launcher> launcher_; |
| 331 | |
[email protected] | 0039db9 | 2012-05-09 04:11:45 | [diff] [blame] | 332 | scoped_ptr<internal::AppListController> app_list_controller_; |
[email protected] | ae4987d | 2011-11-21 22:52:44 | [diff] [blame] | 333 | |
[email protected] | 0cfc18e | 2012-04-11 18:17:47 | [diff] [blame] | 334 | scoped_ptr<internal::ShellContextMenu> shell_context_menu_; |
[email protected] | ee1e1a2 | 2011-12-15 01:51:10 | [diff] [blame] | 335 | scoped_ptr<internal::StackingController> stacking_controller_; |
[email protected] | 9fc206d | 2011-12-13 00:05:33 | [diff] [blame] | 336 | scoped_ptr<internal::ActivationController> activation_controller_; |
[email protected] | 8037357 | 2012-01-06 23:14:30 | [diff] [blame] | 337 | scoped_ptr<internal::WindowModalityController> window_modality_controller_; |
[email protected] | 084b6bb | 2011-11-17 05:18:16 | [diff] [blame] | 338 | scoped_ptr<internal::DragDropController> drag_drop_controller_; |
[email protected] | 60fa9bba | 2011-10-28 21:21:51 | [diff] [blame] | 339 | scoped_ptr<internal::WorkspaceController> workspace_controller_; |
[email protected] | e4a181cc | 2012-03-17 02:20:57 | [diff] [blame] | 340 | scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_; |
[email protected] | a54e65b | 2011-11-21 22:03:34 | [diff] [blame] | 341 | scoped_ptr<internal::ShadowController> shadow_controller_; |
[email protected] | 862deef | 2011-12-15 22:07:33 | [diff] [blame] | 342 | scoped_ptr<internal::TooltipController> tooltip_controller_; |
[email protected] | ddd91e9 | 2012-01-27 16:03:48 | [diff] [blame] | 343 | scoped_ptr<internal::VisibilityController> visibility_controller_; |
[email protected] | e70cf0ed | 2012-03-15 16:24:47 | [diff] [blame] | 344 | scoped_ptr<DesktopBackgroundController> desktop_background_controller_; |
[email protected] | e0d22e8 | 2012-01-04 00:46:57 | [diff] [blame] | 345 | scoped_ptr<PowerButtonController> power_button_controller_; |
[email protected] | 6aa614a | 2012-01-19 22:13:38 | [diff] [blame] | 346 | scoped_ptr<VideoDetector> video_detector_; |
[email protected] | 40c4cbb | 2012-01-10 23:26:07 | [diff] [blame] | 347 | scoped_ptr<WindowCycleController> window_cycle_controller_; |
[email protected] | 3d29912a | 2012-02-07 07:41:51 | [diff] [blame] | 348 | scoped_ptr<internal::FocusCycler> focus_cycler_; |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 349 | scoped_ptr<internal::EventClientImpl> event_client_; |
[email protected] | e050ef14 | 2012-03-21 01:04:24 | [diff] [blame] | 350 | scoped_ptr<internal::MonitorController> monitor_controller_; |
[email protected] | c1c67017 | 2012-04-26 04:20:26 | [diff] [blame] | 351 | scoped_ptr<internal::MagnificationController> magnification_controller_; |
[email protected] | 4299321 | 2012-04-30 23:42:04 | [diff] [blame] | 352 | scoped_ptr<internal::ScreenDimmer> screen_dimmer_; |
[email protected] | ae18b911 | 2011-11-07 16:59:13 | [diff] [blame] | 353 | |
[email protected] | 42f06f9 | 2012-03-27 00:57:57 | [diff] [blame] | 354 | // An event filter that rewrites or drops a key event. |
| 355 | scoped_ptr<internal::KeyRewriterEventFilter> key_rewriter_filter_; |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 356 | |
[email protected] | 0b0b074 | 2012-02-16 13:23:45 | [diff] [blame] | 357 | // An event filter that pre-handles key events while the partial |
| 358 | // screenshot UI is active. |
| 359 | scoped_ptr<internal::PartialScreenshotEventFilter> partial_screenshot_filter_; |
| 360 | |
[email protected] | 435b212e | 2012-04-05 19:43:37 | [diff] [blame] | 361 | // An event filter which handles system level gestures |
| 362 | scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_; |
| 363 | |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 364 | #if !defined(OS_MACOSX) |
[email protected] | 745816be | 2011-11-22 05:08:30 | [diff] [blame] | 365 | // An event filter that pre-handles global accelerators. |
[email protected] | 2f74428 | 2011-12-23 22:40:52 | [diff] [blame] | 366 | scoped_ptr<internal::AcceleratorFilter> accelerator_filter_; |
[email protected] | 6e9f6aa | 2012-02-09 04:16:20 | [diff] [blame] | 367 | #endif |
[email protected] | 745816be | 2011-11-22 05:08:30 | [diff] [blame] | 368 | |
[email protected] | 42f06f9 | 2012-03-27 00:57:57 | [diff] [blame] | 369 | // 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] | 370 | scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; |
[email protected] | 42f06f9 | 2012-03-27 00:57:57 | [diff] [blame] | 371 | |
[email protected] | 7307474 | 2012-05-17 01:44:41 | [diff] [blame^] | 372 | // An event filter that silently keeps track of all touch events and controls |
| 373 | // a heads-up display. This is enabled only if --ash-touch-hud flag is used. |
| 374 | scoped_ptr<internal::TouchObserverHUD> touch_observer_hud_; |
| 375 | |
[email protected] | 4e43763 | 2012-02-13 22:39:40 | [diff] [blame] | 376 | // The shelf for managing the launcher and the status widget in non-compact |
| 377 | // mode. Shell does not own the shelf. Instead, it is owned by container of |
| 378 | // the status area. |
| 379 | internal::ShelfLayoutManager* shelf_; |
| 380 | |
[email protected] | 7cf8dd6 | 2012-04-22 05:14:58 | [diff] [blame] | 381 | // Manages layout of panels. Owned by PanelContainer. |
| 382 | internal::PanelLayoutManager* panel_layout_manager_; |
| 383 | |
[email protected] | 1a2145b | 2012-03-13 21:09:17 | [diff] [blame] | 384 | ObserverList<ShellObserver> observers_; |
| 385 | |
[email protected] | b0079a9 | 2012-01-25 20:13:38 | [diff] [blame] | 386 | // Owned by aura::RootWindow, cached here for type safety. |
| 387 | internal::RootWindowLayoutManager* root_window_layout_; |
| 388 | |
[email protected] | 860f594 | 2012-04-24 16:11:39 | [diff] [blame] | 389 | // System tray with clock, Wi-Fi signal, etc. |
[email protected] | bfb41131 | 2012-02-27 20:59:27 | [diff] [blame] | 390 | scoped_ptr<SystemTray> tray_; |
| 391 | |
[email protected] | fa4a4583 | 2012-04-12 21:32:48 | [diff] [blame] | 392 | // Used by ash/shell. |
| 393 | content::BrowserContext* browser_context_; |
| 394 | |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 395 | DISALLOW_COPY_AND_ASSIGN(Shell); |
| 396 | }; |
| 397 | |
[email protected] | 55f59335 | 2011-12-24 05:42:46 | [diff] [blame] | 398 | } // namespace ash |
[email protected] | 87b0d82e | 2011-10-07 21:02:59 | [diff] [blame] | 399 | |
[email protected] | b65bdda | 2011-12-23 23:35:31 | [diff] [blame] | 400 | #endif // ASH_SHELL_H_ |