blob: 06221304c3a0e7d81ace4834a20f7afd70bf5d82 [file] [log] [blame]
[email protected]e0d22e82012-01-04 00:46:571// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]87b0d82e2011-10-07 21:02:592// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]b65bdda2011-12-23 23:35:315#ifndef ASH_SHELL_H_
6#define ASH_SHELL_H_
[email protected]87b0d82e2011-10-07 21:02:597
[email protected]cac10fc62011-10-07 23:22:568#include <utility>
9#include <vector>
10
[email protected]b65bdda2011-12-23 23:35:3111#include "ash/ash_export.h"
[email protected]82d3954ae2012-04-20 09:02:2212#include "ash/system/user/login_status.h"
[email protected]4b8003c2012-07-26 00:54:1913#include "ash/wm/cursor_manager.h"
[email protected]812d3d42012-06-27 19:35:3114#include "ash/wm/shelf_types.h"
[email protected]c0ce80e2012-10-05 23:28:2715#include "ash/wm/system_modal_container_event_filter_delegate.h"
[email protected]87b0d82e2011-10-07 21:02:5916#include "base/basictypes.h"
[email protected]c45fdc72012-02-22 22:59:1217#include "base/compiler_specific.h"
[email protected]b0639282011-12-22 21:12:2718#include "base/gtest_prod_util.h"
[email protected]2b99f8c2011-10-11 19:42:2419#include "base/memory/scoped_ptr.h"
[email protected]1a2145b2012-03-13 21:09:1720#include "base/observer_list.h"
[email protected]5097e692012-10-30 22:08:4121#include "ui/base/events/event_target.h"
[email protected]2eb6b892012-05-31 13:28:2122#include "ui/gfx/insets.h"
[email protected]ffabb1e2012-10-12 19:51:1723#include "ui/gfx/screen.h"
[email protected]9ec0f452012-05-31 15:58:5324#include "ui/gfx/size.h"
[email protected]87b0d82e2011-10-07 21:02:5925
[email protected]b0639282011-12-22 21:12:2726class CommandLine;
27
[email protected]87b0d82e2011-10-07 21:02:5928namespace aura {
[email protected]e29014c2011-11-16 18:25:5129class EventFilter;
[email protected]a857dbe2012-05-30 22:10:1430class FocusManager;
[email protected]35304ce2011-12-14 23:21:0131class RootWindow;
[email protected]87b0d82e2011-10-07 21:02:5932class Window;
[email protected]c28853612012-05-31 22:43:4433namespace client {
34class UserActionClient;
35}
[email protected]0e46c272012-05-15 18:15:2336namespace shared {
[email protected]1aad3322012-06-06 06:37:0937class CompoundEventFilter;
[email protected]0e46c272012-05-15 18:15:2338class InputMethodEventFilter;
[email protected]0e46c272012-05-15 18:15:2339}
[email protected]87b0d82e2011-10-07 21:02:5940}
[email protected]70b3e7d52012-06-02 22:12:2541namespace chromeos {
42class OutputConfigurator;
43}
[email protected]fa4a45832012-04-12 21:32:4844namespace content {
45class BrowserContext;
46}
47
[email protected]2b99f8c2011-10-11 19:42:2448namespace gfx {
[email protected]9ec0f452012-05-31 15:58:5349class ImageSkia;
[email protected]b5f30602012-01-30 15:16:5750class Point;
[email protected]cac10fc62011-10-07 23:22:5651class Rect;
52}
[email protected]a8bd1cb2012-02-17 23:05:5453namespace ui {
54class Layer;
55}
[email protected]57b8bb352012-01-11 05:11:4656namespace views {
57class NonClientFrameView;
58class Widget;
59}
[email protected]87b0d82e2011-10-07 21:02:5960
[email protected]55f593352011-12-24 05:42:4661namespace ash {
[email protected]87b0d82e2011-10-07 21:02:5962
[email protected]2f744282011-12-23 22:40:5263class AcceleratorController;
[email protected]f4c92b382012-08-28 00:59:5964class CapsLockDelegate;
[email protected]e70cf0ed2012-03-15 16:24:4765class DesktopBackgroundController;
[email protected]edbfb8d2012-09-03 08:33:4366class DisplayController;
[email protected]f48075d2012-05-24 11:06:5167class HighContrastController;
[email protected]671a2ae2011-10-13 21:53:2368class Launcher;
[email protected]8f80db0f2012-02-07 14:44:5369class NestedDispatcherController;
[email protected]e0d22e82012-01-04 00:46:5770class PowerButtonController;
[email protected]1a2145b2012-03-13 21:09:1771class ScreenAsh;
[email protected]222f40c2012-10-18 08:58:1372class SessionStateController;
[email protected]2b99f8c2011-10-11 19:42:2473class ShellDelegate;
[email protected]1a2145b2012-03-13 21:09:1774class ShellObserver;
[email protected]bfb411312012-02-27 20:59:2775class SystemTrayDelegate;
76class SystemTray;
[email protected]c16b9422012-06-06 21:51:1177class UserActivityDetector;
[email protected]10b22612012-03-22 17:07:5578class UserWallpaperDelegate;
[email protected]6aa614a2012-01-19 22:13:3879class VideoDetector;
[email protected]88d71122012-10-18 07:11:0180class WebNotificationTray;
[email protected]40c4cbb2012-01-10 23:26:0781class WindowCycleController;
[email protected]60fa9bba2011-10-28 21:21:5182
83namespace internal {
[email protected]2f744282011-12-23 22:40:5284class AcceleratorFilter;
[email protected]0039db92012-05-09 04:11:4585class ActivationController;
86class AppListController;
[email protected]60a978b72012-06-08 00:29:1887class CaptureController;
[email protected]084b6bb2011-11-17 05:18:1688class DragDropController;
[email protected]e67291f12012-10-10 05:52:3889class EventClientImpl;
[email protected]b9d224c2012-07-13 01:09:0390class EventRewriterEventFilter;
[email protected]3d29912a2012-02-07 07:41:5191class FocusCycler;
[email protected]c1c670172012-04-26 04:20:2692class MagnificationController;
[email protected]78d96302012-06-22 00:58:0793class MouseCursorEventFilter;
[email protected]196e9452012-08-01 06:42:5194class OutputConfiguratorAnimation;
[email protected]9ae32df2012-07-26 03:25:1895class OverlayEventFilter;
[email protected]e4a181cc2012-03-17 02:20:5796class ResizeShadowController;
[email protected]d90b8392012-06-13 09:34:5697class RootWindowController;
[email protected]b0079a92012-01-25 20:13:3898class RootWindowLayoutManager;
[email protected]8d625fb2012-07-18 16:40:0699class ScreenPositionController;
[email protected]a54e65b2011-11-21 22:03:34100class ShadowController;
[email protected]9861f1752012-06-01 07:16:14101class SlowAnimationEventFilter;
[email protected]ee1e1a22011-12-15 01:51:10102class StackingController;
[email protected]6d6546e2012-05-30 23:12:02103class StatusAreaWidget;
[email protected]9ae32df2012-07-26 03:25:18104class SystemGestureEventFilter;
[email protected]c0ce80e2012-10-05 23:28:27105class SystemModalContainerEventFilter;
[email protected]862deef2011-12-15 22:07:33106class TooltipController;
[email protected]73074742012-05-17 01:44:41107class TouchObserverHUD;
[email protected]ddd91e92012-01-27 16:03:48108class VisibilityController;
[email protected]80373572012-01-06 23:14:30109class WindowModalityController;
[email protected]60fa9bba2011-10-28 21:21:51110class WorkspaceController;
111}
[email protected]2b99f8c2011-10-11 19:42:24112
[email protected]87b0d82e2011-10-07 21:02:59113// Shell is a singleton object that presents the Shell API and implements the
[email protected]99f07e02011-12-07 00:02:59114// RootWindow's delegate interface.
[email protected]b0079a92012-01-25 20:13:38115//
116// Upon creation, the Shell sets itself as the RootWindow's delegate, which
117// takes ownership of the Shell.
[email protected]5097e692012-10-30 22:08:41118class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate,
119 public ui::EventTarget {
[email protected]87b0d82e2011-10-07 21:02:59120 public:
[email protected]be65be362012-06-15 07:38:23121 typedef std::vector<aura::RootWindow*> RootWindowList;
122 typedef std::vector<internal::RootWindowController*> RootWindowControllerList;
123
[email protected]3d29912a2012-02-07 07:41:51124 enum Direction {
125 FORWARD,
126 BACKWARD
127 };
128
[email protected]2b4cd302012-02-24 20:21:13129 // Accesses private data from a Shell for testing.
130 class ASH_EXPORT TestApi {
131 public:
132 explicit TestApi(Shell* shell);
133
[email protected]2b4cd302012-02-24 20:21:13134 internal::RootWindowLayoutManager* root_window_layout();
[email protected]0e46c272012-05-15 18:15:23135 aura::shared::InputMethodEventFilter* input_method_event_filter();
[email protected]435b212e2012-04-05 19:43:37136 internal::SystemGestureEventFilter* system_gesture_event_filter();
[email protected]db9131602012-02-29 19:06:32137 internal::WorkspaceController* workspace_controller();
[email protected]9737f8f2012-09-20 03:38:38138 internal::ScreenPositionController* screen_position_controller();
[email protected]2b4cd302012-02-24 20:21:13139
140 private:
141 Shell* shell_; // not owned
142
143 DISALLOW_COPY_AND_ASSIGN(TestApi);
144 };
145
[email protected]3266c2b92011-11-14 00:06:08146 // A shell must be explicitly created so that it can call |Init()| with the
147 // delegate set. |delegate| can be NULL (if not required for initialization).
148 static Shell* CreateInstance(ShellDelegate* delegate);
149
150 // Should never be called before |CreateInstance()|.
[email protected]cac10fc62011-10-07 23:22:56151 static Shell* GetInstance();
[email protected]3266c2b92011-11-14 00:06:08152
[email protected]b3b7bcd2012-03-06 19:35:45153 // Returns true if the ash shell has been instantiated.
154 static bool HasInstance();
155
[email protected]ef589af2011-12-03 01:07:15156 static void DeleteInstance();
[email protected]cac10fc62011-10-07 23:22:56157
[email protected]d90b8392012-06-13 09:34:56158 // Returns the root window controller for the primary root window.
159 static internal::RootWindowController* GetPrimaryRootWindowController();
160
[email protected]cf1c70e2012-08-30 01:13:02161 // Returns all root window controllers.
[email protected]be65be362012-06-15 07:38:23162 static RootWindowControllerList GetAllRootWindowControllers();
163
164 // Returns the primary RootWindow. The primary RootWindow is the one
[email protected]42713f72012-05-25 00:41:50165 // that has a launcher.
166 static aura::RootWindow* GetPrimaryRootWindow();
[email protected]e73bd7802012-02-17 20:10:34167
[email protected]be65be362012-06-15 07:38:23168 // Returns the active RootWindow. The active RootWindow is the one that
[email protected]a857dbe2012-05-30 22:10:14169 // contains the current active window as a decendant child. The active
170 // RootWindow remains the same even when the active window becomes NULL,
171 // until the another window who has a different root window becomes active.
172 static aura::RootWindow* GetActiveRootWindow();
173
[email protected]ffabb1e2012-10-12 19:51:17174 // Returns the global Screen object that's always active in ash.
175 static gfx::Screen* GetScreen();
176
[email protected]cf1c70e2012-08-30 01:13:02177 // Returns all root windows.
[email protected]be65be362012-06-15 07:38:23178 static RootWindowList GetAllRootWindows();
179
[email protected]7b0f7502012-06-11 00:12:39180 static aura::Window* GetContainer(aura::RootWindow* root_window,
181 int container_id);
[email protected]e67291f12012-10-10 05:52:38182 static const aura::Window* GetContainer(const aura::RootWindow* root_window,
183 int container_id);
[email protected]7b0f7502012-06-11 00:12:39184
185 // Returns the list of containers that match |container_id| in
186 // all root windows.
187 static std::vector<aura::Window*> GetAllContainers(int container_id);
188
[email protected]e74aaf0a2012-10-12 18:42:28189 // True if "launcher per display" feature is enabled.
190 static bool IsLauncherPerDisplayEnabled();
191
[email protected]a857dbe2012-05-30 22:10:14192 void set_active_root_window(aura::RootWindow* active_root_window) {
193 active_root_window_ = active_root_window;
194 }
195
[email protected]492533b32012-09-21 19:06:14196 // Adds or removes |filter| from the aura::Env's pre-target event-handler
197 // list.
[email protected]1aad3322012-06-06 06:37:09198 void AddEnvEventFilter(aura::EventFilter* filter);
199 void RemoveEnvEventFilter(aura::EventFilter* filter);
[email protected]e29014c2011-11-16 18:25:51200
[email protected]cb054f972012-10-11 20:27:28201 // Shows the context menu for the background and launcher at
[email protected]431552c2012-10-23 00:38:33202 // |location_in_screen| (in screen coordinates).
203 void ShowContextMenu(const gfx::Point& location_in_screen);
[email protected]cac10fc62011-10-07 23:22:56204
[email protected]ae4987d2011-11-21 22:52:44205 // Toggles app list.
206 void ToggleAppList();
207
[email protected]7510d1082012-03-30 21:58:34208 // Returns app list target visibility.
209 bool GetAppListTargetVisibility() const;
210
[email protected]1e51a9d2012-04-09 23:31:11211 // Returns app list window or NULL if it is not visible.
212 aura::Window* GetAppListWindow();
213
[email protected]f7eb89c2011-12-13 09:48:54214 // Returns true if the screen is locked.
215 bool IsScreenLocked() const;
216
[email protected]40c4cbb2012-01-10 23:26:07217 // Returns true if a modal dialog window is currently open.
218 bool IsModalWindowOpen() const;
219
[email protected]852a55d2012-10-17 13:30:30220 // For testing only: set simulation that a modal window is open
221 void SimulateModalWindowOpenForTesting(bool modal_window_open) {
222 simulate_modal_window_open_for_testing_ = modal_window_open;
223 }
224
[email protected]57b8bb352012-01-11 05:11:46225 // Creates a default views::NonClientFrameView for use by windows in the
226 // Ash environment.
227 views::NonClientFrameView* CreateDefaultNonClientFrameView(
228 views::Widget* widget);
229
[email protected]d9456cb2012-03-21 16:41:04230 // Rotates focus through containers that can receive focus.
[email protected]3d29912a2012-02-07 07:41:51231 void RotateFocus(Direction direction);
232
[email protected]2e236a52012-06-27 22:21:47233 // Sets the work area insets of the display that contains |window|,
[email protected]8a45c972012-03-14 18:22:44234 // this notifies observers too.
[email protected]27f6af62012-03-21 05:34:40235 // TODO(sky): this no longer really replicates what happens and is unreliable.
236 // Remove this.
[email protected]2e236a52012-06-27 22:21:47237 void SetDisplayWorkAreaInsets(aura::Window* window,
[email protected]8a45c972012-03-14 18:22:44238 const gfx::Insets& insets);
[email protected]1a2145b2012-03-13 21:09:17239
[email protected]82d3954ae2012-04-20 09:02:22240 // Called when the user logs in.
241 void OnLoginStateChanged(user::LoginStatus status);
242
[email protected]88d71122012-10-18 07:11:01243 // Called when the login status changes.
244 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
245 void UpdateAfterLoginStatusChange(user::LoginStatus status);
246
[email protected]82d3954ae2012-04-20 09:02:22247 // Called when the application is exiting.
248 void OnAppTerminating();
249
250 // Called when the screen is locked (after the lock window is visible) or
251 // unlocked.
252 void OnLockStateChanged(bool locked);
253
[email protected]d9456cb2012-03-21 16:41:04254 // Initializes |launcher_|. Does nothing if it's already initialized.
255 void CreateLauncher();
256
[email protected]7e1df2f62012-07-19 19:17:18257 // Show launcher view if it was created hidden (before session has started).
258 void ShowLauncher();
259
[email protected]d9456cb2012-03-21 16:41:04260 // Adds/removes observer.
[email protected]1a2145b2012-03-13 21:09:17261 void AddShellObserver(ShellObserver* observer);
262 void RemoveShellObserver(ShellObserver* observer);
263
[email protected]6e9f6aa2012-02-09 04:16:20264#if !defined(OS_MACOSX)
[email protected]2f744282011-12-23 22:40:52265 AcceleratorController* accelerator_controller() {
[email protected]745816be2011-11-22 05:08:30266 return accelerator_controller_.get();
267 }
[email protected]6e9f6aa2012-02-09 04:16:20268#endif // !defined(OS_MACOSX)
269
[email protected]1aad3322012-06-06 06:37:09270 aura::shared::CompoundEventFilter* env_filter() {
[email protected]492533b32012-09-21 19:06:14271 return env_filter_.get();
[email protected]627a62f2012-02-14 22:59:14272 }
[email protected]862deef2011-12-15 22:07:33273 internal::TooltipController* tooltip_controller() {
274 return tooltip_controller_.get();
[email protected]4a229e902011-12-01 21:21:11275 }
[email protected]b9d224c2012-07-13 01:09:03276 internal::EventRewriterEventFilter* event_rewriter_filter() {
277 return event_rewriter_filter_.get();
[email protected]42f06f92012-03-27 00:57:57278 }
[email protected]9ae32df2012-07-26 03:25:18279 internal::OverlayEventFilter* overlay_filter() {
280 return overlay_filter_.get();
[email protected]0b0b0742012-02-16 13:23:45281 }
[email protected]e70cf0ed2012-03-15 16:24:47282 DesktopBackgroundController* desktop_background_controller() {
283 return desktop_background_controller_.get();
284 }
[email protected]e0d22e82012-01-04 00:46:57285 PowerButtonController* power_button_controller() {
286 return power_button_controller_.get();
287 }
[email protected]222f40c2012-10-18 08:58:13288 SessionStateController* session_state_controller() {
289 return session_state_controller_.get();
290 }
[email protected]c16b9422012-06-06 21:51:11291 UserActivityDetector* user_activity_detector() {
292 return user_activity_detector_.get();
293 }
[email protected]6aa614a2012-01-19 22:13:38294 VideoDetector* video_detector() {
295 return video_detector_.get();
296 }
[email protected]40c4cbb2012-01-10 23:26:07297 WindowCycleController* window_cycle_controller() {
298 return window_cycle_controller_.get();
299 }
[email protected]2d511542012-03-07 09:13:34300 internal::FocusCycler* focus_cycler() {
301 return focus_cycler_.get();
302 }
[email protected]edbfb8d2012-09-03 08:33:43303 DisplayController* display_controller() {
[email protected]2e236a52012-06-27 22:21:47304 return display_controller_.get();
[email protected]3e1cdd312012-06-07 03:48:41305 }
[email protected]8b7ba87b2012-09-01 00:40:40306 internal::MouseCursorEventFilter* mouse_cursor_filter() {
307 return mouse_cursor_filter_.get();
308 }
[email protected]4b8003c2012-07-26 00:54:19309 CursorManager* cursor_manager() { return &cursor_manager_; }
[email protected]4a229e902011-12-01 21:21:11310
[email protected]3266c2b92011-11-14 00:06:08311 ShellDelegate* delegate() { return delegate_.get(); }
[email protected]aa54218b2012-06-12 16:51:42312
[email protected]10b22612012-03-22 17:07:55313 UserWallpaperDelegate* user_wallpaper_delegate() {
314 return user_wallpaper_delegate_.get();
315 }
[email protected]35304ce2011-12-14 23:21:01316
[email protected]f4c92b382012-08-28 00:59:59317 CapsLockDelegate* caps_lock_delegate() {
318 return caps_lock_delegate_.get();
319 }
320
[email protected]f48075d2012-05-24 11:06:51321 HighContrastController* high_contrast_controller() {
322 return high_contrast_controller_.get();
323 }
324
[email protected]c1c670172012-04-26 04:20:26325 internal::MagnificationController* magnification_controller() {
326 return magnification_controller_.get();
327 }
[email protected]f48075d2012-05-24 11:06:51328
[email protected]b0a8faa2012-10-19 03:22:22329 const ScreenAsh* screen() { return screen_; }
[email protected]1a2145b2012-03-13 21:09:17330
[email protected]c758fbf2012-03-25 22:53:59331 // Force the shelf to query for it's current visibility state.
332 void UpdateShelfVisibility();
333
[email protected]431552c2012-10-23 00:38:33334 // TODO(oshima): Define an interface to access shelf/launcher
335 // state, or just use Launcher.
[email protected]c758fbf2012-03-25 22:53:59336
[email protected]431552c2012-10-23 00:38:33337 // Sets/gets the shelf auto-hide behavior on |root_window|.
338 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior,
339 aura::RootWindow* root_window);
340 ShelfAutoHideBehavior GetShelfAutoHideBehavior(
341 aura::RootWindow* root_window) const;
342
343 bool IsShelfAutoHideMenuHideChecked(aura::RootWindow* root);
344 ShelfAutoHideBehavior GetToggledShelfAutoHideBehavior(
345 aura::RootWindow* root_window);
346
347 // Sets/gets shelf's alignment on |root_window|.
348 void SetShelfAlignment(ShelfAlignment alignment,
349 aura::RootWindow* root_window);
350 ShelfAlignment GetShelfAlignment(aura::RootWindow* root_window);
[email protected]55444502012-05-10 15:43:53351
[email protected]d90b8392012-06-13 09:34:56352 // Dims or undims the screen.
353 void SetDimming(bool should_dim);
354
[email protected]090c4f12012-10-29 18:56:42355 // Creates a modal background (a partially-opaque fullscreen window)
356 // on all displays for |window|.
357 void CreateModalBackground(aura::Window* window);
[email protected]c0ce80e2012-10-05 23:28:27358
359 // Called when a modal window is removed. It will activate
360 // another modal window if any, or remove modal screens
361 // on all displays.
362 void OnModalWindowRemoved(aura::Window* removed);
363
[email protected]88d71122012-10-18 07:11:01364 // Returns WebNotificationTray on the primary root window.
365 WebNotificationTray* GetWebNotificationTray();
[email protected]6d6546e2012-05-30 23:12:02366
[email protected]aa54218b2012-06-12 16:51:42367 // Convenience accessor for members of StatusAreaWidget.
368 SystemTrayDelegate* tray_delegate();
369 SystemTray* system_tray();
[email protected]bfb411312012-02-27 20:59:27370
[email protected]9488d4d2012-02-29 18:32:37371 static void set_initially_hide_cursor(bool hide) {
372 initially_hide_cursor_ = hide;
373 }
374
[email protected]e4a181cc2012-03-17 02:20:57375 internal::ResizeShadowController* resize_shadow_controller() {
376 return resize_shadow_controller_.get();
377 }
378
[email protected]a54e65b2011-11-21 22:03:34379 // Made available for tests.
380 internal::ShadowController* shadow_controller() {
381 return shadow_controller_.get();
382 }
383
[email protected]fa4a45832012-04-12 21:32:48384 content::BrowserContext* browser_context() { return browser_context_; }
385 void set_browser_context(content::BrowserContext* browser_context) {
386 browser_context_ = browser_context;
387 }
388
[email protected]2e236a52012-06-27 22:21:47389 // Initializes the root window to be used for a secondary display.
390 void InitRootWindowForSecondaryDisplay(aura::RootWindow* root);
[email protected]a857dbe2012-05-30 22:10:14391
[email protected]f9466702012-09-17 16:35:27392 // Starts the animation that occurs on first login.
393 void DoInitialWorkspaceAnimation();
394
[email protected]70b3e7d52012-06-02 22:12:25395#if defined(OS_CHROMEOS)
396 chromeos::OutputConfigurator* output_configurator() {
397 return output_configurator_.get();
398 }
[email protected]196e9452012-08-01 06:42:51399 internal::OutputConfiguratorAnimation* output_configurator_animation() {
400 return output_configurator_animation_.get();
401 }
[email protected]70b3e7d52012-06-02 22:12:25402#endif // defined(OS_CHROMEOS)
403
[email protected]2b4cd302012-02-24 20:21:13404 private:
[email protected]c39be8f2012-06-15 22:58:36405 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor);
[email protected]1aad3322012-06-06 06:37:09406 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
407 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
[email protected]d90b8392012-06-13 09:34:56408 friend class internal::RootWindowController;
[email protected]ad0c8722012-03-02 20:17:45409
[email protected]cac10fc62011-10-07 23:22:56410 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
411
[email protected]3266c2b92011-11-14 00:06:08412 explicit Shell(ShellDelegate* delegate);
413 virtual ~Shell();
414
415 void Init();
[email protected]b0639282011-12-22 21:12:27416
[email protected]be65be362012-06-15 07:38:23417 // Initializes the root window and root window controller so that it
418 // can host browser windows.
419 void InitRootWindowController(internal::RootWindowController* root);
[email protected]d90b8392012-06-13 09:34:56420
421 // Initializes the layout managers and event filters specific for
422 // primary display.
423 void InitLayoutManagersForPrimaryDisplay(
424 internal::RootWindowController* root_window_controller);
[email protected]1b62b892012-01-17 17:08:15425
[email protected]c0ce80e2012-10-05 23:28:27426 // ash::internal::SystemModalContainerEventFilterDelegate overrides:
427 virtual bool CanWindowReceiveEvents(aura::Window* window) OVERRIDE;
428
[email protected]5097e692012-10-30 22:08:41429 // Overridden from ui::EventTarget:
430 virtual bool CanAcceptEvents() OVERRIDE;
431 virtual EventTarget* GetParentTarget() OVERRIDE;
432
[email protected]cac10fc62011-10-07 23:22:56433 static Shell* instance_;
434
[email protected]9488d4d2012-02-29 18:32:37435 // If set before the Shell is initialized, the mouse cursor will be hidden
436 // when the screen is initially created.
437 static bool initially_hide_cursor_;
438
[email protected]b0a8faa2012-10-19 03:22:22439 ScreenAsh* screen_;
[email protected]58482fa2012-03-02 14:57:39440
[email protected]f634dd32012-07-23 22:49:07441 // Active root window. Never becomes NULL during the session.
[email protected]a857dbe2012-05-30 22:10:14442 aura::RootWindow* active_root_window_;
443
[email protected]1aad3322012-06-06 06:37:09444 // The CompoundEventFilter owned by aura::Env object.
[email protected]492533b32012-09-21 19:06:14445 scoped_ptr<aura::shared::CompoundEventFilter> env_filter_;
[email protected]627a62f2012-02-14 22:59:14446
[email protected]cac10fc62011-10-07 23:22:56447 std::vector<WindowAndBoundsPair> to_restore_;
448
[email protected]6e9f6aa2012-02-09 04:16:20449#if !defined(OS_MACOSX)
[email protected]8f80db0f2012-02-07 14:44:53450 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_;
451
[email protected]2f744282011-12-23 22:40:52452 scoped_ptr<AcceleratorController> accelerator_controller_;
[email protected]6e9f6aa2012-02-09 04:16:20453#endif // !defined(OS_MACOSX)
[email protected]745816be2011-11-22 05:08:30454
[email protected]2b99f8c2011-10-11 19:42:24455 scoped_ptr<ShellDelegate> delegate_;
[email protected]10b22612012-03-22 17:07:55456 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
[email protected]f4c92b382012-08-28 00:59:59457 scoped_ptr<CapsLockDelegate> caps_lock_delegate_;
[email protected]2b99f8c2011-10-11 19:42:24458
[email protected]0039db92012-05-09 04:11:45459 scoped_ptr<internal::AppListController> app_list_controller_;
[email protected]ae4987d2011-11-21 22:52:44460
[email protected]ee1e1a22011-12-15 01:51:10461 scoped_ptr<internal::StackingController> stacking_controller_;
[email protected]9fc206d2011-12-13 00:05:33462 scoped_ptr<internal::ActivationController> activation_controller_;
[email protected]60a978b72012-06-08 00:29:18463 scoped_ptr<internal::CaptureController> capture_controller_;
[email protected]80373572012-01-06 23:14:30464 scoped_ptr<internal::WindowModalityController> window_modality_controller_;
[email protected]084b6bb2011-11-17 05:18:16465 scoped_ptr<internal::DragDropController> drag_drop_controller_;
[email protected]e4a181cc2012-03-17 02:20:57466 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_;
[email protected]a54e65b2011-11-21 22:03:34467 scoped_ptr<internal::ShadowController> shadow_controller_;
[email protected]862deef2011-12-15 22:07:33468 scoped_ptr<internal::TooltipController> tooltip_controller_;
[email protected]ddd91e92012-01-27 16:03:48469 scoped_ptr<internal::VisibilityController> visibility_controller_;
[email protected]e70cf0ed2012-03-15 16:24:47470 scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
[email protected]e0d22e82012-01-04 00:46:57471 scoped_ptr<PowerButtonController> power_button_controller_;
[email protected]222f40c2012-10-18 08:58:13472 scoped_ptr<SessionStateController> session_state_controller_;
[email protected]c16b9422012-06-06 21:51:11473 scoped_ptr<UserActivityDetector> user_activity_detector_;
[email protected]6aa614a2012-01-19 22:13:38474 scoped_ptr<VideoDetector> video_detector_;
[email protected]40c4cbb2012-01-10 23:26:07475 scoped_ptr<WindowCycleController> window_cycle_controller_;
[email protected]3d29912a2012-02-07 07:41:51476 scoped_ptr<internal::FocusCycler> focus_cycler_;
[email protected]edbfb8d2012-09-03 08:33:43477 scoped_ptr<DisplayController> display_controller_;
[email protected]f48075d2012-05-24 11:06:51478 scoped_ptr<HighContrastController> high_contrast_controller_;
[email protected]c1c670172012-04-26 04:20:26479 scoped_ptr<internal::MagnificationController> magnification_controller_;
[email protected]a857dbe2012-05-30 22:10:14480 scoped_ptr<aura::FocusManager> focus_manager_;
[email protected]c28853612012-05-31 22:43:44481 scoped_ptr<aura::client::UserActionClient> user_action_client_;
[email protected]78d96302012-06-22 00:58:07482 scoped_ptr<internal::MouseCursorEventFilter> mouse_cursor_filter_;
[email protected]8d625fb2012-07-18 16:40:06483 scoped_ptr<internal::ScreenPositionController> screen_position_controller_;
[email protected]c0ce80e2012-10-05 23:28:27484 scoped_ptr<internal::SystemModalContainerEventFilter> modality_filter_;
[email protected]e67291f12012-10-10 05:52:38485 scoped_ptr<internal::EventClientImpl> event_client_;
[email protected]ae18b9112011-11-07 16:59:13486
[email protected]b9d224c2012-07-13 01:09:03487 // An event filter that rewrites or drops an event.
488 scoped_ptr<internal::EventRewriterEventFilter> event_rewriter_filter_;
[email protected]6e9f6aa2012-02-09 04:16:20489
[email protected]0b0b0742012-02-16 13:23:45490 // An event filter that pre-handles key events while the partial
[email protected]a1584a712012-07-30 21:02:26491 // screenshot UI or the keyboard overlay is active.
[email protected]9ae32df2012-07-26 03:25:18492 scoped_ptr<internal::OverlayEventFilter> overlay_filter_;
[email protected]0b0b0742012-02-16 13:23:45493
[email protected]435b212e2012-04-05 19:43:37494 // An event filter which handles system level gestures
495 scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_;
496
[email protected]6e9f6aa2012-02-09 04:16:20497#if !defined(OS_MACOSX)
[email protected]745816be2011-11-22 05:08:30498 // An event filter that pre-handles global accelerators.
[email protected]2f744282011-12-23 22:40:52499 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_;
[email protected]6e9f6aa2012-02-09 04:16:20500#endif
[email protected]745816be2011-11-22 05:08:30501
[email protected]42f06f92012-03-27 00:57:57502 // An event filter that pre-handles all key events to send them to an IME.
[email protected]0e46c272012-05-15 18:15:23503 scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_;
[email protected]42f06f92012-03-27 00:57:57504
[email protected]73074742012-05-17 01:44:41505 // An event filter that silently keeps track of all touch events and controls
506 // a heads-up display. This is enabled only if --ash-touch-hud flag is used.
507 scoped_ptr<internal::TouchObserverHUD> touch_observer_hud_;
508
[email protected]70b3e7d52012-06-02 22:12:25509#if defined(OS_CHROMEOS)
510 // Controls video output device state.
511 scoped_ptr<chromeos::OutputConfigurator> output_configurator_;
[email protected]196e9452012-08-01 06:42:51512 scoped_ptr<internal::OutputConfiguratorAnimation>
513 output_configurator_animation_;
[email protected]70b3e7d52012-06-02 22:12:25514#endif // defined(OS_CHROMEOS)
515
[email protected]4b8003c2012-07-26 00:54:19516 CursorManager cursor_manager_;
517
[email protected]1a2145b2012-03-13 21:09:17518 ObserverList<ShellObserver> observers_;
519
[email protected]fa4a45832012-04-12 21:32:48520 // Used by ash/shell.
521 content::BrowserContext* browser_context_;
522
[email protected]852a55d2012-10-17 13:30:30523 // For testing only: simulate that a modal window is open
524 bool simulate_modal_window_open_for_testing_;
525
[email protected]87b0d82e2011-10-07 21:02:59526 DISALLOW_COPY_AND_ASSIGN(Shell);
527};
528
[email protected]55f593352011-12-24 05:42:46529} // namespace ash
[email protected]87b0d82e2011-10-07 21:02:59530
[email protected]b65bdda2011-12-23 23:35:31531#endif // ASH_SHELL_H_