blob: 718d1f839d3396ec08c96e42418b8b702ad041f1 [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]87b0d82e2011-10-07 21:02:5930namespace aura {
[email protected]e29014c2011-11-16 18:25:5131class EventFilter;
[email protected]35304ce2011-12-14 23:21:0132class RootWindow;
[email protected]87b0d82e2011-10-07 21:02:5933class Window;
[email protected]c28853612012-05-31 22:43:4434namespace client {
[email protected]39718b52012-12-03 17:24:5635class ActivationClient;
[email protected]8cfb6722012-11-28 03:28:4636class FocusClient;
[email protected]c28853612012-05-31 22:43:4437class UserActionClient;
38}
[email protected]87b0d82e2011-10-07 21:02:5939}
[email protected]70b3e7d52012-06-02 22:12:2540namespace chromeos {
41class OutputConfigurator;
42}
[email protected]fa4a45832012-04-12 21:32:4843namespace content {
44class BrowserContext;
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]a8bd1cb2012-02-17 23:05:5452namespace ui {
53class Layer;
54}
[email protected]57b8bb352012-01-11 05:11:4655namespace views {
56class NonClientFrameView;
57class Widget;
[email protected]4a59e4e2012-11-12 21:15:4058namespace corewm {
59class CompoundEventFilter;
60class InputMethodEventFilter;
[email protected]86f2b5e2012-11-14 20:37:0061class ShadowController;
[email protected]a1b7a822013-02-23 19:08:0462class TooltipController;
[email protected]b5756e22012-11-30 01:32:0263class VisibilityController;
[email protected]0c2dc012012-12-02 00:00:2364class WindowModalityController;
[email protected]4a59e4e2012-11-12 21:15:4065}
[email protected]57b8bb352012-01-11 05:11:4666}
[email protected]87b0d82e2011-10-07 21:02:5967
[email protected]55f593352011-12-24 05:42:4668namespace ash {
[email protected]87b0d82e2011-10-07 21:02:5969
[email protected]2f744282011-12-23 22:40:5270class AcceleratorController;
[email protected]c0ff0342013-02-27 00:41:2971class AshNativeCursorManager;
[email protected]f4c92b382012-08-28 00:59:5972class CapsLockDelegate;
[email protected]e70cf0ed2012-03-15 16:24:4773class DesktopBackgroundController;
[email protected]edbfb8d2012-09-03 08:33:4374class DisplayController;
[email protected]f48075d2012-05-24 11:06:5175class HighContrastController;
[email protected]671a2ae2011-10-13 21:53:2376class Launcher;
[email protected]b913a3a2012-12-11 13:07:1977class LauncherDelegate;
[email protected]cc29ba12013-08-28 05:22:3478class LauncherItemDelegateManager;
[email protected]b913a3a2012-12-11 13:07:1979class LauncherModel;
[email protected]77f7c132012-11-15 06:52:5480class MagnificationController;
[email protected]66c5c4112013-07-31 07:10:5981class MruWindowTracker;
[email protected]8f80db0f2012-02-07 14:44:5382class NestedDispatcherController;
[email protected]77f7c132012-11-15 06:52:5483class PartialMagnificationController;
[email protected]e0d22e82012-01-04 00:46:5784class PowerButtonController;
[email protected]fca90ea2012-12-14 04:13:3085class RootWindowHostFactory;
[email protected]1a2145b2012-03-13 21:09:1786class ScreenAsh;
[email protected]ab4f8c92013-05-30 19:07:4787class LockStateController;
[email protected]fcb123d2013-04-17 15:58:4988class SessionStateDelegate;
[email protected]2b99f8c2011-10-11 19:42:2489class ShellDelegate;
[email protected]1a2145b2012-03-13 21:09:1790class ShellObserver;
[email protected]bfb411312012-02-27 20:59:2791class SystemTray;
[email protected]51ed5992012-11-07 10:14:3992class SystemTrayDelegate;
[email protected]83b2b84c2012-11-14 01:11:0093class SystemTrayNotifier;
[email protected]c16b9422012-06-06 21:51:1194class UserActivityDetector;
[email protected]10b22612012-03-22 17:07:5595class UserWallpaperDelegate;
[email protected]6aa614a2012-01-19 22:13:3896class VideoDetector;
[email protected]88d71122012-10-18 07:11:0197class WebNotificationTray;
[email protected]40c4cbb2012-01-10 23:26:0798class WindowCycleController;
[email protected]d24ce2c2013-08-01 15:14:1999class WindowSelectorController;
[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]cc29ba12013-08-28 05:22:34105class AppListLauncherItemDelegate;
[email protected]60a978b72012-06-08 00:29:18106class CaptureController;
[email protected]c1234a42013-08-20 09:35:40107class DisplayChangeObserver;
[email protected]18b21b2e2013-03-01 20:56:23108class DisplayErrorObserver;
[email protected]6bdf7952012-11-14 10:10:58109class DisplayManager;
[email protected]084b6bb2011-11-17 05:18:16110class DragDropController;
[email protected]e67291f12012-10-10 05:52:38111class EventClientImpl;
[email protected]b9d224c2012-07-13 01:09:03112class EventRewriterEventFilter;
[email protected]682990f2013-01-10 06:49:11113class EventTransformationHandler;
[email protected]3d29912a2012-02-07 07:41:51114class FocusCycler;
[email protected]a9a40462013-07-31 06:22:56115class LocaleNotificationController;
[email protected]78d96302012-06-22 00:58:07116class MouseCursorEventFilter;
[email protected]196e9452012-08-01 06:42:51117class OutputConfiguratorAnimation;
[email protected]9ae32df2012-07-26 03:25:18118class OverlayEventFilter;
[email protected]e4a181cc2012-03-17 02:20:57119class ResizeShadowController;
[email protected]6ef71d72013-08-10 18:13:44120class ResolutionNotificationController;
[email protected]d90b8392012-06-13 09:34:56121class RootWindowController;
[email protected]b0079a92012-01-25 20:13:38122class RootWindowLayoutManager;
[email protected]b42910f2013-08-01 11:45:29123class ScopedTargetRootWindow;
[email protected]8d625fb2012-07-18 16:40:06124class ScreenPositionController;
[email protected]9861f1752012-06-01 07:16:14125class SlowAnimationEventFilter;
[email protected]6d6546e2012-05-30 23:12:02126class StatusAreaWidget;
[email protected]9ae32df2012-07-26 03:25:18127class SystemGestureEventFilter;
[email protected]c0ce80e2012-10-05 23:28:27128class SystemModalContainerEventFilter;
[email protected]73074742012-05-17 01:44:41129class TouchObserverHUD;
[email protected]60fa9bba2011-10-28 21:21:51130}
[email protected]2b99f8c2011-10-11 19:42:24131
[email protected]0af58042012-12-13 03:21:35132namespace shell {
133class WindowWatcher;
134}
135
[email protected]0c68e892012-12-08 16:54:53136namespace test {
137class ShellTestApi;
138}
139
[email protected]87b0d82e2011-10-07 21:02:59140// Shell is a singleton object that presents the Shell API and implements the
[email protected]99f07e02011-12-07 00:02:59141// RootWindow's delegate interface.
[email protected]b0079a92012-01-25 20:13:38142//
143// Upon creation, the Shell sets itself as the RootWindow's delegate, which
144// takes ownership of the Shell.
[email protected]1ae361652012-12-12 22:39:51145class ASH_EXPORT Shell
146 : public internal::SystemModalContainerEventFilterDelegate,
147 public ui::EventTarget,
148 public aura::client::ActivationChangeObserver {
[email protected]87b0d82e2011-10-07 21:02:59149 public:
[email protected]be65be362012-06-15 07:38:23150 typedef std::vector<aura::RootWindow*> RootWindowList;
151 typedef std::vector<internal::RootWindowController*> RootWindowControllerList;
152
[email protected]3d29912a2012-02-07 07:41:51153 enum Direction {
154 FORWARD,
155 BACKWARD
156 };
157
[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]3266c2b92011-11-14 00:06:08161 static Shell* CreateInstance(ShellDelegate* delegate);
162
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]d90b8392012-06-13 09:34:56173 static internal::RootWindowController* GetPrimaryRootWindowController();
174
[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
179 // Returns the primary RootWindow. The primary RootWindow is the one
[email protected]42713f72012-05-25 00:41:50180 // that has a launcher.
181 static aura::RootWindow* GetPrimaryRootWindow();
[email protected]e73bd7802012-02-17 20:10:34182
[email protected]b42910f2013-08-01 11:45:29183 // Returns a RootWindow when used as a target when creating a new window.
184 // The root window of the active window is used in most cases, but can
185 // be overridden by using ScopedTargetRootWindow().
186 // If you want to get a RootWindow of the active window, just use
187 // |wm::GetActiveWindow()->GetRootWindow()|.
188 // TODO(oshima): Rename to GetTargetRootWindow() crbug.com/266378.
[email protected]a857dbe2012-05-30 22:10:14189 static aura::RootWindow* GetActiveRootWindow();
190
[email protected]ffabb1e2012-10-12 19:51:17191 // Returns the global Screen object that's always active in ash.
192 static gfx::Screen* GetScreen();
193
[email protected]cf1c70e2012-08-30 01:13:02194 // Returns all root windows.
[email protected]be65be362012-06-15 07:38:23195 static RootWindowList GetAllRootWindows();
196
[email protected]7b0f7502012-06-11 00:12:39197 static aura::Window* GetContainer(aura::RootWindow* root_window,
198 int container_id);
[email protected]e67291f12012-10-10 05:52:38199 static const aura::Window* GetContainer(const aura::RootWindow* root_window,
200 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,
207 aura::RootWindow* priority_root);
[email protected]7b0f7502012-06-11 00:12:39208
[email protected]a4016f12013-05-02 07:53:47209 // True if an experimental maximize mode is enabled which forces browser and
210 // application windows to be maximized only.
211 static bool IsForcedMaximizeMode();
212
[email protected]b42910f2013-08-01 11:45:29213 void set_active_root_window(aura::RootWindow* target_root_window) {
214 target_root_window_ = target_root_window;
[email protected]a857dbe2012-05-30 22:10:14215 }
216
[email protected]cb054f972012-10-11 20:27:28217 // Shows the context menu for the background and launcher at
[email protected]431552c2012-10-23 00:38:33218 // |location_in_screen| (in screen coordinates).
[email protected]940fb1c2013-06-18 16:54:28219 void ShowContextMenu(const gfx::Point& location_in_screen,
220 ui::MenuSourceType source_type);
[email protected]cac10fc62011-10-07 23:22:56221
[email protected]b913a3a2012-12-11 13:07:19222 // Toggles the app list. |window| specifies in which display the app
223 // list should be shown. If this is NULL, the active root window
224 // will be used.
225 void ToggleAppList(aura::Window* anchor);
[email protected]ae4987d2011-11-21 22:52:44226
[email protected]7510d1082012-03-30 21:58:34227 // Returns app list target visibility.
228 bool GetAppListTargetVisibility() const;
229
[email protected]1e51a9d2012-04-09 23:31:11230 // Returns app list window or NULL if it is not visible.
231 aura::Window* GetAppListWindow();
232
[email protected]dc09739372012-11-15 20:17:39233 // Returns true if a system-modal dialog window is currently open.
234 bool IsSystemModalWindowOpen() const;
[email protected]40c4cbb2012-01-10 23:26:07235
[email protected]852a55d2012-10-17 13:30:30236 // For testing only: set simulation that a modal window is open
237 void SimulateModalWindowOpenForTesting(bool modal_window_open) {
238 simulate_modal_window_open_for_testing_ = modal_window_open;
239 }
240
[email protected]57b8bb352012-01-11 05:11:46241 // Creates a default views::NonClientFrameView for use by windows in the
242 // Ash environment.
243 views::NonClientFrameView* CreateDefaultNonClientFrameView(
244 views::Widget* widget);
245
[email protected]d9456cb2012-03-21 16:41:04246 // Rotates focus through containers that can receive focus.
[email protected]3d29912a2012-02-07 07:41:51247 void RotateFocus(Direction direction);
248
[email protected]2e236a52012-06-27 22:21:47249 // Sets the work area insets of the display that contains |window|,
[email protected]8a45c972012-03-14 18:22:44250 // this notifies observers too.
[email protected]27f6af62012-03-21 05:34:40251 // TODO(sky): this no longer really replicates what happens and is unreliable.
252 // Remove this.
[email protected]2e236a52012-06-27 22:21:47253 void SetDisplayWorkAreaInsets(aura::Window* window,
[email protected]8a45c972012-03-14 18:22:44254 const gfx::Insets& insets);
[email protected]1a2145b2012-03-13 21:09:17255
[email protected]82d3954ae2012-04-20 09:02:22256 // Called when the user logs in.
257 void OnLoginStateChanged(user::LoginStatus status);
258
[email protected]88d71122012-10-18 07:11:01259 // Called when the login status changes.
260 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
261 void UpdateAfterLoginStatusChange(user::LoginStatus status);
262
[email protected]82d3954ae2012-04-20 09:02:22263 // Called when the application is exiting.
264 void OnAppTerminating();
265
266 // Called when the screen is locked (after the lock window is visible) or
267 // unlocked.
268 void OnLockStateChanged(bool locked);
269
[email protected]d9456cb2012-03-21 16:41:04270 // Initializes |launcher_|. Does nothing if it's already initialized.
271 void CreateLauncher();
272
[email protected]7e1df2f62012-07-19 19:17:18273 // Show launcher view if it was created hidden (before session has started).
274 void ShowLauncher();
275
[email protected]d9456cb2012-03-21 16:41:04276 // Adds/removes observer.
[email protected]1a2145b2012-03-13 21:09:17277 void AddShellObserver(ShellObserver* observer);
278 void RemoveShellObserver(ShellObserver* observer);
279
[email protected]6e9f6aa2012-02-09 04:16:20280#if !defined(OS_MACOSX)
[email protected]2f744282011-12-23 22:40:52281 AcceleratorController* accelerator_controller() {
[email protected]745816be2011-11-22 05:08:30282 return accelerator_controller_.get();
283 }
[email protected]6e9f6aa2012-02-09 04:16:20284#endif // !defined(OS_MACOSX)
285
[email protected]6bdf7952012-11-14 10:10:58286 internal::DisplayManager* display_manager() {
287 return display_manager_.get();
288 }
[email protected]f1d5c3a2013-04-23 17:42:56289 views::corewm::InputMethodEventFilter* input_method_filter() {
290 return input_method_filter_.get();
291 }
[email protected]4a59e4e2012-11-12 21:15:40292 views::corewm::CompoundEventFilter* env_filter() {
[email protected]492533b32012-09-21 19:06:14293 return env_filter_.get();
[email protected]627a62f2012-02-14 22:59:14294 }
[email protected]a1b7a822013-02-23 19:08:04295 views::corewm::TooltipController* tooltip_controller() {
[email protected]862deef2011-12-15 22:07:33296 return tooltip_controller_.get();
[email protected]4a229e902011-12-01 21:21:11297 }
[email protected]b9d224c2012-07-13 01:09:03298 internal::EventRewriterEventFilter* event_rewriter_filter() {
299 return event_rewriter_filter_.get();
[email protected]42f06f92012-03-27 00:57:57300 }
[email protected]9ae32df2012-07-26 03:25:18301 internal::OverlayEventFilter* overlay_filter() {
302 return overlay_filter_.get();
[email protected]0b0b0742012-02-16 13:23:45303 }
[email protected]e70cf0ed2012-03-15 16:24:47304 DesktopBackgroundController* desktop_background_controller() {
305 return desktop_background_controller_.get();
306 }
[email protected]e0d22e82012-01-04 00:46:57307 PowerButtonController* power_button_controller() {
308 return power_button_controller_.get();
309 }
[email protected]ab4f8c92013-05-30 19:07:47310 LockStateController* lock_state_controller() {
311 return lock_state_controller_.get();
[email protected]222f40c2012-10-18 08:58:13312 }
[email protected]66c5c4112013-07-31 07:10:59313 MruWindowTracker* mru_window_tracker() {
314 return mru_window_tracker_.get();
315 }
[email protected]c16b9422012-06-06 21:51:11316 UserActivityDetector* user_activity_detector() {
317 return user_activity_detector_.get();
318 }
[email protected]6aa614a2012-01-19 22:13:38319 VideoDetector* video_detector() {
320 return video_detector_.get();
321 }
[email protected]40c4cbb2012-01-10 23:26:07322 WindowCycleController* window_cycle_controller() {
323 return window_cycle_controller_.get();
324 }
[email protected]d24ce2c2013-08-01 15:14:19325 WindowSelectorController* window_selector_controller() {
326 return window_selector_controller_.get();
327 }
[email protected]2d511542012-03-07 09:13:34328 internal::FocusCycler* focus_cycler() {
329 return focus_cycler_.get();
330 }
[email protected]edbfb8d2012-09-03 08:33:43331 DisplayController* display_controller() {
[email protected]2e236a52012-06-27 22:21:47332 return display_controller_.get();
[email protected]3e1cdd312012-06-07 03:48:41333 }
[email protected]8b7ba87b2012-09-01 00:40:40334 internal::MouseCursorEventFilter* mouse_cursor_filter() {
335 return mouse_cursor_filter_.get();
336 }
[email protected]682990f2013-01-10 06:49:11337 internal::EventTransformationHandler* event_transformation_handler() {
338 return event_transformation_handler_.get();
339 }
[email protected]c0ff0342013-02-27 00:41:29340 views::corewm::CursorManager* cursor_manager() { return &cursor_manager_; }
[email protected]4a229e902011-12-01 21:21:11341
[email protected]3266c2b92011-11-14 00:06:08342 ShellDelegate* delegate() { return delegate_.get(); }
[email protected]aa54218b2012-06-12 16:51:42343
[email protected]10b22612012-03-22 17:07:55344 UserWallpaperDelegate* user_wallpaper_delegate() {
345 return user_wallpaper_delegate_.get();
346 }
[email protected]35304ce2011-12-14 23:21:01347
[email protected]f4c92b382012-08-28 00:59:59348 CapsLockDelegate* caps_lock_delegate() {
349 return caps_lock_delegate_.get();
350 }
351
[email protected]fcb123d2013-04-17 15:58:49352 SessionStateDelegate* session_state_delegate() {
353 return session_state_delegate_.get();
354 }
355
[email protected]f48075d2012-05-24 11:06:51356 HighContrastController* high_contrast_controller() {
357 return high_contrast_controller_.get();
358 }
359
[email protected]77f7c132012-11-15 06:52:54360 MagnificationController* magnification_controller() {
[email protected]c1c670172012-04-26 04:20:26361 return magnification_controller_.get();
362 }
[email protected]f48075d2012-05-24 11:06:51363
[email protected]77f7c132012-11-15 06:52:54364 PartialMagnificationController* partial_magnification_controller() {
365 return partial_magnification_controller_.get();
366 }
[email protected]d219a192012-12-14 00:08:18367 aura::client::ActivationClient* activation_client() {
368 return activation_client_;
369 }
[email protected]77f7c132012-11-15 06:52:54370
[email protected]cc29ba12013-08-28 05:22:34371 LauncherItemDelegateManager* launcher_item_delegate_manager() {
372 return launcher_item_delegate_manager_.get();
373 }
374
[email protected]6bdf7952012-11-14 10:10:58375 ScreenAsh* screen() { return screen_; }
[email protected]1a2145b2012-03-13 21:09:17376
[email protected]c758fbf2012-03-25 22:53:59377 // Force the shelf to query for it's current visibility state.
378 void UpdateShelfVisibility();
379
[email protected]431552c2012-10-23 00:38:33380 // TODO(oshima): Define an interface to access shelf/launcher
381 // state, or just use Launcher.
[email protected]c758fbf2012-03-25 22:53:59382
[email protected]431552c2012-10-23 00:38:33383 // Sets/gets the shelf auto-hide behavior on |root_window|.
384 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior,
385 aura::RootWindow* root_window);
386 ShelfAutoHideBehavior GetShelfAutoHideBehavior(
387 aura::RootWindow* root_window) const;
388
[email protected]431552c2012-10-23 00:38:33389 // Sets/gets shelf's alignment on |root_window|.
390 void SetShelfAlignment(ShelfAlignment alignment,
391 aura::RootWindow* root_window);
392 ShelfAlignment GetShelfAlignment(aura::RootWindow* root_window);
[email protected]55444502012-05-10 15:43:53393
[email protected]d90b8392012-06-13 09:34:56394 // Dims or undims the screen.
395 void SetDimming(bool should_dim);
396
[email protected]090c4f12012-10-29 18:56:42397 // Creates a modal background (a partially-opaque fullscreen window)
398 // on all displays for |window|.
399 void CreateModalBackground(aura::Window* window);
[email protected]c0ce80e2012-10-05 23:28:27400
401 // Called when a modal window is removed. It will activate
402 // another modal window if any, or remove modal screens
403 // on all displays.
404 void OnModalWindowRemoved(aura::Window* removed);
405
[email protected]88d71122012-10-18 07:11:01406 // Returns WebNotificationTray on the primary root window.
407 WebNotificationTray* GetWebNotificationTray();
[email protected]6d6546e2012-05-30 23:12:02408
[email protected]a0afeb12012-12-10 22:57:09409 // Does the primary display have status area?
410 bool HasPrimaryStatusArea();
411
412 // Returns the system tray on primary display.
413 SystemTray* GetPrimarySystemTray();
[email protected]bfb411312012-02-27 20:59:27414
[email protected]945f9cae2012-12-12 09:54:29415 SystemTrayDelegate* system_tray_delegate() {
[email protected]51ed5992012-11-07 10:14:39416 return system_tray_delegate_.get();
417 }
418
[email protected]83b2b84c2012-11-14 01:11:00419 SystemTrayNotifier* system_tray_notifier() {
420 return system_tray_notifier_.get();
421 }
422
[email protected]9488d4d2012-02-29 18:32:37423 static void set_initially_hide_cursor(bool hide) {
424 initially_hide_cursor_ = hide;
425 }
426
[email protected]e4a181cc2012-03-17 02:20:57427 internal::ResizeShadowController* resize_shadow_controller() {
428 return resize_shadow_controller_.get();
429 }
430
[email protected]a54e65b2011-11-21 22:03:34431 // Made available for tests.
[email protected]86f2b5e2012-11-14 20:37:00432 views::corewm::ShadowController* shadow_controller() {
[email protected]a54e65b2011-11-21 22:03:34433 return shadow_controller_.get();
434 }
435
[email protected]fa4a45832012-04-12 21:32:48436 content::BrowserContext* browser_context() { return browser_context_; }
437 void set_browser_context(content::BrowserContext* browser_context) {
438 browser_context_ = browser_context;
439 }
440
[email protected]2e236a52012-06-27 22:21:47441 // Initializes the root window to be used for a secondary display.
442 void InitRootWindowForSecondaryDisplay(aura::RootWindow* root);
[email protected]a857dbe2012-05-30 22:10:14443
[email protected]f9466702012-09-17 16:35:27444 // Starts the animation that occurs on first login.
445 void DoInitialWorkspaceAnimation();
446
[email protected]117542c2013-04-30 20:27:21447#if defined(OS_CHROMEOS) && defined(USE_X11)
[email protected]945ece962013-03-21 06:42:39448 // TODO(oshima): Move these objects to DisplayController.
[email protected]70b3e7d52012-06-02 22:12:25449 chromeos::OutputConfigurator* output_configurator() {
450 return output_configurator_.get();
451 }
[email protected]196e9452012-08-01 06:42:51452 internal::OutputConfiguratorAnimation* output_configurator_animation() {
453 return output_configurator_animation_.get();
454 }
[email protected]18b21b2e2013-03-01 20:56:23455 internal::DisplayErrorObserver* display_error_observer() {
456 return display_error_observer_.get();
457 }
[email protected]117542c2013-04-30 20:27:21458#endif // defined(OS_CHROMEOS) && defined(USE_X11)
[email protected]70b3e7d52012-06-02 22:12:25459
[email protected]6ef71d72013-08-10 18:13:44460 internal::ResolutionNotificationController*
461 resolution_notification_controller() {
462 return resolution_notification_controller_.get();
463 }
464
[email protected]8393aa62013-01-23 19:40:10465 RootWindowHostFactory* root_window_host_factory() {
466 return root_window_host_factory_.get();
467 }
468
[email protected]478c6c32013-03-09 02:50:58469 LauncherModel* launcher_model() {
470 return launcher_model_.get();
471 }
472
473 // Returns the launcher delegate, creating if necesary.
474 LauncherDelegate* GetLauncherDelegate();
475
[email protected]2b8a9bb2013-07-01 22:43:40476 void SetTouchHudProjectionEnabled(bool enabled);
477
478 bool is_touch_hud_projection_enabled() const {
479 return is_touch_hud_projection_enabled_;
480 }
481
[email protected]2b4cd302012-02-24 20:21:13482 private:
[email protected]c39be8f2012-06-15 22:58:36483 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, TestCursor);
[email protected]1aad3322012-06-06 06:37:09484 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors);
485 FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate);
[email protected]d90b8392012-06-13 09:34:56486 friend class internal::RootWindowController;
[email protected]b42910f2013-08-01 11:45:29487 friend class internal::ScopedTargetRootWindow;
[email protected]0c68e892012-12-08 16:54:53488 friend class test::ShellTestApi;
[email protected]0af58042012-12-13 03:21:35489 friend class shell::WindowWatcher;
[email protected]ad0c8722012-03-02 20:17:45490
[email protected]cac10fc62011-10-07 23:22:56491 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
492
[email protected]09464c72013-04-26 07:31:28493 // Takes ownership of |delegate|.
[email protected]3266c2b92011-11-14 00:06:08494 explicit Shell(ShellDelegate* delegate);
495 virtual ~Shell();
496
497 void Init();
[email protected]b0639282011-12-22 21:12:27498
[email protected]be65be362012-06-15 07:38:23499 // Initializes the root window and root window controller so that it
[email protected]756bda12013-07-03 08:17:06500 // can host browser windows. |first_run_after_boot| is true for the
501 // primary display only first time after boot.
502 void InitRootWindowController(internal::RootWindowController* root,
503 bool first_run_after_boot);
[email protected]d90b8392012-06-13 09:34:56504
[email protected]c0ce80e2012-10-05 23:28:27505 // ash::internal::SystemModalContainerEventFilterDelegate overrides:
506 virtual bool CanWindowReceiveEvents(aura::Window* window) OVERRIDE;
507
[email protected]5097e692012-10-30 22:08:41508 // Overridden from ui::EventTarget:
[email protected]869f6352012-12-06 20:47:17509 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE;
[email protected]5097e692012-10-30 22:08:41510 virtual EventTarget* GetParentTarget() OVERRIDE;
[email protected]049cf34b2012-12-07 17:15:48511 virtual void OnEvent(ui::Event* event) OVERRIDE;
[email protected]5097e692012-10-30 22:08:41512
[email protected]1ae361652012-12-12 22:39:51513 // Overridden from aura::client::ActivationChangeObserver:
514 virtual void OnWindowActivated(aura::Window* gained_active,
515 aura::Window* lost_active) OVERRIDE;
516
[email protected]cac10fc62011-10-07 23:22:56517 static Shell* instance_;
518
[email protected]9488d4d2012-02-29 18:32:37519 // If set before the Shell is initialized, the mouse cursor will be hidden
520 // when the screen is initially created.
521 static bool initially_hide_cursor_;
522
[email protected]b0a8faa2012-10-19 03:22:22523 ScreenAsh* screen_;
[email protected]58482fa2012-03-02 14:57:39524
[email protected]b42910f2013-08-01 11:45:29525 // When no explicit target display/RootWindow is given, new windows are
526 // created on |scoped_target_root_window_| , unless NULL in
527 // which case they are created on |target_root_window_|.
528 // |target_root_window_| never becomes NULL during the session.
529 aura::RootWindow* target_root_window_;
530 aura::RootWindow* scoped_target_root_window_;
[email protected]a857dbe2012-05-30 22:10:14531
[email protected]1aad3322012-06-06 06:37:09532 // The CompoundEventFilter owned by aura::Env object.
[email protected]4a59e4e2012-11-12 21:15:40533 scoped_ptr<views::corewm::CompoundEventFilter> env_filter_;
[email protected]627a62f2012-02-14 22:59:14534
[email protected]cac10fc62011-10-07 23:22:56535 std::vector<WindowAndBoundsPair> to_restore_;
536
[email protected]6e9f6aa2012-02-09 04:16:20537#if !defined(OS_MACOSX)
[email protected]8f80db0f2012-02-07 14:44:53538 scoped_ptr<NestedDispatcherController> nested_dispatcher_controller_;
539
[email protected]2f744282011-12-23 22:40:52540 scoped_ptr<AcceleratorController> accelerator_controller_;
[email protected]6e9f6aa2012-02-09 04:16:20541#endif // !defined(OS_MACOSX)
[email protected]745816be2011-11-22 05:08:30542
[email protected]2b99f8c2011-10-11 19:42:24543 scoped_ptr<ShellDelegate> delegate_;
[email protected]51ed5992012-11-07 10:14:39544 scoped_ptr<SystemTrayDelegate> system_tray_delegate_;
[email protected]83b2b84c2012-11-14 01:11:00545 scoped_ptr<SystemTrayNotifier> system_tray_notifier_;
[email protected]10b22612012-03-22 17:07:55546 scoped_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
[email protected]f4c92b382012-08-28 00:59:59547 scoped_ptr<CapsLockDelegate> caps_lock_delegate_;
[email protected]fcb123d2013-04-17 15:58:49548 scoped_ptr<SessionStateDelegate> session_state_delegate_;
[email protected]b913a3a2012-12-11 13:07:19549 scoped_ptr<LauncherDelegate> launcher_delegate_;
[email protected]cc29ba12013-08-28 05:22:34550 scoped_ptr<LauncherItemDelegateManager> launcher_item_delegate_manager_;
551 scoped_ptr<internal::AppListLauncherItemDelegate>
552 app_list_launcher_item_delegate_;
[email protected]b913a3a2012-12-11 13:07:19553
554 scoped_ptr<LauncherModel> launcher_model_;
[email protected]2b99f8c2011-10-11 19:42:24555
[email protected]0039db92012-05-09 04:11:45556 scoped_ptr<internal::AppListController> app_list_controller_;
[email protected]ae4987d2011-11-21 22:52:44557
[email protected]9fc206d2011-12-13 00:05:33558 scoped_ptr<internal::ActivationController> activation_controller_;
[email protected]084b6bb2011-11-17 05:18:16559 scoped_ptr<internal::DragDropController> drag_drop_controller_;
[email protected]e4a181cc2012-03-17 02:20:57560 scoped_ptr<internal::ResizeShadowController> resize_shadow_controller_;
[email protected]86f2b5e2012-11-14 20:37:00561 scoped_ptr<views::corewm::ShadowController> shadow_controller_;
[email protected]b5756e22012-11-30 01:32:02562 scoped_ptr<views::corewm::VisibilityController> visibility_controller_;
[email protected]0c2dc012012-12-02 00:00:23563 scoped_ptr<views::corewm::WindowModalityController>
564 window_modality_controller_;
[email protected]a1b7a822013-02-23 19:08:04565 scoped_ptr<views::corewm::TooltipController> tooltip_controller_;
[email protected]e70cf0ed2012-03-15 16:24:47566 scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
[email protected]e0d22e82012-01-04 00:46:57567 scoped_ptr<PowerButtonController> power_button_controller_;
[email protected]ab4f8c92013-05-30 19:07:47568 scoped_ptr<LockStateController> lock_state_controller_;
[email protected]66c5c4112013-07-31 07:10:59569 scoped_ptr<MruWindowTracker> mru_window_tracker_;
[email protected]c16b9422012-06-06 21:51:11570 scoped_ptr<UserActivityDetector> user_activity_detector_;
[email protected]6aa614a2012-01-19 22:13:38571 scoped_ptr<VideoDetector> video_detector_;
[email protected]40c4cbb2012-01-10 23:26:07572 scoped_ptr<WindowCycleController> window_cycle_controller_;
[email protected]d24ce2c2013-08-01 15:14:19573 scoped_ptr<WindowSelectorController> window_selector_controller_;
[email protected]3d29912a2012-02-07 07:41:51574 scoped_ptr<internal::FocusCycler> focus_cycler_;
[email protected]edbfb8d2012-09-03 08:33:43575 scoped_ptr<DisplayController> display_controller_;
[email protected]f48075d2012-05-24 11:06:51576 scoped_ptr<HighContrastController> high_contrast_controller_;
[email protected]77f7c132012-11-15 06:52:54577 scoped_ptr<MagnificationController> magnification_controller_;
578 scoped_ptr<PartialMagnificationController> partial_magnification_controller_;
[email protected]8cfb6722012-11-28 03:28:46579 scoped_ptr<aura::client::FocusClient> focus_client_;
[email protected]c28853612012-05-31 22:43:44580 scoped_ptr<aura::client::UserActionClient> user_action_client_;
[email protected]39718b52012-12-03 17:24:56581 aura::client::ActivationClient* activation_client_;
[email protected]78d96302012-06-22 00:58:07582 scoped_ptr<internal::MouseCursorEventFilter> mouse_cursor_filter_;
[email protected]8d625fb2012-07-18 16:40:06583 scoped_ptr<internal::ScreenPositionController> screen_position_controller_;
[email protected]c0ce80e2012-10-05 23:28:27584 scoped_ptr<internal::SystemModalContainerEventFilter> modality_filter_;
[email protected]e67291f12012-10-10 05:52:38585 scoped_ptr<internal::EventClientImpl> event_client_;
[email protected]682990f2013-01-10 06:49:11586 scoped_ptr<internal::EventTransformationHandler>
587 event_transformation_handler_;
[email protected]fca90ea2012-12-14 04:13:30588 scoped_ptr<RootWindowHostFactory> root_window_host_factory_;
[email protected]ae18b9112011-11-07 16:59:13589
[email protected]b9d224c2012-07-13 01:09:03590 // An event filter that rewrites or drops an event.
591 scoped_ptr<internal::EventRewriterEventFilter> event_rewriter_filter_;
[email protected]6e9f6aa2012-02-09 04:16:20592
[email protected]0b0b0742012-02-16 13:23:45593 // An event filter that pre-handles key events while the partial
[email protected]a1584a712012-07-30 21:02:26594 // screenshot UI or the keyboard overlay is active.
[email protected]9ae32df2012-07-26 03:25:18595 scoped_ptr<internal::OverlayEventFilter> overlay_filter_;
[email protected]0b0b0742012-02-16 13:23:45596
[email protected]435b212e2012-04-05 19:43:37597 // An event filter which handles system level gestures
598 scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_;
599
[email protected]6e9f6aa2012-02-09 04:16:20600#if !defined(OS_MACOSX)
[email protected]745816be2011-11-22 05:08:30601 // An event filter that pre-handles global accelerators.
[email protected]2f744282011-12-23 22:40:52602 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_;
[email protected]6e9f6aa2012-02-09 04:16:20603#endif
[email protected]745816be2011-11-22 05:08:30604
[email protected]42f06f92012-03-27 00:57:57605 // An event filter that pre-handles all key events to send them to an IME.
[email protected]4a59e4e2012-11-12 21:15:40606 scoped_ptr<views::corewm::InputMethodEventFilter> input_method_filter_;
[email protected]42f06f92012-03-27 00:57:57607
[email protected]6bdf7952012-11-14 10:10:58608 scoped_ptr<internal::DisplayManager> display_manager_;
609
[email protected]a9a40462013-07-31 06:22:56610 scoped_ptr<internal::LocaleNotificationController>
611 locale_notification_controller_;
612
[email protected]117542c2013-04-30 20:27:21613#if defined(OS_CHROMEOS) && defined(USE_X11)
[email protected]70b3e7d52012-06-02 22:12:25614 // Controls video output device state.
615 scoped_ptr<chromeos::OutputConfigurator> output_configurator_;
[email protected]196e9452012-08-01 06:42:51616 scoped_ptr<internal::OutputConfiguratorAnimation>
617 output_configurator_animation_;
[email protected]18b21b2e2013-03-01 20:56:23618 scoped_ptr<internal::DisplayErrorObserver> display_error_observer_;
[email protected]6bdf7952012-11-14 10:10:58619
[email protected]c1234a42013-08-20 09:35:40620 // Listens for output changes and updates the display manager.
621 scoped_ptr<internal::DisplayChangeObserver> display_change_observer_;
[email protected]117542c2013-04-30 20:27:21622#endif // defined(OS_CHROMEOS) && defined(USE_X11)
[email protected]70b3e7d52012-06-02 22:12:25623
[email protected]6ef71d72013-08-10 18:13:44624 scoped_ptr<internal::ResolutionNotificationController>
625 resolution_notification_controller_;
626
[email protected]c0ff0342013-02-27 00:41:29627 // |native_cursor_manager_| is owned by |cursor_manager_|, but we keep a
628 // pointer to vend to test code.
629 AshNativeCursorManager* native_cursor_manager_;
630 views::corewm::CursorManager cursor_manager_;
[email protected]4b8003c2012-07-26 00:54:19631
[email protected]1a2145b2012-03-13 21:09:17632 ObserverList<ShellObserver> observers_;
633
[email protected]fa4a45832012-04-12 21:32:48634 // Used by ash/shell.
635 content::BrowserContext* browser_context_;
636
[email protected]852a55d2012-10-17 13:30:30637 // For testing only: simulate that a modal window is open
638 bool simulate_modal_window_open_for_testing_;
639
[email protected]2b8a9bb2013-07-01 22:43:40640 bool is_touch_hud_projection_enabled_;
641
[email protected]87b0d82e2011-10-07 21:02:59642 DISALLOW_COPY_AND_ASSIGN(Shell);
643};
644
[email protected]55f593352011-12-24 05:42:46645} // namespace ash
[email protected]87b0d82e2011-10-07 21:02:59646
[email protected]b65bdda2011-12-23 23:35:31647#endif // ASH_SHELL_H_