blob: a602cdf3cd1891281c046b52474d11b29faa75ea [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]478c6c32013-03-09 02:50:5812#include "ash/shelf/shelf_types.h"
[email protected]82d3954ae2012-04-20 09:02:2213#include "ash/system/user/login_status.h"
[email protected]c0ce80e2012-10-05 23:28:2714#include "ash/wm/system_modal_container_event_filter_delegate.h"
[email protected]87b0d82e2011-10-07 21:02:5915#include "base/basictypes.h"
[email protected]c45fdc72012-02-22 22:59:1216#include "base/compiler_specific.h"
[email protected]b0639282011-12-22 21:12:2717#include "base/gtest_prod_util.h"
[email protected]2b99f8c2011-10-11 19:42:2418#include "base/memory/scoped_ptr.h"
[email protected]1a2145b2012-03-13 21:09:1719#include "base/observer_list.h"
[email protected]1ae361652012-12-12 22:39:5120#include "ui/aura/client/activation_change_observer.h"
[email protected]5097e692012-10-30 22:08:4121#include "ui/base/events/event_target.h"
[email protected]940fb1c2013-06-18 16:54:2822#include "ui/base/ui_base_types.h"
[email protected]2eb6b892012-05-31 13:28:2123#include "ui/gfx/insets.h"
[email protected]ffabb1e2012-10-12 19:51:1724#include "ui/gfx/screen.h"
[email protected]9ec0f452012-05-31 15:58:5325#include "ui/gfx/size.h"
[email protected]c0ff0342013-02-27 00:41:2926#include "ui/views/corewm/cursor_manager.h"
[email protected]87b0d82e2011-10-07 21:02:5927
[email protected]b0639282011-12-22 21:12:2728class CommandLine;
29
[email protected]00c8469e22013-05-08 21:40:0830namespace app_list {
31class ApplicationDragAndDropHost;
32}
[email protected]87b0d82e2011-10-07 21:02:5933namespace aura {
[email protected]e29014c2011-11-16 18:25:5134class EventFilter;
[email protected]35304ce2011-12-14 23:21:0135class RootWindow;
[email protected]87b0d82e2011-10-07 21:02:5936class Window;
[email protected]c28853612012-05-31 22:43:4437namespace client {
[email protected]39718b52012-12-03 17:24:5638class ActivationClient;
[email protected]8cfb6722012-11-28 03:28:4639class FocusClient;
[email protected]c28853612012-05-31 22:43:4440class UserActionClient;
41}
[email protected]87b0d82e2011-10-07 21:02:5942}
[email protected]70b3e7d52012-06-02 22:12:2543namespace chromeos {
44class OutputConfigurator;
45}
[email protected]fa4a45832012-04-12 21:32:4846namespace content {
47class BrowserContext;
48}
49
[email protected]2b99f8c2011-10-11 19:42:2450namespace gfx {
[email protected]9ec0f452012-05-31 15:58:5351class ImageSkia;
[email protected]b5f30602012-01-30 15:16:5752class Point;
[email protected]cac10fc62011-10-07 23:22:5653class Rect;
54}
[email protected]a8bd1cb2012-02-17 23:05:5455namespace ui {
56class Layer;
57}
[email protected]57b8bb352012-01-11 05:11:4658namespace views {
59class NonClientFrameView;
60class Widget;
[email protected]4a59e4e2012-11-12 21:15:4061namespace corewm {
62class CompoundEventFilter;
63class InputMethodEventFilter;
[email protected]86f2b5e2012-11-14 20:37:0064class ShadowController;
[email protected]a1b7a822013-02-23 19:08:0465class TooltipController;
[email protected]b5756e22012-11-30 01:32:0266class VisibilityController;
[email protected]0c2dc012012-12-02 00:00:2367class WindowModalityController;
[email protected]4a59e4e2012-11-12 21:15:4068}
[email protected]57b8bb352012-01-11 05:11:4669}
[email protected]87b0d82e2011-10-07 21:02:5970
[email protected]55f593352011-12-24 05:42:4671namespace ash {
[email protected]87b0d82e2011-10-07 21:02:5972
[email protected]2f744282011-12-23 22:40:5273class AcceleratorController;
[email protected]c0ff0342013-02-27 00:41:2974class AshNativeCursorManager;
[email protected]f4c92b382012-08-28 00:59:5975class CapsLockDelegate;
[email protected]e70cf0ed2012-03-15 16:24:4776class DesktopBackgroundController;
[email protected]edbfb8d2012-09-03 08:33:4377class DisplayController;
[email protected]f48075d2012-05-24 11:06:5178class HighContrastController;
[email protected]671a2ae2011-10-13 21:53:2379class Launcher;
[email protected]b913a3a2012-12-11 13:07:1980class LauncherDelegate;
81class LauncherModel;
[email protected]77f7c132012-11-15 06:52:5482class MagnificationController;
[email protected]8f80db0f2012-02-07 14:44:5383class NestedDispatcherController;
[email protected]77f7c132012-11-15 06:52:5484class PartialMagnificationController;
[email protected]e0d22e82012-01-04 00:46:5785class PowerButtonController;
[email protected]fca90ea2012-12-14 04:13:3086class RootWindowHostFactory;
[email protected]1a2145b2012-03-13 21:09:1787class ScreenAsh;
[email protected]ab4f8c92013-05-30 19:07:4788class LockStateController;
[email protected]fcb123d2013-04-17 15:58:4989class SessionStateDelegate;
[email protected]2b99f8c2011-10-11 19:42:2490class ShellDelegate;
[email protected]1a2145b2012-03-13 21:09:1791class ShellObserver;
[email protected]bfb411312012-02-27 20:59:2792class SystemTray;
[email protected]51ed5992012-11-07 10:14:3993class SystemTrayDelegate;
[email protected]83b2b84c2012-11-14 01:11:0094class SystemTrayNotifier;
[email protected]c16b9422012-06-06 21:51:1195class UserActivityDetector;
[email protected]10b22612012-03-22 17:07:5596class UserWallpaperDelegate;
[email protected]6aa614a2012-01-19 22:13:3897class VideoDetector;
[email protected]88d71122012-10-18 07:11:0198class WebNotificationTray;
[email protected]40c4cbb2012-01-10 23:26:0799class WindowCycleController;
[email protected]60fa9bba2011-10-28 21:21:51100
101namespace internal {
[email protected]2f744282011-12-23 22:40:52102class AcceleratorFilter;
[email protected]0039db92012-05-09 04:11:45103class ActivationController;
104class AppListController;
[email protected]60a978b72012-06-08 00:29:18105class CaptureController;
[email protected]6bdf7952012-11-14 10:10:58106class DisplayChangeObserverX11;
[email protected]18b21b2e2013-03-01 20:56:23107class DisplayErrorObserver;
[email protected]6bdf7952012-11-14 10:10:58108class DisplayManager;
[email protected]084b6bb2011-11-17 05:18:16109class DragDropController;
[email protected]e67291f12012-10-10 05:52:38110class EventClientImpl;
[email protected]b9d224c2012-07-13 01:09:03111class EventRewriterEventFilter;
[email protected]682990f2013-01-10 06:49:11112class EventTransformationHandler;
[email protected]3d29912a2012-02-07 07:41:51113class FocusCycler;
[email protected]607419ad2013-05-23 19:58:40114class MirrorWindowController;
[email protected]78d96302012-06-22 00:58:07115class MouseCursorEventFilter;
[email protected]196e9452012-08-01 06:42:51116class OutputConfiguratorAnimation;
[email protected]9ae32df2012-07-26 03:25:18117class OverlayEventFilter;
[email protected]e4a181cc2012-03-17 02:20:57118class ResizeShadowController;
[email protected]d90b8392012-06-13 09:34:56119class RootWindowController;
[email protected]b0079a92012-01-25 20:13:38120class RootWindowLayoutManager;
[email protected]8d625fb2012-07-18 16:40:06121class ScreenPositionController;
[email protected]9861f1752012-06-01 07:16:14122class SlowAnimationEventFilter;
[email protected]6d6546e2012-05-30 23:12:02123class StatusAreaWidget;
[email protected]9ae32df2012-07-26 03:25:18124class SystemGestureEventFilter;
[email protected]c0ce80e2012-10-05 23:28:27125class SystemModalContainerEventFilter;
[email protected]73074742012-05-17 01:44:41126class TouchObserverHUD;
[email protected]60fa9bba2011-10-28 21:21:51127class WorkspaceController;
128}
[email protected]2b99f8c2011-10-11 19:42:24129
[email protected]0af58042012-12-13 03:21:35130namespace shell {
131class WindowWatcher;
132}
133
[email protected]0c68e892012-12-08 16:54:53134namespace test {
135class ShellTestApi;
136}
137
[email protected]87b0d82e2011-10-07 21:02:59138// Shell is a singleton object that presents the Shell API and implements the
[email protected]99f07e02011-12-07 00:02:59139// RootWindow's delegate interface.
[email protected]b0079a92012-01-25 20:13:38140//
141// Upon creation, the Shell sets itself as the RootWindow's delegate, which
142// takes ownership of the Shell.
[email protected]1ae361652012-12-12 22:39:51143class ASH_EXPORT Shell
144 : public internal::SystemModalContainerEventFilterDelegate,
145 public ui::EventTarget,
146 public aura::client::ActivationChangeObserver {
[email protected]87b0d82e2011-10-07 21:02:59147 public:
[email protected]be65be362012-06-15 07:38:23148 typedef std::vector<aura::RootWindow*> RootWindowList;
149 typedef std::vector<internal::RootWindowController*> RootWindowControllerList;
150
[email protected]3d29912a2012-02-07 07:41:51151 enum Direction {
152 FORWARD,
153 BACKWARD
154 };
155
[email protected]3266c2b92011-11-14 00:06:08156 // A shell must be explicitly created so that it can call |Init()| with the
157 // delegate set. |delegate| can be NULL (if not required for initialization).
[email protected]09464c72013-04-26 07:31:28158 // Takes ownership of |delegate|.
[email protected]3266c2b92011-11-14 00:06:08159 static Shell* CreateInstance(ShellDelegate* delegate);
160
161 // Should never be called before |CreateInstance()|.
[email protected]cac10fc62011-10-07 23:22:56162 static Shell* GetInstance();
[email protected]3266c2b92011-11-14 00:06:08163
[email protected]b3b7bcd2012-03-06 19:35:45164 // Returns true if the ash shell has been instantiated.
165 static bool HasInstance();
166
[email protected]ef589af2011-12-03 01:07:15167 static void DeleteInstance();
[email protected]cac10fc62011-10-07 23:22:56168
[email protected]d90b8392012-06-13 09:34:56169 // Returns the root window controller for the primary root window.
[email protected]a0afeb12012-12-10 22:57:09170 // TODO(oshima): move this to |RootWindowController|
[email protected]d90b8392012-06-13 09:34:56171 static internal::RootWindowController* GetPrimaryRootWindowController();
172
[email protected]cf1c70e2012-08-30 01:13:02173 // Returns all root window controllers.
[email protected]a0afeb12012-12-10 22:57:09174 // TODO(oshima): move this to |RootWindowController|
[email protected]be65be362012-06-15 07:38:23175 static RootWindowControllerList GetAllRootWindowControllers();
176
177 // Returns the primary RootWindow. The primary RootWindow is the one
[email protected]42713f72012-05-25 00:41:50178 // that has a launcher.
179 static aura::RootWindow* GetPrimaryRootWindow();
[email protected]e73bd7802012-02-17 20:10:34180
[email protected]be65be362012-06-15 07:38:23181 // Returns the active RootWindow. The active RootWindow is the one that
[email protected]a857dbe2012-05-30 22:10:14182 // contains the current active window as a decendant child. The active
183 // RootWindow remains the same even when the active window becomes NULL,
184 // until the another window who has a different root window becomes active.
185 static aura::RootWindow* GetActiveRootWindow();
186
[email protected]ffabb1e2012-10-12 19:51:17187 // Returns the global Screen object that's always active in ash.
188 static gfx::Screen* GetScreen();
189
[email protected]cf1c70e2012-08-30 01:13:02190 // Returns all root windows.
[email protected]be65be362012-06-15 07:38:23191 static RootWindowList GetAllRootWindows();
192
[email protected]7b0f7502012-06-11 00:12:39193 static aura::Window* GetContainer(aura::RootWindow* root_window,
194 int container_id);
[email protected]e67291f12012-10-10 05:52:38195 static const aura::Window* GetContainer(const aura::RootWindow* root_window,
196 int container_id);
[email protected]7b0f7502012-06-11 00:12:39197
198 // Returns the list of containers that match |container_id| in
[email protected]429433f2012-12-28 20:14:46199 // all root windows. If |priority_root| is given, the container
200 // in the |priority_root| will be inserted at the top of the list.
201 static std::vector<aura::Window*> GetContainersFromAllRootWindows(
202 int container_id,
203 aura::RootWindow* priority_root);
[email protected]7b0f7502012-06-11 00:12:39204
[email protected]a4016f12013-05-02 07:53:47205 // True if an experimental maximize mode is enabled which forces browser and
206 // application windows to be maximized only.
207 static bool IsForcedMaximizeMode();
208
[email protected]a857dbe2012-05-30 22:10:14209 void set_active_root_window(aura::RootWindow* active_root_window) {
210 active_root_window_ = active_root_window;
211 }
212
[email protected]cb054f972012-10-11 20:27:28213 // Shows the context menu for the background and launcher at
[email protected]431552c2012-10-23 00:38:33214 // |location_in_screen| (in screen coordinates).
[email protected]940fb1c2013-06-18 16:54:28215 void ShowContextMenu(const gfx::Point& location_in_screen,
216 ui::MenuSourceType source_type);
[email protected]cac10fc62011-10-07 23:22:56217
[email protected]b913a3a2012-12-11 13:07:19218 // Toggles the app list. |window| specifies in which display the app
219 // list should be shown. If this is NULL, the active root window
220 // will be used.
221 void ToggleAppList(aura::Window* anchor);
[email protected]ae4987d2011-11-21 22:52:44222
[email protected]00c8469e22013-05-08 21:40:08223 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop
224 // operations outside the application list.
225 void SetDragAndDropHostOfCurrentAppList(
226 app_list::ApplicationDragAndDropHost* drag_and_drop_host);
227
[email protected]7510d1082012-03-30 21:58:34228 // Returns app list target visibility.
229 bool GetAppListTargetVisibility() const;
230
[email protected]1e51a9d2012-04-09 23:31:11231 // Returns app list window or NULL if it is not visible.
232 aura::Window* GetAppListWindow();
233
[email protected]dc09739372012-11-15 20:17:39234 // Returns true if a system-modal dialog window is currently open.
235 bool IsSystemModalWindowOpen() const;
[email protected]40c4cbb2012-01-10 23:26:07236
[email protected]852a55d2012-10-17 13:30:30237 // For testing only: set simulation that a modal window is open
238 void SimulateModalWindowOpenForTesting(bool modal_window_open) {
239 simulate_modal_window_open_for_testing_ = modal_window_open;
240 }
241
[email protected]57b8bb352012-01-11 05:11:46242 // Creates a default views::NonClientFrameView for use by windows in the
243 // Ash environment.
244 views::NonClientFrameView* CreateDefaultNonClientFrameView(
245 views::Widget* widget);
246
[email protected]d9456cb2012-03-21 16:41:04247 // Rotates focus through containers that can receive focus.
[email protected]3d29912a2012-02-07 07:41:51248 void RotateFocus(Direction direction);
249
[email protected]2e236a52012-06-27 22:21:47250 // Sets the work area insets of the display that contains |window|,
[email protected]8a45c972012-03-14 18:22:44251 // this notifies observers too.
[email protected]27f6af62012-03-21 05:34:40252 // TODO(sky): this no longer really replicates what happens and is unreliable.
253 // Remove this.
[email protected]2e236a52012-06-27 22:21:47254 void SetDisplayWorkAreaInsets(aura::Window* window,
[email protected]8a45c972012-03-14 18:22:44255 const gfx::Insets& insets);
[email protected]1a2145b2012-03-13 21:09:17256
[email protected]82d3954ae2012-04-20 09:02:22257 // Called when the user logs in.
258 void OnLoginStateChanged(user::LoginStatus status);
259
[email protected]88d71122012-10-18 07:11:01260 // Called when the login status changes.
261 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
262 void UpdateAfterLoginStatusChange(user::LoginStatus status);
263
[email protected]82d3954ae2012-04-20 09:02:22264 // Called when the application is exiting.
265 void OnAppTerminating();
266
267 // Called when the screen is locked (after the lock window is visible) or
268 // unlocked.
269 void OnLockStateChanged(bool locked);
270
[email protected]d9456cb2012-03-21 16:41:04271 // Initializes |launcher_|. Does nothing if it's already initialized.
272 void CreateLauncher();
273
[email protected]7e1df2f62012-07-19 19:17:18274 // Show launcher view if it was created hidden (before session has started).
275 void ShowLauncher();
276
[email protected]d9456cb2012-03-21 16:41:04277 // Adds/removes observer.
[email protected]1a2145b2012-03-13 21:09:17278 void AddShellObserver(ShellObserver* observer);
279 void RemoveShellObserver(ShellObserver* observer);
280
[email protected]6e9f6aa2012-02-09 04:16:20281#if !defined(OS_MACOSX)
[email protected]2f744282011-12-23 22:40:52282 AcceleratorController* accelerator_controller() {
[email protected]745816be2011-11-22 05:08:30283 return accelerator_controller_.get();
284 }
[email protected]6e9f6aa2012-02-09 04:16:20285#endif // !defined(OS_MACOSX)
286
[email protected]6bdf7952012-11-14 10:10:58287 internal::DisplayManager* display_manager() {
288 return display_manager_.get();
289 }
[email protected]607419ad2013-05-23 19:58:40290 internal::MirrorWindowController* mirror_window_controller() {
291 return mirror_window_controller_.get();
292 }
[email protected]f1d5c3a2013-04-23 17:42:56293 views::corewm::InputMethodEventFilter* input_method_filter() {
294 return input_method_filter_.get();
295 }
[email protected]4a59e4e2012-11-12 21:15:40296 views::corewm::CompoundEventFilter* env_filter() {
[email protected]492533b32012-09-21 19:06:14297 return env_filter_.get();
[email protected]627a62f2012-02-14 22:59:14298 }
[email protected]a1b7a822013-02-23 19:08:04299 views::corewm::TooltipController* tooltip_controller() {
[email protected]862deef2011-12-15 22:07:33300 return tooltip_controller_.get();
[email protected]4a229e902011-12-01 21:21:11301 }
[email protected]b9d224c2012-07-13 01:09:03302 internal::EventRewriterEventFilter* event_rewriter_filter() {
303 return event_rewriter_filter_.get();
[email protected]42f06f92012-03-27 00:57:57304 }
[email protected]9ae32df2012-07-26 03:25:18305 internal::OverlayEventFilter* overlay_filter() {
306 return overlay_filter_.get();
[email protected]0b0b0742012-02-16 13:23:45307 }
[email protected]e70cf0ed2012-03-15 16:24:47308 DesktopBackgroundController* desktop_background_controller() {
309 return desktop_background_controller_.get();
310 }
[email protected]e0d22e82012-01-04 00:46:57311 PowerButtonController* power_button_controller() {
312 return power_button_controller_.get();
313 }
[email protected]ab4f8c92013-05-30 19:07:47314 LockStateController* lock_state_controller() {
315 return lock_state_controller_.get();
[email protected]222f40c2012-10-18 08:58:13316 }
[email protected]c16b9422012-06-06 21:51:11317 UserActivityDetector* user_activity_detector() {
318 return user_activity_detector_.get();
319 }
[email protected]6aa614a2012-01-19 22:13:38320 VideoDetector* video_detector() {
321 return video_detector_.get();
322 }
[email protected]40c4cbb2012-01-10 23:26:07323 WindowCycleController* window_cycle_controller() {
324 return window_cycle_controller_.get();
325 }
[email protected]2d511542012-03-07 09:13:34326 internal::FocusCycler* focus_cycler() {
327 return focus_cycler_.get();
328 }
[email protected]edbfb8d2012-09-03 08:33:43329 DisplayController* display_controller() {
[email protected]2e236a52012-06-27 22:21:47330 return display_controller_.get();
[email protected]3e1cdd312012-06-07 03:48:41331 }
[email protected]8b7ba87b2012-09-01 00:40:40332 internal::MouseCursorEventFilter* mouse_cursor_filter() {
333 return mouse_cursor_filter_.get();
334 }
[email protected]682990f2013-01-10 06:49:11335 internal::EventTransformationHandler* event_transformation_handler() {
336 return event_transformation_handler_.get();
337 }
[email protected]c0ff0342013-02-27 00:41:29338 views::corewm::CursorManager* cursor_manager() { return &cursor_manager_; }
[email protected]4a229e902011-12-01 21:21:11339
[email protected]3266c2b92011-11-14 00:06:08340 ShellDelegate* delegate() { return delegate_.get(); }
[email protected]aa54218b2012-06-12 16:51:42341
[email protected]10b22612012-03-22 17:07:55342 UserWallpaperDelegate* user_wallpaper_delegate() {
343 return user_wallpaper_delegate_.get();
344 }
[email protected]35304ce2011-12-14 23:21:01345
[email protected]f4c92b382012-08-28 00:59:59346 CapsLockDelegate* caps_lock_delegate() {
347 return caps_lock_delegate_.get();
348 }
349
[email protected]fcb123d2013-04-17 15:58:49350 SessionStateDelegate* session_state_delegate() {
351 return session_state_delegate_.get();
352 }
353
[email protected]f48075d2012-05-24 11:06:51354 HighContrastController* high_contrast_controller() {
355 return high_contrast_controller_.get();
356 }
357
[email protected]77f7c132012-11-15 06:52:54358 MagnificationController* magnification_controller() {
[email protected]c1c670172012-04-26 04:20:26359 return magnification_controller_.get();
360 }
[email protected]f48075d2012-05-24 11:06:51361
[email protected]77f7c132012-11-15 06:52:54362 PartialMagnificationController* partial_magnification_controller() {
363 return partial_magnification_controller_.get();
364 }
[email protected]d219a192012-12-14 00:08:18365 aura::client::ActivationClient* activation_client() {
366 return activation_client_;
367 }
[email protected]77f7c132012-11-15 06:52:54368
[email protected]6bdf7952012-11-14 10:10:58369 ScreenAsh* screen() { return screen_; }
[email protected]1a2145b2012-03-13 21:09:17370
[email protected]c758fbf2012-03-25 22:53:59371 // Force the shelf to query for it's current visibility state.
372 void UpdateShelfVisibility();
373
[email protected]431552c2012-10-23 00:38:33374 // TODO(oshima): Define an interface to access shelf/launcher
375 // state, or just use Launcher.
[email protected]c758fbf2012-03-25 22:53:59376
[email protected]431552c2012-10-23 00:38:33377 // Sets/gets the shelf auto-hide behavior on |root_window|.
378 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior,
379 aura::RootWindow* root_window);
380 ShelfAutoHideBehavior GetShelfAutoHideBehavior(
381 aura::RootWindow* root_window) const;
382
[email protected]431552c2012-10-23 00:38:33383 // Sets/gets shelf's alignment on |root_window|.
384 void SetShelfAlignment(ShelfAlignment alignment,
385 aura::RootWindow* root_window);
386 ShelfAlignment GetShelfAlignment(aura::RootWindow* root_window);
[email protected]55444502012-05-10 15:43:53387
[email protected]d90b8392012-06-13 09:34:56388 // Dims or undims the screen.
389 void SetDimming(bool should_dim);
390
[email protected]090c4f12012-10-29 18:56:42391 // Creates a modal background (a partially-opaque fullscreen window)
392 // on all displays for |window|.
393 void CreateModalBackground(aura::Window* window);
[email protected]c0ce80e2012-10-05 23:28:27394
395 // Called when a modal window is removed. It will activate
396 // another modal window if any, or remove modal screens
397 // on all displays.
398 void OnModalWindowRemoved(aura::Window* removed);
399
[email protected]88d71122012-10-18 07:11:01400 // Returns WebNotificationTray on the primary root window.
401 WebNotificationTray* GetWebNotificationTray();
[email protected]6d6546e2012-05-30 23:12:02402
[email protected]a0afeb12012-12-10 22:57:09403 // Does the primary display have status area?
404 bool HasPrimaryStatusArea();
405
406 // Returns the system tray on primary display.
407 SystemTray* GetPrimarySystemTray();
[email protected]bfb411312012-02-27 20:59:27408
[email protected]945f9cae2012-12-12 09:54:29409 SystemTrayDelegate* system_tray_delegate() {
[email protected]51ed5992012-11-07 10:14:39410 return system_tray_delegate_.get();
411 }
412
[email protected]83b2b84c2012-11-14 01:11:00413 SystemTrayNotifier* system_tray_notifier() {
414 return system_tray_notifier_.get();
415 }
416
[email protected]9488d4d2012-02-29 18:32:37417 static void set_initially_hide_cursor(bool hide) {
418 initially_hide_cursor_ = hide;
419 }
420
[email protected]e4a181cc2012-03-17 02:20:57421 internal::ResizeShadowController* resize_shadow_controller() {
422 return resize_shadow_controller_.get();
423 }
424
[email protected]a54e65b2011-11-21 22:03:34425 // Made available for tests.
[email protected]86f2b5e2012-11-14 20:37:00426 views::corewm::ShadowController* shadow_controller() {
[email protected]a54e65b2011-11-21 22:03:34427 return shadow_controller_.get();
428 }
429
[email protected]fa4a45832012-04-12 21:32:48430 content::BrowserContext* browser_context() { return browser_context_; }
431 void set_browser_context(content::BrowserContext* browser_context) {
432 browser_context_ = browser_context;
433 }
434
[email protected]2e236a52012-06-27 22:21:47435 // Initializes the root window to be used for a secondary display.
436 void InitRootWindowForSecondaryDisplay(aura::RootWindow* root);
[email protected]a857dbe2012-05-30 22:10:14437
[email protected]f9466702012-09-17 16:35:27438 // Starts the animation that occurs on first login.
439 void DoInitialWorkspaceAnimation();
440
[email protected]117542c2013-04-30 20:27:21441#if defined(OS_CHROMEOS) && defined(USE_X11)
[email protected]945ece962013-03-21 06:42:39442 // TODO(oshima): Move these objects to DisplayController.
[email protected]70b3e7d52012-06-02 22:12:25443 chromeos::OutputConfigurator* output_configurator() {
444 return output_configurator_.get();
445 }
[email protected]196e9452012-08-01 06:42:51446 internal::OutputConfiguratorAnimation* output_configurator_animation() {
447 return output_configurator_animation_.get();
448 }
[email protected]18b21b2e2013-03-01 20:56:23449 internal::DisplayErrorObserver* display_error_observer() {
450 return display_error_observer_.get();
451 }
[email protected]117542c2013-04-30 20:27:21452#endif // defined(OS_CHROMEOS) && defined(USE_X11)
[email protected]70b3e7d52012-06-02 22:12:25453
[email protected]8393aa62013-01-23 19:40:10454 RootWindowHostFactory* root_window_host_factory() {
455 return root_window_host_factory_.get();
456 }
457
[email protected]478c6c32013-03-09 02:50:58458 LauncherModel* launcher_model() {
459 return launcher_model_.get();
460 }
461
462 // Returns the launcher delegate, creating if necesary.
463 LauncherDelegate* GetLauncherDelegate();
464
[email protected]2b8a9bb2013-07-01 22:43:40465 void SetTouchHudProjectionEnabled(bool enabled);
466
467 bool is_touch_hud_projection_enabled() const {
468 return is_touch_hud_projection_enabled_;
469 }
470
[email protected]2b4cd302012-02-24 20:21:13471 private:
[email protected]c39be8f2012-06-15 22:58:36472 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor);
[email protected]1aad3322012-06-06 06:37:09473 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
474 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
[email protected]d90b8392012-06-13 09:34:56475 friend class internal::RootWindowController;
[email protected]0c68e892012-12-08 16:54:53476 friend class test::ShellTestApi;
[email protected]0af58042012-12-13 03:21:35477 friend class shell::WindowWatcher;
[email protected]ad0c8722012-03-02 20:17:45478
[email protected]cac10fc62011-10-07 23:22:56479 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
480
[email protected]09464c72013-04-26 07:31:28481 // Takes ownership of |delegate|.
[email protected]3266c2b92011-11-14 00:06:08482 explicit Shell(ShellDelegate* delegate);
483 virtual ~Shell();
484
485 void Init();
[email protected]b0639282011-12-22 21:12:27486
[email protected]be65be362012-06-15 07:38:23487 // Initializes the root window and root window controller so that it
[email protected]756bda12013-07-03 08:17:06488 // can host browser windows. |first_run_after_boot| is true for the
489 // primary display only first time after boot.
490 void InitRootWindowController(internal::RootWindowController* root,
491 bool first_run_after_boot);
[email protected]d90b8392012-06-13 09:34:56492
[email protected]c0ce80e2012-10-05 23:28:27493 // ash::internal::SystemModalContainerEventFilterDelegate overrides:
494 virtual bool CanWindowReceiveEvents(aura::Window* window) OVERRIDE;
495
[email protected]5097e692012-10-30 22:08:41496 // Overridden from ui::EventTarget:
[email protected]869f6352012-12-06 20:47:17497 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE;
[email protected]5097e692012-10-30 22:08:41498 virtual EventTarget* GetParentTarget() OVERRIDE;
[email protected]049cf34b2012-12-07 17:15:48499 virtual void OnEvent(ui::Event* event) OVERRIDE;
[email protected]5097e692012-10-30 22:08:41500
[email protected]1ae361652012-12-12 22:39:51501 // Overridden from aura::client::ActivationChangeObserver:
502 virtual void OnWindowActivated(aura::Window* gained_active,
503 aura::Window* lost_active) OVERRIDE;
504
[email protected]cac10fc62011-10-07 23:22:56505 static Shell* instance_;
506
[email protected]9488d4d2012-02-29 18:32:37507 // If set before the Shell is initialized, the mouse cursor will be hidden
508 // when the screen is initially created.
509 static bool initially_hide_cursor_;
510
[email protected]b0a8faa2012-10-19 03:22:22511 ScreenAsh* screen_;
[email protected]58482fa2012-03-02 14:57:39512
[email protected]f634dd32012-07-23 22:49:07513 // Active root window. Never becomes NULL during the session.
[email protected]a857dbe2012-05-30 22:10:14514 aura::RootWindow* active_root_window_;
515
[email protected]1aad3322012-06-06 06:37:09516 // The CompoundEventFilter owned by aura::Env object.
[email protected]4a59e4e2012-11-12 21:15:40517 scoped_ptr<views::corewm::CompoundEventFilter> env_filter_;
[email protected]627a62f2012-02-14 22:59:14518
[email protected]cac10fc62011-10-07 23:22:56519 std::vector<WindowAndBoundsPair> to_restore_;
520
[email protected]6e9f6aa2012-02-09 04:16:20521#if !defined(OS_MACOSX)
[email protected]8f80db0f2012-02-07 14:44:53522 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_;
523
[email protected]2f744282011-12-23 22:40:52524 scoped_ptr<AcceleratorController> accelerator_controller_;
[email protected]6e9f6aa2012-02-09 04:16:20525#endif // !defined(OS_MACOSX)
[email protected]745816be2011-11-22 05:08:30526
[email protected]2b99f8c2011-10-11 19:42:24527 scoped_ptr<ShellDelegate> delegate_;
[email protected]51ed5992012-11-07 10:14:39528 scoped_ptr<SystemTrayDelegate> system_tray_delegate_;
[email protected]83b2b84c2012-11-14 01:11:00529 scoped_ptr<SystemTrayNotifier> system_tray_notifier_;
[email protected]10b22612012-03-22 17:07:55530 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
[email protected]f4c92b382012-08-28 00:59:59531 scoped_ptr<CapsLockDelegate> caps_lock_delegate_;
[email protected]fcb123d2013-04-17 15:58:49532 scoped_ptr<SessionStateDelegate> session_state_delegate_;
[email protected]b913a3a2012-12-11 13:07:19533 scoped_ptr<LauncherDelegate> launcher_delegate_;
534
535 scoped_ptr<LauncherModel> launcher_model_;
[email protected]2b99f8c2011-10-11 19:42:24536
[email protected]0039db92012-05-09 04:11:45537 scoped_ptr<internal::AppListController> app_list_controller_;
[email protected]ae4987d2011-11-21 22:52:44538
[email protected]9fc206d2011-12-13 00:05:33539 scoped_ptr<internal::ActivationController> activation_controller_;
[email protected]60a978b72012-06-08 00:29:18540 scoped_ptr<internal::CaptureController> capture_controller_;
[email protected]084b6bb2011-11-17 05:18:16541 scoped_ptr<internal::DragDropController> drag_drop_controller_;
[email protected]e4a181cc2012-03-17 02:20:57542 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_;
[email protected]86f2b5e2012-11-14 20:37:00543 scoped_ptr<views::corewm::ShadowController> shadow_controller_;
[email protected]b5756e22012-11-30 01:32:02544 scoped_ptr<views::corewm::VisibilityController> visibility_controller_;
[email protected]0c2dc012012-12-02 00:00:23545 scoped_ptr<views::corewm::WindowModalityController>
546 window_modality_controller_;
[email protected]a1b7a822013-02-23 19:08:04547 scoped_ptr<views::corewm::TooltipController> tooltip_controller_;
[email protected]e70cf0ed2012-03-15 16:24:47548 scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
[email protected]e0d22e82012-01-04 00:46:57549 scoped_ptr<PowerButtonController> power_button_controller_;
[email protected]ab4f8c92013-05-30 19:07:47550 scoped_ptr<LockStateController> lock_state_controller_;
[email protected]c16b9422012-06-06 21:51:11551 scoped_ptr<UserActivityDetector> user_activity_detector_;
[email protected]6aa614a2012-01-19 22:13:38552 scoped_ptr<VideoDetector> video_detector_;
[email protected]40c4cbb2012-01-10 23:26:07553 scoped_ptr<WindowCycleController> window_cycle_controller_;
[email protected]3d29912a2012-02-07 07:41:51554 scoped_ptr<internal::FocusCycler> focus_cycler_;
[email protected]edbfb8d2012-09-03 08:33:43555 scoped_ptr<DisplayController> display_controller_;
[email protected]f48075d2012-05-24 11:06:51556 scoped_ptr<HighContrastController> high_contrast_controller_;
[email protected]77f7c132012-11-15 06:52:54557 scoped_ptr<MagnificationController> magnification_controller_;
558 scoped_ptr<PartialMagnificationController> partial_magnification_controller_;
[email protected]8cfb6722012-11-28 03:28:46559 scoped_ptr<aura::client::FocusClient> focus_client_;
[email protected]c28853612012-05-31 22:43:44560 scoped_ptr<aura::client::UserActionClient> user_action_client_;
[email protected]39718b52012-12-03 17:24:56561 aura::client::ActivationClient* activation_client_;
[email protected]78d96302012-06-22 00:58:07562 scoped_ptr<internal::MouseCursorEventFilter> mouse_cursor_filter_;
[email protected]8d625fb2012-07-18 16:40:06563 scoped_ptr<internal::ScreenPositionController> screen_position_controller_;
[email protected]c0ce80e2012-10-05 23:28:27564 scoped_ptr<internal::SystemModalContainerEventFilter> modality_filter_;
[email protected]e67291f12012-10-10 05:52:38565 scoped_ptr<internal::EventClientImpl> event_client_;
[email protected]682990f2013-01-10 06:49:11566 scoped_ptr<internal::EventTransformationHandler>
567 event_transformation_handler_;
[email protected]fca90ea2012-12-14 04:13:30568 scoped_ptr<RootWindowHostFactory> root_window_host_factory_;
[email protected]ae18b9112011-11-07 16:59:13569
[email protected]b9d224c2012-07-13 01:09:03570 // An event filter that rewrites or drops an event.
571 scoped_ptr<internal::EventRewriterEventFilter> event_rewriter_filter_;
[email protected]6e9f6aa2012-02-09 04:16:20572
[email protected]0b0b0742012-02-16 13:23:45573 // An event filter that pre-handles key events while the partial
[email protected]a1584a712012-07-30 21:02:26574 // screenshot UI or the keyboard overlay is active.
[email protected]9ae32df2012-07-26 03:25:18575 scoped_ptr<internal::OverlayEventFilter> overlay_filter_;
[email protected]0b0b0742012-02-16 13:23:45576
[email protected]435b212e2012-04-05 19:43:37577 // An event filter which handles system level gestures
578 scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_;
579
[email protected]6e9f6aa2012-02-09 04:16:20580#if !defined(OS_MACOSX)
[email protected]745816be2011-11-22 05:08:30581 // An event filter that pre-handles global accelerators.
[email protected]2f744282011-12-23 22:40:52582 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_;
[email protected]6e9f6aa2012-02-09 04:16:20583#endif
[email protected]745816be2011-11-22 05:08:30584
[email protected]42f06f92012-03-27 00:57:57585 // An event filter that pre-handles all key events to send them to an IME.
[email protected]4a59e4e2012-11-12 21:15:40586 scoped_ptr<views::corewm::InputMethodEventFilter> input_method_filter_;
[email protected]42f06f92012-03-27 00:57:57587
[email protected]6bdf7952012-11-14 10:10:58588 scoped_ptr<internal::DisplayManager> display_manager_;
[email protected]607419ad2013-05-23 19:58:40589 scoped_ptr<internal::MirrorWindowController> mirror_window_controller_;
[email protected]6bdf7952012-11-14 10:10:58590
[email protected]117542c2013-04-30 20:27:21591#if defined(OS_CHROMEOS) && defined(USE_X11)
[email protected]70b3e7d52012-06-02 22:12:25592 // Controls video output device state.
593 scoped_ptr<chromeos::OutputConfigurator> output_configurator_;
[email protected]196e9452012-08-01 06:42:51594 scoped_ptr<internal::OutputConfiguratorAnimation>
595 output_configurator_animation_;
[email protected]18b21b2e2013-03-01 20:56:23596 scoped_ptr<internal::DisplayErrorObserver> display_error_observer_;
[email protected]6bdf7952012-11-14 10:10:58597
598 // Receives output change events and udpates the display manager.
599 scoped_ptr<internal::DisplayChangeObserverX11> display_change_observer_;
[email protected]117542c2013-04-30 20:27:21600#endif // defined(OS_CHROMEOS) && defined(USE_X11)
[email protected]70b3e7d52012-06-02 22:12:25601
[email protected]c0ff0342013-02-27 00:41:29602 // |native_cursor_manager_| is owned by |cursor_manager_|, but we keep a
603 // pointer to vend to test code.
604 AshNativeCursorManager* native_cursor_manager_;
605 views::corewm::CursorManager cursor_manager_;
[email protected]4b8003c2012-07-26 00:54:19606
[email protected]1a2145b2012-03-13 21:09:17607 ObserverList<ShellObserver> observers_;
608
[email protected]fa4a45832012-04-12 21:32:48609 // Used by ash/shell.
610 content::BrowserContext* browser_context_;
611
[email protected]852a55d2012-10-17 13:30:30612 // For testing only: simulate that a modal window is open
613 bool simulate_modal_window_open_for_testing_;
614
[email protected]2b8a9bb2013-07-01 22:43:40615 bool is_touch_hud_projection_enabled_;
616
[email protected]87b0d82e2011-10-07 21:02:59617 DISALLOW_COPY_AND_ASSIGN(Shell);
618};
619
[email protected]55f593352011-12-24 05:42:46620} // namespace ash
[email protected]87b0d82e2011-10-07 21:02:59621
[email protected]b65bdda2011-12-23 23:35:31622#endif // ASH_SHELL_H_