blob: d86fd28b1927842502e6308b0062a3b6b482da30 [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
dchenga94547472016-04-08 08:41:118#include <memory>
[email protected]cac10fc62011-10-07 23:22:569#include <utility>
10#include <vector>
11
[email protected]b65bdda2011-12-23 23:35:3112#include "ash/ash_export.h"
jamescook1b474d6a2016-06-04 05:56:0013#include "ash/common/shelf/shelf_types.h"
[email protected]5d2ea362013-12-13 08:10:1814#include "ash/metrics/user_metrics_recorder.h"
[email protected]e76096a5f2014-04-08 04:08:0315#include "ash/wm/cursor_manager_chromeos.h"
[email protected]c0ce80e2012-10-05 23:28:2716#include "ash/wm/system_modal_container_event_filter_delegate.h"
[email protected]b0639282011-12-22 21:12:2717#include "base/gtest_prod_util.h"
avidb567a8a2015-12-20 17:07:2418#include "base/macros.h"
[email protected]6f67df52013-10-29 01:07:1519#include "base/memory/weak_ptr.h"
[email protected]1a2145b2012-03-13 21:09:1720#include "base/observer_list.h"
[email protected]c9390bd2013-11-08 20:33:1321#include "ui/aura/window.h"
[email protected]940fb1c2013-06-18 16:54:2822#include "ui/base/ui_base_types.h"
oshimaf84b0da722016-04-27 19:47:1923#include "ui/display/screen.h"
[email protected]86ccbd42013-09-18 18:11:5424#include "ui/events/event_target.h"
Avi Drissmanfefc2f82014-12-22 19:25:2925#include "ui/gfx/geometry/insets.h"
26#include "ui/gfx/geometry/size.h"
[email protected]ee3ed10772014-03-11 22:02:0127#include "ui/wm/core/cursor_manager.h"
[email protected]87b0d82e2011-10-07 21:02:5928
29namespace aura {
[email protected]e29014c2011-11-16 18:25:5130class EventFilter;
[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 {
[email protected]39718b52012-12-03 17:24:5634class ActivationClient;
[email protected]8cfb6722012-11-28 03:28:4635class FocusClient;
[email protected]c28853612012-05-31 22:43:4436}
[email protected]87b0d82e2011-10-07 21:02:5937}
[email protected]fa4a45832012-04-12 21:32:4838
ben0d6be2d42015-09-26 04:37:1939namespace base {
40class SequencedWorkerPool;
41}
42
warx533c8f62016-04-12 01:19:4343namespace chromeos {
44class AudioA11yController;
45}
46
[email protected]2b99f8c2011-10-11 19:42:2447namespace gfx {
[email protected]9ec0f452012-05-31 15:58:5348class ImageSkia;
[email protected]b5f30602012-01-30 15:16:5749class Point;
[email protected]cac10fc62011-10-07 23:22:5650class Rect;
51}
[email protected]b6ba05d902013-10-04 21:38:4552
[email protected]a8bd1cb2012-02-17 23:05:5453namespace ui {
[email protected]1e31cbd2014-04-07 20:06:1154class DisplayConfigurator;
[email protected]a8bd1cb2012-02-17 23:05:5455class Layer;
derat2d4e62d2015-01-09 16:09:1756class UserActivityDetector;
[email protected]b0fa7012014-04-16 12:50:5757class UserActivityPowerManagerNotifier;
[email protected]a8bd1cb2012-02-17 23:05:5458}
[email protected]57b8bb352012-01-11 05:11:4659namespace views {
60class NonClientFrameView;
riajiang957bb6a2016-07-22 17:00:2361class PointerWatcher;
[email protected]57b8bb352012-01-11 05:11:4662class Widget;
[email protected]4a59e4e2012-11-12 21:15:4063namespace corewm {
[email protected]e319c7e2014-03-14 19:56:1464class TooltipController;
65}
66}
67
68namespace wm {
[email protected]60d677d2014-05-30 13:07:0269class AcceleratorFilter;
[email protected]4a59e4e2012-11-12 21:15:4070class CompoundEventFilter;
[email protected]86f2b5e2012-11-14 20:37:0071class ShadowController;
[email protected]b5756e22012-11-30 01:32:0272class VisibilityController;
[email protected]0c2dc012012-12-02 00:00:2373class WindowModalityController;
[email protected]4a59e4e2012-11-12 21:15:4074}
[email protected]87b0d82e2011-10-07 21:02:5975
[email protected]55f593352011-12-24 05:42:4676namespace ash {
[email protected]87b0d82e2011-10-07 21:02:5977
sky44a09892016-07-20 17:46:5878class AcceleratorControllerDelegateAura;
[email protected]c0ff0342013-02-27 00:41:2979class AshNativeCursorManager;
[email protected]55398d22013-10-10 19:49:2080class AutoclickController;
[email protected]b3142722014-03-04 06:59:5081class BluetoothNotificationController;
[email protected]60a978b72012-06-08 00:29:1882class CaptureController;
[email protected]093b8d642014-04-03 20:59:2883class DesktopBackgroundController;
[email protected]c1234a42013-08-20 09:35:4084class DisplayChangeObserver;
robert.bradfordab052492015-05-06 11:09:5685class DisplayColorManager;
stevenjb537c5c3f2016-01-20 23:38:1286class DisplayConfigurationController;
oshimae2818922015-07-28 01:18:5287class WindowTreeHostManager;
[email protected]18b21b2e2013-03-01 20:56:2388class DisplayErrorObserver;
[email protected]6bdf7952012-11-14 10:10:5889class DisplayManager;
[email protected]084b6bb2011-11-17 05:18:1690class DragDropController;
[email protected]e67291f12012-10-10 05:52:3891class EventClientImpl;
[email protected]b9d224c2012-07-13 01:09:0392class EventRewriterEventFilter;
[email protected]682990f2013-01-10 06:49:1193class EventTransformationHandler;
[email protected]093b8d642014-04-03 20:59:2894class FirstRunHelper;
[email protected]093b8d642014-04-03 20:59:2895class GPUSupport;
96class HighContrastController;
yusukes1168eda2016-04-27 07:52:0897class LinkHandlerModelFactory;
[email protected]a9a40462013-07-31 06:22:5698class LocaleNotificationController;
[email protected]093b8d642014-04-03 20:59:2899class LockStateController;
mswb2416052016-06-24 21:23:45100enum class LoginStatus;
[email protected]093b8d642014-04-03 20:59:28101class MagnificationController;
[email protected]78d96302012-06-22 00:58:07102class MouseCursorEventFilter;
[email protected]9ae32df2012-07-26 03:25:18103class OverlayEventFilter;
[email protected]093b8d642014-04-03 20:59:28104class PartialMagnificationController;
riajiang957bb6a2016-07-22 17:00:23105class PointerWatcherDelegate;
[email protected]093b8d642014-04-03 20:59:28106class PowerButtonController;
[email protected]51625052013-10-10 01:40:16107class PowerEventObserver;
[email protected]72bce522014-02-10 21:11:26108class ProjectingObserver;
[email protected]e4a181cc2012-03-17 02:20:57109class ResizeShadowController;
[email protected]6ef71d72013-08-10 18:13:44110class ResolutionNotificationController;
[email protected]d90b8392012-06-13 09:34:56111class RootWindowController;
sky6624a7af2016-05-27 18:47:49112class ScopedOverviewAnimationSettingsFactoryAura;
[email protected]093b8d642014-04-03 20:59:28113class ScreenAsh;
jonross0af45212015-01-13 18:55:46114class ScreenOrientationController;
oshima5a296e82016-04-29 01:32:27115class ScreenshotController;
hidehiko6821ca42016-06-18 11:12:23116class ScreenPinningController;
[email protected]8d625fb2012-07-18 16:40:06117class ScreenPositionController;
[email protected]093b8d642014-04-03 20:59:28118class SessionStateDelegate;
119class Shelf;
[email protected]093b8d642014-04-03 20:59:28120class ShellDelegate;
[email protected]1b4c7472014-05-15 18:32:23121struct ShellInitParams;
[email protected]9861f1752012-06-01 07:16:14122class SlowAnimationEventFilter;
[email protected]6d6546e2012-05-30 23:12:02123class StatusAreaWidget;
[email protected]093b8d642014-04-03 20:59:28124class StickyKeysController;
[email protected]9ae32df2012-07-26 03:25:18125class SystemGestureEventFilter;
[email protected]c0ce80e2012-10-05 23:28:27126class SystemModalContainerEventFilter;
[email protected]093b8d642014-04-03 20:59:28127class SystemTray;
[email protected]093b8d642014-04-03 20:59:28128class ToplevelWindowEventHandler;
[email protected]03122891a2014-05-13 23:56:49129class TouchTransformerController;
[email protected]73074742012-05-17 01:44:41130class TouchObserverHUD;
[email protected]093b8d642014-04-03 20:59:28131class UserWallpaperDelegate;
bsheeaae09a2014-09-22 23:16:52132class VirtualKeyboardController;
[email protected]ded58fd2013-10-09 07:56:55133class VideoActivityNotifier;
[email protected]093b8d642014-04-03 20:59:28134class VideoDetector;
135class WebNotificationTray;
[email protected]093b8d642014-04-03 20:59:28136class WindowPositioner;
sky0702b272016-06-03 22:10:41137class WmShellAura;
sky80556bc42016-06-07 22:46:13138class WmWindow;
[email protected]2b99f8c2011-10-11 19:42:24139
[email protected]0af58042012-12-13 03:21:35140namespace shell {
141class WindowWatcher;
142}
143
[email protected]0c68e892012-12-08 16:54:53144namespace test {
145class ShellTestApi;
146}
147
[email protected]87b0d82e2011-10-07 21:02:59148// Shell is a singleton object that presents the Shell API and implements the
[email protected]99f07e02011-12-07 00:02:59149// RootWindow's delegate interface.
[email protected]b0079a92012-01-25 20:13:38150//
151// Upon creation, the Shell sets itself as the RootWindow's delegate, which
152// takes ownership of the Shell.
[email protected]093b8d642014-04-03 20:59:28153class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate,
jamescook4545062c2016-08-02 18:48:01154 public ui::EventTarget {
[email protected]87b0d82e2011-10-07 21:02:59155 public:
[email protected]093b8d642014-04-03 20:59:28156 typedef std::vector<RootWindowController*> RootWindowControllerList;
[email protected]be65be362012-06-15 07:38:23157
[email protected]3266c2b92011-11-14 00:06:08158 // A shell must be explicitly created so that it can call |Init()| with the
159 // delegate set. |delegate| can be NULL (if not required for initialization).
[email protected]09464c72013-04-26 07:31:28160 // Takes ownership of |delegate|.
[email protected]1b4c7472014-05-15 18:32:23161 static Shell* CreateInstance(const ShellInitParams& init_params);
[email protected]3266c2b92011-11-14 00:06:08162
163 // Should never be called before |CreateInstance()|.
[email protected]cac10fc62011-10-07 23:22:56164 static Shell* GetInstance();
[email protected]3266c2b92011-11-14 00:06:08165
[email protected]b3b7bcd2012-03-06 19:35:45166 // Returns true if the ash shell has been instantiated.
167 static bool HasInstance();
168
[email protected]ef589af2011-12-03 01:07:15169 static void DeleteInstance();
[email protected]cac10fc62011-10-07 23:22:56170
[email protected]d90b8392012-06-13 09:34:56171 // Returns the root window controller for the primary root window.
[email protected]a0afeb12012-12-10 22:57:09172 // TODO(oshima): move this to |RootWindowController|
[email protected]093b8d642014-04-03 20:59:28173 static RootWindowController* GetPrimaryRootWindowController();
[email protected]d90b8392012-06-13 09:34:56174
[email protected]cf1c70e2012-08-30 01:13:02175 // Returns all root window controllers.
[email protected]a0afeb12012-12-10 22:57:09176 // TODO(oshima): move this to |RootWindowController|
[email protected]be65be362012-06-15 07:38:23177 static RootWindowControllerList GetAllRootWindowControllers();
178
[email protected]bf9cdb362013-10-25 19:22:45179 // Returns the primary root Window. The primary root Window is the one that
180 // has a launcher.
181 static aura::Window* GetPrimaryRootWindow();
[email protected]e73bd7802012-02-17 20:10:34182
[email protected]bf9cdb362013-10-25 19:22:45183 // Returns a root Window when used as a target when creating a new window.
[email protected]b42910f2013-08-01 11:45:29184 // The root window of the active window is used in most cases, but can
jamescook4545062c2016-08-02 18:48:01185 // be overridden by using ScopedRootWindowForNewWindows.
[email protected]bf9cdb362013-10-25 19:22:45186 // If you want to get the root Window of the active window, just use
[email protected]b42910f2013-08-01 11:45:29187 // |wm::GetActiveWindow()->GetRootWindow()|.
[email protected]bf9cdb362013-10-25 19:22:45188 static aura::Window* GetTargetRootWindow();
[email protected]a857dbe2012-05-30 22:10:14189
oshima06b39602016-05-11 02:40:10190 // Returns the id of the display::Display corresponding to the window returned
mfomitcheva1a8aa62016-05-03 16:23:26191 // by |GetTargetRootWindow()|
192 static int64_t GetTargetDisplayId();
193
[email protected]cf1c70e2012-08-30 01:13:02194 // Returns all root windows.
[email protected]c9390bd2013-11-08 20:33:13195 static aura::Window::Windows GetAllRootWindows();
[email protected]be65be362012-06-15 07:38:23196
[email protected]bf9cdb362013-10-25 19:22:45197 static aura::Window* GetContainer(aura::Window* root_window,
[email protected]7b0f7502012-06-11 00:12:39198 int container_id);
[email protected]bf9cdb362013-10-25 19:22:45199 static const aura::Window* GetContainer(const aura::Window* root_window,
[email protected]e67291f12012-10-10 05:52:38200 int container_id);
[email protected]7b0f7502012-06-11 00:12:39201
202 // Returns the list of containers that match |container_id| in
[email protected]429433f2012-12-28 20:14:46203 // all root windows. If |priority_root| is given, the container
204 // in the |priority_root| will be inserted at the top of the list.
205 static std::vector<aura::Window*> GetContainersFromAllRootWindows(
206 int container_id,
[email protected]bf9cdb362013-10-25 19:22:45207 aura::Window* priority_root);
[email protected]7b0f7502012-06-11 00:12:39208
[email protected]cb054f972012-10-11 20:27:28209 // Shows the context menu for the background and launcher at
[email protected]431552c2012-10-23 00:38:33210 // |location_in_screen| (in screen coordinates).
[email protected]940fb1c2013-06-18 16:54:28211 void ShowContextMenu(const gfx::Point& location_in_screen,
212 ui::MenuSourceType source_type);
[email protected]cac10fc62011-10-07 23:22:56213
[email protected]57b8bb352012-01-11 05:11:46214 // Creates a default views::NonClientFrameView for use by windows in the
215 // Ash environment.
216 views::NonClientFrameView* CreateDefaultNonClientFrameView(
217 views::Widget* widget);
218
mswad28b252016-08-09 02:42:07219 // Sets work area insets of the display containing |window|, pings observers.
[email protected]2e236a52012-06-27 22:21:47220 void SetDisplayWorkAreaInsets(aura::Window* window,
[email protected]8a45c972012-03-14 18:22:44221 const gfx::Insets& insets);
[email protected]1a2145b2012-03-13 21:09:17222
[email protected]82d3954ae2012-04-20 09:02:22223 // Called when the user logs in.
skye79274a2016-06-08 05:39:02224 void OnLoginStateChanged(LoginStatus status);
[email protected]82d3954ae2012-04-20 09:02:22225
[email protected]51f438112013-11-18 19:32:50226 // Called after the logged-in user's profile is ready.
227 void OnLoginUserProfilePrepared();
228
[email protected]88d71122012-10-18 07:11:01229 // Called when the login status changes.
230 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
skye79274a2016-06-08 05:39:02231 void UpdateAfterLoginStatusChange(LoginStatus status);
[email protected]88d71122012-10-18 07:11:01232
[email protected]82d3954ae2012-04-20 09:02:22233 // Called when the application is exiting.
234 void OnAppTerminating();
235
236 // Called when the screen is locked (after the lock window is visible) or
237 // unlocked.
238 void OnLockStateChanged(bool locked);
239
[email protected]58868abf2014-01-17 23:45:33240 // Called when a casting session is started or stopped.
241 void OnCastingSessionStartedOrStopped(bool started);
242
[email protected]0e3e7cb2014-04-12 05:18:25243 // Called when a root window is created.
sky80556bc42016-06-07 22:46:13244 void OnRootWindowAdded(WmWindow* root_window);
[email protected]0e3e7cb2014-04-12 05:18:25245
[email protected]864b58552013-12-19 04:19:38246 // Initializes |shelf_|. Does nothing if it's already initialized.
247 void CreateShelf();
[email protected]d9456cb2012-03-21 16:41:04248
[email protected]b8642ec2014-04-17 05:20:39249 // Called when the shelf is created for |root_window|.
sky80556bc42016-06-07 22:46:13250 void OnShelfCreatedForRootWindow(WmWindow* root_window);
[email protected]b8642ec2014-04-17 05:20:39251
[email protected]e1b299b2014-01-29 23:53:41252 // Creates a virtual keyboard. Deletes the old virtual keyboard if it already
253 // exists.
[email protected]51f438112013-11-18 19:32:50254 void CreateKeyboard();
255
[email protected]e1b299b2014-01-29 23:53:41256 // Deactivates the virtual keyboard.
257 void DeactivateKeyboard();
258
[email protected]99c5ed82013-10-18 01:30:04259 // Show shelf view if it was created hidden (before session has started).
[email protected]864b58552013-12-19 04:19:38260 void ShowShelf();
[email protected]7e1df2f62012-07-19 19:17:18261
riajiang957bb6a2016-07-22 17:00:23262 void AddPointerWatcher(views::PointerWatcher* watcher);
263 void RemovePointerWatcher(views::PointerWatcher* watcher);
jamescook214fcbde2016-04-28 01:16:06264
[email protected]da285852014-05-27 19:53:43265#if defined(OS_CHROMEOS)
266 // Test if MaximizeModeWindowManager is not enabled, and if
267 // MaximizeModeController is not currently setting a display rotation. Or if
268 // the |resolution_notification_controller_| is not showing its confirmation
269 // dialog. If true then changes to display settings can be saved.
270 bool ShouldSaveDisplaySettings();
271#endif
272
sky44a09892016-07-20 17:46:58273 AcceleratorControllerDelegateAura* accelerator_controller_delegate() {
274 return accelerator_controller_delegate_.get();
275 }
[email protected]6e9f6aa2012-02-09 04:16:20276
[email protected]093b8d642014-04-03 20:59:28277 DisplayManager* display_manager() { return display_manager_.get(); }
stevenjb537c5c3f2016-01-20 23:38:12278 DisplayConfigurationController* display_configuration_controller() {
279 return display_configuration_controller_.get();
280 }
jamescookb8dcef522016-06-25 14:42:55281 ::wm::CompoundEventFilter* env_filter() { return env_filter_.get(); }
[email protected]a1b7a822013-02-23 19:08:04282 views::corewm::TooltipController* tooltip_controller() {
[email protected]862deef2011-12-15 22:07:33283 return tooltip_controller_.get();
[email protected]4a229e902011-12-01 21:21:11284 }
[email protected]093b8d642014-04-03 20:59:28285 OverlayEventFilter* overlay_filter() { return overlay_filter_.get(); }
[email protected]e70cf0ed2012-03-15 16:24:47286 DesktopBackgroundController* desktop_background_controller() {
287 return desktop_background_controller_.get();
288 }
yusukes1168eda2016-04-27 07:52:08289 LinkHandlerModelFactory* link_handler_model_factory() {
290 return link_handler_model_factory_;
291 }
292 void set_link_handler_model_factory(
293 LinkHandlerModelFactory* link_handler_model_factory) {
294 link_handler_model_factory_ = link_handler_model_factory;
295 }
[email protected]e0d22e82012-01-04 00:46:57296 PowerButtonController* power_button_controller() {
297 return power_button_controller_.get();
298 }
[email protected]ab4f8c92013-05-30 19:07:47299 LockStateController* lock_state_controller() {
300 return lock_state_controller_.get();
[email protected]222f40c2012-10-18 08:58:13301 }
jamescookb8dcef522016-06-25 14:42:55302 VideoDetector* video_detector() { return video_detector_.get(); }
oshimae2818922015-07-28 01:18:52303 WindowTreeHostManager* window_tree_host_manager() {
304 return window_tree_host_manager_.get();
[email protected]3e1cdd312012-06-07 03:48:41305 }
dnicoara8c3bd1e62014-10-30 19:53:39306#if defined(OS_CHROMEOS)
chirantan40e4cd82015-02-19 01:08:19307 PowerEventObserver* power_event_observer() {
308 return power_event_observer_.get();
309 }
[email protected]03122891a2014-05-13 23:56:49310 TouchTransformerController* touch_transformer_controller() {
311 return touch_transformer_controller_.get();
312 }
dnicoara8c3bd1e62014-10-30 19:53:39313#endif // defined(OS_CHROMEOS)
oshima5a296e82016-04-29 01:32:27314 ScreenshotController* screenshot_controller() {
315 return screenshot_controller_.get();
mukai19274bdd2015-02-24 22:37:48316 }
[email protected]093b8d642014-04-03 20:59:28317 MouseCursorEventFilter* mouse_cursor_filter() {
[email protected]8b7ba87b2012-09-01 00:40:40318 return mouse_cursor_filter_.get();
319 }
[email protected]093b8d642014-04-03 20:59:28320 EventTransformationHandler* event_transformation_handler() {
[email protected]682990f2013-01-10 06:49:11321 return event_transformation_handler_.get();
322 }
sadrul7a8785e2016-02-12 21:54:35323 ::wm::CursorManager* cursor_manager() { return cursor_manager_.get(); }
[email protected]4a229e902011-12-01 21:21:11324
[email protected]10b22612012-03-22 17:07:55325 UserWallpaperDelegate* user_wallpaper_delegate() {
326 return user_wallpaper_delegate_.get();
327 }
[email protected]35304ce2011-12-14 23:21:01328
[email protected]fcb123d2013-04-17 15:58:49329 SessionStateDelegate* session_state_delegate() {
330 return session_state_delegate_.get();
331 }
332
[email protected]f48075d2012-05-24 11:06:51333 HighContrastController* high_contrast_controller() {
334 return high_contrast_controller_.get();
335 }
336
[email protected]77f7c132012-11-15 06:52:54337 MagnificationController* magnification_controller() {
[email protected]c1c670172012-04-26 04:20:26338 return magnification_controller_.get();
339 }
[email protected]f48075d2012-05-24 11:06:51340
[email protected]77f7c132012-11-15 06:52:54341 PartialMagnificationController* partial_magnification_controller() {
342 return partial_magnification_controller_.get();
343 }
[email protected]55398d22013-10-10 19:49:20344
345 AutoclickController* autoclick_controller() {
346 return autoclick_controller_.get();
347 }
348
[email protected]d219a192012-12-14 00:08:18349 aura::client::ActivationClient* activation_client() {
350 return activation_client_;
351 }
[email protected]77f7c132012-11-15 06:52:54352
jamescookb8dcef522016-06-25 14:42:55353 base::SequencedWorkerPool* blocking_pool() { return blocking_pool_; }
ben0d6be2d42015-09-26 04:37:19354
[email protected]c758fbf2012-03-25 22:53:59355 // Force the shelf to query for it's current visibility state.
jamescook6afad6d2016-06-01 00:35:01356 // TODO(jamescook): Move to Shelf.
[email protected]c758fbf2012-03-25 22:53:59357 void UpdateShelfVisibility();
358
msw953caf1f2016-03-18 00:33:29359 // Called when the alignment for a shelf changes.
jamescook6afad6d2016-06-01 00:35:01360 // TODO(jamescook): Move to Shelf.
sky80556bc42016-06-07 22:46:13361 void OnShelfAlignmentChanged(WmWindow* root_window);
[email protected]55444502012-05-10 15:43:53362
msw174379b2016-04-05 00:25:11363 // Called when the auto-hide behavior for a shelf changes.
jamescook6afad6d2016-06-01 00:35:01364 // TODO(jamescook): Move to Shelf.
sky80556bc42016-06-07 22:46:13365 void OnShelfAutoHideBehaviorChanged(WmWindow* root_window);
msw174379b2016-04-05 00:25:11366
[email protected]375069e2013-10-04 13:54:31367 // Notifies |observers_| when entering or exiting fullscreen mode in
368 // |root_window|.
hidehiko066b6f72016-06-16 12:29:10369 // TODO(hidehiko): Rename this to NotifyFullscreenStateChanged.
sky80556bc42016-06-07 22:46:13370 void NotifyFullscreenStateChange(bool is_fullscreen, WmWindow* root_window);
[email protected]375069e2013-10-04 13:54:31371
[email protected]090c4f12012-10-29 18:56:42372 // Creates a modal background (a partially-opaque fullscreen window)
373 // on all displays for |window|.
374 void CreateModalBackground(aura::Window* window);
[email protected]c0ce80e2012-10-05 23:28:27375
376 // Called when a modal window is removed. It will activate
377 // another modal window if any, or remove modal screens
378 // on all displays.
379 void OnModalWindowRemoved(aura::Window* removed);
380
[email protected]88d71122012-10-18 07:11:01381 // Returns WebNotificationTray on the primary root window.
382 WebNotificationTray* GetWebNotificationTray();
[email protected]6d6546e2012-05-30 23:12:02383
[email protected]a0afeb12012-12-10 22:57:09384 // Does the primary display have status area?
385 bool HasPrimaryStatusArea();
386
387 // Returns the system tray on primary display.
388 SystemTray* GetPrimarySystemTray();
[email protected]bfb411312012-02-27 20:59:27389
[email protected]9488d4d2012-02-29 18:32:37390 static void set_initially_hide_cursor(bool hide) {
391 initially_hide_cursor_ = hide;
392 }
393
[email protected]093b8d642014-04-03 20:59:28394 ResizeShadowController* resize_shadow_controller() {
[email protected]e4a181cc2012-03-17 02:20:57395 return resize_shadow_controller_.get();
396 }
397
[email protected]a54e65b2011-11-21 22:03:34398 // Made available for tests.
[email protected]e319c7e2014-03-14 19:56:14399 ::wm::ShadowController* shadow_controller() {
[email protected]a54e65b2011-11-21 22:03:34400 return shadow_controller_.get();
401 }
402
[email protected]f9466702012-09-17 16:35:27403 // Starts the animation that occurs on first login.
404 void DoInitialWorkspaceAnimation();
405
[email protected]7bc49bd2014-01-22 09:30:34406#if defined(OS_CHROMEOS)
oshimae2818922015-07-28 01:18:52407 // TODO(oshima): Move these objects to WindowTreeHostManager.
[email protected]1e31cbd2014-04-07 20:06:11408 ui::DisplayConfigurator* display_configurator() {
409 return display_configurator_.get();
[email protected]70b3e7d52012-06-02 22:12:25410 }
[email protected]093b8d642014-04-03 20:59:28411 DisplayErrorObserver* display_error_observer() {
[email protected]18b21b2e2013-03-01 20:56:23412 return display_error_observer_.get();
413 }
[email protected]70b3e7d52012-06-02 22:12:25414
[email protected]093b8d642014-04-03 20:59:28415 ResolutionNotificationController* resolution_notification_controller() {
[email protected]6ef71d72013-08-10 18:13:44416 return resolution_notification_controller_.get();
417 }
[email protected]0dc85512014-03-13 13:26:41418
jonross0af45212015-01-13 18:55:46419 ScreenOrientationController* screen_orientation_controller() {
420 return screen_orientation_controller_.get();
jonrossf21fea12014-11-13 01:22:51421 }
422
rsadamc727b6a2014-10-31 18:59:33423 VirtualKeyboardController* virtual_keyboard_controller() {
424 return virtual_keyboard_controller_.get();
425 }
warx533c8f62016-04-12 01:19:43426
427 chromeos::AudioA11yController* audio_a11y_controller() {
428 return audio_a11y_controller_.get();
429 }
[email protected]7bc49bd2014-01-22 09:30:34430#endif // defined(OS_CHROMEOS)
[email protected]6ef71d72013-08-10 18:13:44431
jamescookb8dcef522016-06-25 14:42:55432 WindowPositioner* window_positioner() { return window_positioner_.get(); }
[email protected]e9a71312013-10-04 03:20:01433
jamescookb8dcef522016-06-25 14:42:55434 UserMetricsRecorder* metrics() { return user_metrics_recorder_.get(); }
[email protected]5d2ea362013-12-13 08:10:18435
[email protected]2b8a9bb2013-07-01 22:43:40436 void SetTouchHudProjectionEnabled(bool enabled);
437
438 bool is_touch_hud_projection_enabled() const {
439 return is_touch_hud_projection_enabled_;
440 }
441
skye782a262016-05-31 20:28:57442 // TODO(sky): remove this. This was needed by sysui, but as sysui is going
443 // away it should no longer be needed.
skyfee520c2016-02-11 19:57:46444 bool in_mus() const { return in_mus_; }
445
[email protected]59ccade2013-10-17 17:56:40446#if defined(OS_CHROMEOS)
447 // Creates instance of FirstRunHelper. Caller is responsible for deleting
448 // returned object.
449 ash::FirstRunHelper* CreateFirstRunHelper();
[email protected]f94c6aa2013-11-08 01:18:54450
[email protected]87ec2202014-02-06 06:24:27451 // Toggles cursor compositing on/off. Native cursor is disabled when cursor
452 // compositing is enabled, and vice versa.
453 void SetCursorCompositingEnabled(bool enabled);
454
[email protected]08bdabed2013-12-20 07:52:28455 StickyKeysController* sticky_keys_controller() {
456 return sticky_keys_controller_.get();
[email protected]f94c6aa2013-11-08 01:18:54457 }
hidehiko6821ca42016-06-18 11:12:23458
[email protected]59ccade2013-10-17 17:56:40459#endif // defined(OS_CHROMEOS)
460
hidehiko6821ca42016-06-18 11:12:23461 ScreenPinningController* screen_pinning_controller() {
462 return screen_pinning_controller_.get();
463 }
464
[email protected]1d2a7212014-01-16 06:09:48465 GPUSupport* gpu_support() { return gpu_support_.get(); }
[email protected]1d2a7212014-01-16 06:09:48466
[email protected]2b4cd302012-02-24 20:21:13467 private:
[email protected]c39be8f2012-06-15 22:58:36468 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor);
[email protected]1aad3322012-06-06 06:37:09469 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
470 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
[email protected]093b8d642014-04-03 20:59:28471 friend class RootWindowController;
[email protected]0c68e892012-12-08 16:54:53472 friend class test::ShellTestApi;
[email protected]0af58042012-12-13 03:21:35473 friend class shell::WindowWatcher;
[email protected]ad0c8722012-03-02 20:17:45474
[email protected]cac10fc62011-10-07 23:22:56475 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
476
[email protected]09464c72013-04-26 07:31:28477 // Takes ownership of |delegate|.
ben0d6be2d42015-09-26 04:37:19478 Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool);
dcheng1f4538e2014-10-27 23:57:05479 ~Shell() override;
[email protected]3266c2b92011-11-14 00:06:08480
[email protected]1b4c7472014-05-15 18:32:23481 void Init(const ShellInitParams& init_params);
[email protected]b0639282011-12-22 21:12:27482
[email protected]51f438112013-11-18 19:32:50483 // Initializes virtual keyboard controller.
484 void InitKeyboard();
[email protected]b6ba05d902013-10-04 21:38:45485
[email protected]a273d33a2013-10-17 12:41:21486 // Initializes the root window so that it can host browser windows.
[email protected]41baaed2013-11-09 04:18:26487 void InitRootWindow(aura::Window* root_window);
[email protected]d90b8392012-06-13 09:34:56488
jamescookf17ee242016-05-25 21:22:00489 // Prepares the shelf to be deleted.
490 void ShutdownShelf();
jdufault551152e2016-01-27 19:48:43491
hariank0dd03dd2016-07-14 23:47:33492 // SystemModalContainerEventFilterDelegate:
dcheng1f4538e2014-10-27 23:57:05493 bool CanWindowReceiveEvents(aura::Window* window) override;
[email protected]c0ce80e2012-10-05 23:28:27494
[email protected]5097e692012-10-30 22:08:41495 // Overridden from ui::EventTarget:
dcheng1f4538e2014-10-27 23:57:05496 bool CanAcceptEvent(const ui::Event& event) override;
497 EventTarget* GetParentTarget() override;
dchenga94547472016-04-08 08:41:11498 std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override;
dcheng1f4538e2014-10-27 23:57:05499 ui::EventTargeter* GetEventTargeter() override;
[email protected]5097e692012-10-30 22:08:41500
[email protected]cac10fc62011-10-07 23:22:56501 static Shell* instance_;
502
[email protected]9488d4d2012-02-29 18:32:37503 // If set before the Shell is initialized, the mouse cursor will be hidden
504 // when the screen is initially created.
505 static bool initially_hide_cursor_;
506
sky6624a7af2016-05-27 18:47:49507 std::unique_ptr<ScopedOverviewAnimationSettingsFactoryAura>
508 scoped_overview_animation_settings_factory_;
sky0702b272016-06-03 22:10:41509 std::unique_ptr<WmShellAura> wm_shell_;
sky984c1892016-04-20 00:00:34510
[email protected]1aad3322012-06-06 06:37:09511 // The CompoundEventFilter owned by aura::Env object.
dchenga94547472016-04-08 08:41:11512 std::unique_ptr<::wm::CompoundEventFilter> env_filter_;
[email protected]627a62f2012-02-14 22:59:14513
[email protected]cac10fc62011-10-07 23:22:56514 std::vector<WindowAndBoundsPair> to_restore_;
515
dchenga94547472016-04-08 08:41:11516 std::unique_ptr<UserMetricsRecorder> user_metrics_recorder_;
sky44a09892016-07-20 17:46:58517 std::unique_ptr<AcceleratorControllerDelegateAura>
518 accelerator_controller_delegate_;
dchenga94547472016-04-08 08:41:11519 std::unique_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
520 std::unique_ptr<SessionStateDelegate> session_state_delegate_;
riajiang957bb6a2016-07-22 17:00:23521 std::unique_ptr<PointerWatcherDelegate> pointer_watcher_delegate_;
dchenga94547472016-04-08 08:41:11522 std::unique_ptr<WindowPositioner> window_positioner_;
[email protected]2b99f8c2011-10-11 19:42:24523
dchenga94547472016-04-08 08:41:11524 std::unique_ptr<DragDropController> drag_drop_controller_;
525 std::unique_ptr<ResizeShadowController> resize_shadow_controller_;
526 std::unique_ptr<::wm::ShadowController> shadow_controller_;
527 std::unique_ptr<::wm::VisibilityController> visibility_controller_;
528 std::unique_ptr<::wm::WindowModalityController> window_modality_controller_;
529 std::unique_ptr<views::corewm::TooltipController> tooltip_controller_;
530 std::unique_ptr<DesktopBackgroundController> desktop_background_controller_;
yusukes1168eda2016-04-27 07:52:08531 LinkHandlerModelFactory* link_handler_model_factory_;
dchenga94547472016-04-08 08:41:11532 std::unique_ptr<PowerButtonController> power_button_controller_;
533 std::unique_ptr<LockStateController> lock_state_controller_;
dchenga94547472016-04-08 08:41:11534 std::unique_ptr<ui::UserActivityDetector> user_activity_detector_;
535 std::unique_ptr<VideoDetector> video_detector_;
dchenga94547472016-04-08 08:41:11536 std::unique_ptr<WindowTreeHostManager> window_tree_host_manager_;
537 std::unique_ptr<HighContrastController> high_contrast_controller_;
538 std::unique_ptr<MagnificationController> magnification_controller_;
539 std::unique_ptr<PartialMagnificationController>
540 partial_magnification_controller_;
541 std::unique_ptr<AutoclickController> autoclick_controller_;
542 std::unique_ptr<aura::client::FocusClient> focus_client_;
mfomitchev493ed602016-04-09 00:48:39543
[email protected]39718b52012-12-03 17:24:56544 aura::client::ActivationClient* activation_client_;
sky984c1892016-04-20 00:00:34545
oshima5a296e82016-04-29 01:32:27546 std::unique_ptr<ScreenshotController> screenshot_controller_;
[email protected]f5c9dbc2014-04-11 08:13:45547
dchenga94547472016-04-08 08:41:11548 std::unique_ptr<MouseCursorEventFilter> mouse_cursor_filter_;
549 std::unique_ptr<ScreenPositionController> screen_position_controller_;
550 std::unique_ptr<SystemModalContainerEventFilter> modality_filter_;
551 std::unique_ptr<EventClientImpl> event_client_;
552 std::unique_ptr<EventTransformationHandler> event_transformation_handler_;
[email protected]ae18b9112011-11-07 16:59:13553
[email protected]0b0b0742012-02-16 13:23:45554 // An event filter that pre-handles key events while the partial
[email protected]a1584a712012-07-30 21:02:26555 // screenshot UI or the keyboard overlay is active.
dchenga94547472016-04-08 08:41:11556 std::unique_ptr<OverlayEventFilter> overlay_filter_;
[email protected]0b0b0742012-02-16 13:23:45557
[email protected]3537d472014-01-15 05:45:31558 // An event filter which handles moving and resizing windows.
dchenga94547472016-04-08 08:41:11559 std::unique_ptr<ToplevelWindowEventHandler> toplevel_window_event_handler_;
[email protected]3537d472014-01-15 05:45:31560
[email protected]435b212e2012-04-05 19:43:37561 // An event filter which handles system level gestures
dchenga94547472016-04-08 08:41:11562 std::unique_ptr<SystemGestureEventFilter> system_gesture_filter_;
[email protected]435b212e2012-04-05 19:43:37563
[email protected]745816be2011-11-22 05:08:30564 // An event filter that pre-handles global accelerators.
dchenga94547472016-04-08 08:41:11565 std::unique_ptr<::wm::AcceleratorFilter> accelerator_filter_;
[email protected]745816be2011-11-22 05:08:30566
dchenga94547472016-04-08 08:41:11567 std::unique_ptr<DisplayManager> display_manager_;
568 std::unique_ptr<DisplayConfigurationController>
569 display_configuration_controller_;
[email protected]6bdf7952012-11-14 10:10:58570
dchenga94547472016-04-08 08:41:11571 std::unique_ptr<LocaleNotificationController> locale_notification_controller_;
hidehiko6821ca42016-06-18 11:12:23572 std::unique_ptr<ScreenPinningController> screen_pinning_controller_;
[email protected]a9a40462013-07-31 06:22:56573
[email protected]ded58fd2013-10-09 07:56:55574#if defined(OS_CHROMEOS)
dchenga94547472016-04-08 08:41:11575 std::unique_ptr<PowerEventObserver> power_event_observer_;
576 std::unique_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
577 std::unique_ptr<VideoActivityNotifier> video_activity_notifier_;
578 std::unique_ptr<StickyKeysController> sticky_keys_controller_;
579 std::unique_ptr<ResolutionNotificationController>
[email protected]7bc49bd2014-01-22 09:30:34580 resolution_notification_controller_;
dchenga94547472016-04-08 08:41:11581 std::unique_ptr<BluetoothNotificationController>
[email protected]b3142722014-03-04 06:59:50582 bluetooth_notification_controller_;
dchenga94547472016-04-08 08:41:11583 std::unique_ptr<VirtualKeyboardController> virtual_keyboard_controller_;
warx533c8f62016-04-12 01:19:43584 std::unique_ptr<chromeos::AudioA11yController> audio_a11y_controller_;
[email protected]70b3e7d52012-06-02 22:12:25585 // Controls video output device state.
dchenga94547472016-04-08 08:41:11586 std::unique_ptr<ui::DisplayConfigurator> display_configurator_;
587 std::unique_ptr<DisplayColorManager> display_color_manager_;
588 std::unique_ptr<DisplayErrorObserver> display_error_observer_;
589 std::unique_ptr<ProjectingObserver> projecting_observer_;
[email protected]6bdf7952012-11-14 10:10:58590
[email protected]c1234a42013-08-20 09:35:40591 // Listens for output changes and updates the display manager.
dchenga94547472016-04-08 08:41:11592 std::unique_ptr<DisplayChangeObserver> display_change_observer_;
[email protected]3dff2ef2014-02-09 22:50:39593
jonross0af45212015-01-13 18:55:46594 // Implements content::ScreenOrientationController for ChromeOS
dchenga94547472016-04-08 08:41:11595 std::unique_ptr<ScreenOrientationController> screen_orientation_controller_;
jonrossf21fea12014-11-13 01:22:51596
dchenga94547472016-04-08 08:41:11597 std::unique_ptr<TouchTransformerController> touch_transformer_controller_;
dnicoara8c3bd1e62014-10-30 19:53:39598
dchenga94547472016-04-08 08:41:11599 std::unique_ptr<ui::EventHandler> magnifier_key_scroll_handler_;
600 std::unique_ptr<ui::EventHandler> speech_feedback_handler_;
[email protected]ded58fd2013-10-09 07:56:55601#endif // defined(OS_CHROMEOS)
[email protected]70b3e7d52012-06-02 22:12:25602
[email protected]c0ff0342013-02-27 00:41:29603 // |native_cursor_manager_| is owned by |cursor_manager_|, but we keep a
604 // pointer to vend to test code.
605 AshNativeCursorManager* native_cursor_manager_;
[email protected]e76096a5f2014-04-08 04:08:03606
sadrul7a8785e2016-02-12 21:54:35607 // Cursor may be hidden on certain key events in ChromeOS, whereas we never
608 // hide the cursor on Windows.
dchenga94547472016-04-08 08:41:11609 std::unique_ptr<::wm::CursorManager> cursor_manager_;
[email protected]4b8003c2012-07-26 00:54:19610
[email protected]852a55d2012-10-17 13:30:30611 // For testing only: simulate that a modal window is open
612 bool simulate_modal_window_open_for_testing_;
613
[email protected]2b8a9bb2013-07-01 22:43:40614 bool is_touch_hud_projection_enabled_;
615
[email protected]1d2a7212014-01-16 06:09:48616 // Injected content::GPUDataManager support.
dchenga94547472016-04-08 08:41:11617 std::unique_ptr<GPUSupport> gpu_support_;
[email protected]1d2a7212014-01-16 06:09:48618
ben0d6be2d42015-09-26 04:37:19619 base::SequencedWorkerPool* blocking_pool_;
620
skyfee520c2016-02-11 19:57:46621 bool in_mus_ = false;
622
[email protected]87b0d82e2011-10-07 21:02:59623 DISALLOW_COPY_AND_ASSIGN(Shell);
624};
625
[email protected]55f593352011-12-24 05:42:46626} // namespace ash
[email protected]87b0d82e2011-10-07 21:02:59627
[email protected]b65bdda2011-12-23 23:35:31628#endif // ASH_SHELL_H_