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