blob: a1b030eb88c9f86f79a657286ff2af2bf5eb223c [file] [log] [blame]
[email protected]d90b8392012-06-13 09:34:561// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ash/root_window_controller.h"
6
[email protected]8b3e3d82013-08-20 14:36:307#include <queue>
[email protected]8d625fb2012-07-18 16:40:068#include <vector>
9
[email protected]44d444c2013-01-30 01:47:4410#include "ash/ash_constants.h"
[email protected]e6e41d2f2012-10-29 19:22:1911#include "ash/ash_switches.h"
[email protected]b4ddc7a2012-08-07 04:17:3212#include "ash/desktop_background/desktop_background_widget_controller.h"
[email protected]0bf61732013-07-02 04:35:1013#include "ash/desktop_background/user_wallpaper_delegate.h"
[email protected]6bdf7952012-11-14 10:10:5814#include "ash/display/display_manager.h"
[email protected]e74aaf0a2012-10-12 18:42:2815#include "ash/focus_cycler.h"
[email protected]f8e6aad2013-08-30 21:49:1116#include "ash/root_window_settings.h"
[email protected]fcb123d2013-04-17 15:58:4917#include "ash/session_state_delegate.h"
[email protected]478c6c32013-03-09 02:50:5818#include "ash/shelf/shelf_layout_manager.h"
19#include "ash/shelf/shelf_types.h"
20#include "ash/shelf/shelf_widget.h"
[email protected]d90b8392012-06-13 09:34:5621#include "ash/shell.h"
[email protected]e74aaf0a2012-10-12 18:42:2822#include "ash/shell_delegate.h"
[email protected]d90b8392012-06-13 09:34:5623#include "ash/shell_factory.h"
24#include "ash/shell_window_ids.h"
[email protected]e74aaf0a2012-10-12 18:42:2825#include "ash/system/status_area_widget.h"
[email protected]8674b312012-10-12 19:02:4426#include "ash/system/tray/system_tray_delegate.h"
[email protected]2b8a9bb2013-07-01 22:43:4027#include "ash/touch/touch_hud_debug.h"
28#include "ash/touch/touch_hud_projection.h"
[email protected]80549c152013-07-02 01:42:4729#include "ash/touch/touch_observer_hud.h"
30#include "ash/wm/always_on_top_controller.h"
[email protected]d90b8392012-06-13 09:34:5631#include "ash/wm/base_layout_manager.h"
[email protected]beb4e5c2013-06-18 15:37:0732#include "ash/wm/dock/docked_window_layout_manager.h"
[email protected]7095a652013-03-07 19:41:4933#include "ash/wm/panels/panel_layout_manager.h"
[email protected]100659412013-06-21 22:59:5534#include "ash/wm/panels/panel_window_event_handler.h"
[email protected]d90b8392012-06-13 09:34:5635#include "ash/wm/root_window_layout_manager.h"
36#include "ash/wm/screen_dimmer.h"
[email protected]2a2caa02013-01-22 20:50:3637#include "ash/wm/stacking_controller.h"
[email protected]e74aaf0a2012-10-12 18:42:2838#include "ash/wm/status_area_layout_manager.h"
[email protected]e6e41d2f2012-10-29 19:22:1939#include "ash/wm/system_background_controller.h"
[email protected]d90b8392012-06-13 09:34:5640#include "ash/wm/system_modal_container_layout_manager.h"
[email protected]5dc51db82012-09-11 03:39:0141#include "ash/wm/toplevel_window_event_handler.h"
[email protected]8d625fb2012-07-18 16:40:0642#include "ash/wm/window_properties.h"
[email protected]a41b4e12013-09-20 04:36:3443#include "ash/wm/window_state.h"
[email protected]700849f2013-04-30 17:49:2044#include "ash/wm/window_util.h"
[email protected]d90b8392012-06-13 09:34:5645#include "ash/wm/workspace_controller.h"
[email protected]e6e41d2f2012-10-29 19:22:1946#include "base/command_line.h"
[email protected]1e84c632013-06-27 23:12:2147#include "base/time/time.h"
[email protected]f1853122012-06-27 16:21:2648#include "ui/aura/client/aura_constants.h"
[email protected]8b3e3d82013-08-20 14:36:3049#include "ui/aura/client/drag_drop_client.h"
[email protected]d90b8392012-06-13 09:34:5650#include "ui/aura/client/tooltip_client.h"
51#include "ui/aura/root_window.h"
[email protected]f1853122012-06-27 16:21:2652#include "ui/aura/window.h"
[email protected]cf6fea22013-08-07 14:24:0153#include "ui/aura/window_delegate.h"
[email protected]f1853122012-06-27 16:21:2654#include "ui/aura/window_observer.h"
[email protected]8b3e3d82013-08-20 14:36:3055#include "ui/aura/window_tracker.h"
[email protected]cf6fea22013-08-07 14:24:0156#include "ui/base/hit_test.h"
[email protected]431552c2012-10-23 00:38:3357#include "ui/base/models/menu_model.h"
[email protected]f8e6aad2013-08-30 21:49:1158#include "ui/gfx/display.h"
[email protected]8d625fb2012-07-18 16:40:0659#include "ui/gfx/screen.h"
[email protected]86459e2c2013-04-10 13:39:2460#include "ui/keyboard/keyboard_controller.h"
61#include "ui/keyboard/keyboard_util.h"
[email protected]431552c2012-10-23 00:38:3362#include "ui/views/controls/menu/menu_runner.h"
[email protected]23a2dc82013-08-22 15:04:2263#include "ui/views/corewm/capture_controller.h"
[email protected]b5756e22012-11-30 01:32:0264#include "ui/views/corewm/visibility_controller.h"
[email protected]431552c2012-10-23 00:38:3365#include "ui/views/view_model.h"
66#include "ui/views/view_model_utils.h"
[email protected]d90b8392012-06-13 09:34:5667
[email protected]252eb232013-08-14 22:09:2768#if defined(OS_CHROMEOS)
69#include "ash/wm/boot_splash_screen_chromeos.h"
70#endif
71
[email protected]d90b8392012-06-13 09:34:5672namespace ash {
73namespace {
74
[email protected]252eb232013-08-14 22:09:2775#if defined(OS_CHROMEOS)
[email protected]bca9a7e2012-11-10 06:25:4976// Duration for the animation that hides the boot splash screen, in
77// milliseconds. This should be short enough in relation to
78// wm/window_animation.cc's brightness/grayscale fade animation that the login
79// background image animation isn't hidden by the splash screen animation.
80const int kBootSplashScreenHideDurationMs = 500;
[email protected]252eb232013-08-14 22:09:2781#endif
[email protected]bca9a7e2012-11-10 06:25:4982
[email protected]d90b8392012-06-13 09:34:5683// Creates a new window for use as a container.
84aura::Window* CreateContainer(int window_id,
85 const char* name,
86 aura::Window* parent) {
87 aura::Window* container = new aura::Window(NULL);
88 container->set_id(window_id);
89 container->SetName(name);
90 container->Init(ui::LAYER_NOT_DRAWN);
91 parent->AddChild(container);
92 if (window_id != internal::kShellWindowId_UnparentedControlContainer)
93 container->Show();
94 return container;
95}
96
[email protected]95058572012-08-20 14:57:2997// Reparents |window| to |new_parent|.
98void ReparentWindow(aura::Window* window, aura::Window* new_parent) {
99 // Update the restore bounds to make it relative to the display.
[email protected]a41b4e12013-09-20 04:36:34100 wm::WindowState* state = wm::GetWindowState(window);
101 gfx::Rect restore_bounds;
102 bool has_restore_bounds = state->HasRestoreBounds();
103 if (has_restore_bounds)
104 restore_bounds = state->GetRestoreBoundsInParent();
[email protected]95058572012-08-20 14:57:29105 new_parent->AddChild(window);
[email protected]a41b4e12013-09-20 04:36:34106 if (has_restore_bounds)
107 state->SetRestoreBoundsInParent(restore_bounds);
[email protected]95058572012-08-20 14:57:29108}
109
110// Reparents the appropriate set of windows from |src| to |dst|.
111void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) {
112 // Set of windows to move.
[email protected]f1853122012-06-27 16:21:26113 const int kContainerIdsToMove[] = {
114 internal::kShellWindowId_DefaultContainer,
[email protected]beb4e5c2013-06-18 15:37:07115 internal::kShellWindowId_DockedContainer,
[email protected]95db9c12013-01-31 11:47:44116 internal::kShellWindowId_PanelContainer,
[email protected]f1853122012-06-27 16:21:26117 internal::kShellWindowId_AlwaysOnTopContainer,
118 internal::kShellWindowId_SystemModalContainer,
119 internal::kShellWindowId_LockSystemModalContainer,
[email protected]6274d312012-10-04 22:06:41120 internal::kShellWindowId_InputMethodContainer,
[email protected]a9754872013-01-25 07:44:00121 internal::kShellWindowId_UnparentedControlContainer,
[email protected]f1853122012-06-27 16:21:26122 };
[email protected]f1853122012-06-27 16:21:26123 for (size_t i = 0; i < arraysize(kContainerIdsToMove); i++) {
124 int id = kContainerIdsToMove[i];
125 aura::Window* src_container = Shell::GetContainer(src, id);
126 aura::Window* dst_container = Shell::GetContainer(dst, id);
[email protected]5b6021902013-02-26 05:33:29127 while (!src_container->children().empty()) {
128 // Restart iteration from the source container windows each time as they
129 // may change as a result of moving other windows.
130 aura::Window::Windows::const_iterator iter =
131 src_container->children().begin();
132 while (iter != src_container->children().end() &&
133 internal::SystemModalContainerLayoutManager::IsModalBackground(
134 *iter)) {
135 ++iter;
136 }
137 // If the entire window list is modal background windows then stop.
138 if (iter == src_container->children().end())
139 break;
140 ReparentWindow(*iter, dst_container);
[email protected]f1853122012-06-27 16:21:26141 }
142 }
143}
144
[email protected]8d625fb2012-07-18 16:40:06145// Mark the container window so that a widget added to this container will
146// use the virtual screeen coordinates instead of parent.
147void SetUsesScreenCoordinates(aura::Window* container) {
148 container->SetProperty(internal::kUsesScreenCoordinatesKey, true);
149}
150
[email protected]e887c6c2013-07-08 19:35:53151// Mark the container window so that a widget added to this container will
152// say in the same root window regardless of the bounds specified.
153void DescendantShouldStayInSameRootWindow(aura::Window* container) {
154 container->SetProperty(internal::kStayInSameRootWindowKey, true);
155}
156
[email protected]cf6fea22013-08-07 14:24:01157// A window delegate which does nothing. Used to create a window that
158// is a event target, but do nothing.
159class EmptyWindowDelegate : public aura::WindowDelegate {
160 public:
161 EmptyWindowDelegate() {}
162 virtual ~EmptyWindowDelegate() {}
163
164 // aura::WindowDelegate overrides:
165 virtual gfx::Size GetMinimumSize() const OVERRIDE {
166 return gfx::Size();
167 }
168 virtual gfx::Size GetMaximumSize() const OVERRIDE {
169 return gfx::Size();
170 }
171 virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
172 const gfx::Rect& new_bounds) OVERRIDE {
173 }
174 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
175 return gfx::kNullCursor;
176 }
177 virtual int GetNonClientComponent(
178 const gfx::Point& point) const OVERRIDE {
179 return HTNOWHERE;
180 }
181 virtual bool ShouldDescendIntoChildForEventHandling(
182 aura::Window* child,
183 const gfx::Point& location) OVERRIDE {
184 return false;
185 }
186 virtual bool CanFocus() OVERRIDE {
187 return false;
188 }
189 virtual void OnCaptureLost() OVERRIDE {
190 }
191 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
192 }
193 virtual void OnDeviceScaleFactorChanged(
194 float device_scale_factor) OVERRIDE {
195 }
196 virtual void OnWindowDestroying() OVERRIDE {}
[email protected]febe1fd62013-08-07 16:07:24197 virtual void OnWindowDestroyed() OVERRIDE {
198 delete this;
199 }
[email protected]cf6fea22013-08-07 14:24:01200 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {
201 }
202 virtual bool HasHitTestMask() const OVERRIDE {
203 return false;
204 }
205 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {}
[email protected]1ddbe932013-09-12 06:23:16206 virtual void DidRecreateLayer(ui::Layer* old_layer,
207 ui::Layer* new_layer) OVERRIDE {}
[email protected]cf6fea22013-08-07 14:24:01208
209 private:
210 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate);
211};
212
[email protected]d90b8392012-06-13 09:34:56213} // namespace
214
215namespace internal {
216
217RootWindowController::RootWindowController(aura::RootWindow* root_window)
[email protected]e74aaf0a2012-10-12 18:42:28218 : root_window_(root_window),
219 root_window_layout_(NULL),
[email protected]beb4e5c2013-06-18 15:37:07220 docked_layout_manager_(NULL),
[email protected]bff17552013-04-25 04:44:55221 panel_layout_manager_(NULL),
[email protected]2b8a9bb2013-07-01 22:43:40222 touch_hud_debug_(NULL),
223 touch_hud_projection_(NULL) {
[email protected]6b2d4a0b2013-09-06 06:29:54224 GetRootWindowSettings(root_window)->controller = this;
[email protected]c0ce80e2012-10-05 23:28:27225 screen_dimmer_.reset(new ScreenDimmer(root_window));
[email protected]2a2caa02013-01-22 20:50:36226
[email protected]0bf61732013-07-02 04:35:10227 stacking_controller_.reset(new StackingController);
[email protected]2a2caa02013-01-22 20:50:36228 aura::client::SetStackingClient(root_window, stacking_controller_.get());
[email protected]23a2dc82013-08-22 15:04:22229 capture_client_.reset(new views::corewm::ScopedCaptureClient(root_window));
[email protected]d90b8392012-06-13 09:34:56230}
231
232RootWindowController::~RootWindowController() {
[email protected]6675e1c2012-09-11 09:15:45233 Shutdown();
234 root_window_.reset();
[email protected]23a2dc82013-08-22 15:04:22235 // The CaptureClient needs to be around for as long as the RootWindow is
236 // valid.
237 capture_client_.reset();
[email protected]6675e1c2012-09-11 09:15:45238}
239
[email protected]88d71122012-10-18 07:11:01240// static
[email protected]a0afeb12012-12-10 22:57:09241RootWindowController* RootWindowController::ForLauncher(aura::Window* window) {
[email protected]8c0ec432013-05-10 04:33:39242 return GetRootWindowController(window->GetRootWindow());
[email protected]88d71122012-10-18 07:11:01243}
244
[email protected]a0afeb12012-12-10 22:57:09245// static
[email protected]ccff3d72013-02-06 04:26:28246RootWindowController* RootWindowController::ForWindow(
247 const aura::Window* window) {
[email protected]a0afeb12012-12-10 22:57:09248 return GetRootWindowController(window->GetRootWindow());
249}
250
251// static
[email protected]d17642d2013-09-12 23:44:38252RootWindowController* RootWindowController::ForTargetRootWindow() {
253 return internal::GetRootWindowController(Shell::GetTargetRootWindow());
[email protected]a0afeb12012-12-10 22:57:09254}
255
[email protected]0bf61732013-07-02 04:35:10256void RootWindowController::SetWallpaperController(
257 DesktopBackgroundWidgetController* controller) {
258 wallpaper_controller_.reset(controller);
259}
260
261void RootWindowController::SetAnimatingWallpaperController(
262 AnimatingDesktopController* controller) {
263 if (animating_wallpaper_controller_.get())
264 animating_wallpaper_controller_->StopAnimating();
265 animating_wallpaper_controller_.reset(controller);
266}
267
[email protected]6675e1c2012-09-11 09:15:45268void RootWindowController::Shutdown() {
[email protected]d141b922013-07-09 08:13:17269 Shell::GetInstance()->RemoveShellObserver(this);
270
[email protected]0bf61732013-07-02 04:35:10271 if (animating_wallpaper_controller_.get())
272 animating_wallpaper_controller_->StopAnimating();
273 wallpaper_controller_.reset();
274 animating_wallpaper_controller_.reset();
275
[email protected]d17642d2013-09-12 23:44:38276 // Change the target root window before closing child windows. If any child
[email protected]c98a4922013-09-05 20:01:42277 // being removed triggers a relayout of the shelf it will try to build a
[email protected]d17642d2013-09-12 23:44:38278 // window list adding windows from the target root window's containers which
[email protected]c98a4922013-09-05 20:01:42279 // may have already gone away.
[email protected]d17642d2013-09-12 23:44:38280 if (Shell::GetTargetRootWindow() == root_window_) {
281 Shell::GetInstance()->set_target_root_window(
[email protected]f634dd32012-07-23 22:49:07282 Shell::GetPrimaryRootWindow() == root_window_.get() ?
283 NULL : Shell::GetPrimaryRootWindow());
284 }
[email protected]c98a4922013-09-05 20:01:42285
286 CloseChildWindows();
[email protected]6b2d4a0b2013-09-06 06:29:54287 GetRootWindowSettings(root_window_.get())->controller = NULL;
[email protected]d90b8392012-06-13 09:34:56288 screen_dimmer_.reset();
289 workspace_controller_.reset();
[email protected]6675e1c2012-09-11 09:15:45290 // Forget with the display ID so that display lookup
291 // ends up with invalid display.
[email protected]f8e6aad2013-08-30 21:49:11292 internal::GetRootWindowSettings(root_window_.get())->display_id =
293 gfx::Display::kInvalidDisplayID;
[email protected]6675e1c2012-09-11 09:15:45294 // And this root window should no longer process events.
295 root_window_->PrepareForShutdown();
[email protected]e74aaf0a2012-10-12 18:42:28296
[email protected]956a6a42012-10-29 23:58:10297 system_background_.reset();
[email protected]d90b8392012-06-13 09:34:56298}
299
[email protected]c0ce80e2012-10-05 23:28:27300SystemModalContainerLayoutManager*
[email protected]8674b312012-10-12 19:02:44301RootWindowController::GetSystemModalLayoutManager(aura::Window* window) {
302 aura::Window* container = NULL;
303 if (window) {
[email protected]3b162e12012-11-09 11:52:35304 if (window->parent() &&
305 window->parent()->id() >= kShellWindowId_LockScreenContainer) {
306 container = GetContainer(kShellWindowId_LockSystemModalContainer);
307 } else {
[email protected]8674b312012-10-12 19:02:44308 container = GetContainer(kShellWindowId_SystemModalContainer);
[email protected]3b162e12012-11-09 11:52:35309 }
[email protected]8674b312012-10-12 19:02:44310 } else {
[email protected]a44afbbd2013-07-24 21:49:35311 int modal_window_id = Shell::GetInstance()->session_state_delegate()
312 ->IsUserSessionBlocked() ? kShellWindowId_LockSystemModalContainer :
313 kShellWindowId_SystemModalContainer;
[email protected]8674b312012-10-12 19:02:44314 container = GetContainer(modal_window_id);
315 }
[email protected]bb0c7cd42013-05-20 23:39:45316 return container ? static_cast<SystemModalContainerLayoutManager*>(
317 container->layout_manager()) : NULL;
[email protected]c0ce80e2012-10-05 23:28:27318}
319
[email protected]d90b8392012-06-13 09:34:56320aura::Window* RootWindowController::GetContainer(int container_id) {
321 return root_window_->GetChildById(container_id);
322}
323
[email protected]d8a24952013-08-05 20:05:05324const aura::Window* RootWindowController::GetContainer(int container_id) const {
325 return root_window_->GetChildById(container_id);
326}
327
[email protected]756bda12013-07-03 08:17:06328void RootWindowController::Init(bool first_run_after_boot) {
329 root_window_->SetCursor(ui::kCursorPointer);
[email protected]d90b8392012-06-13 09:34:56330 CreateContainersInRootWindow(root_window_.get());
[email protected]756bda12013-07-03 08:17:06331 CreateSystemBackground(first_run_after_boot);
[email protected]d90b8392012-06-13 09:34:56332
[email protected]756bda12013-07-03 08:17:06333 InitLayoutManagers();
334 InitKeyboard();
335 InitTouchHuds();
[email protected]bca9a7e2012-11-10 06:25:49336
[email protected]756bda12013-07-03 08:17:06337 if (Shell::GetPrimaryRootWindowController()->
338 GetSystemModalLayoutManager(NULL)->has_modal_background()) {
339 GetSystemModalLayoutManager(NULL)->CreateModalBackground();
340 }
[email protected]d141b922013-07-09 08:13:17341
342 Shell::GetInstance()->AddShellObserver(this);
[email protected]e74aaf0a2012-10-12 18:42:28343}
344
345void RootWindowController::ShowLauncher() {
[email protected]80549c152013-07-02 01:42:47346 if (!shelf_->launcher())
[email protected]e74aaf0a2012-10-12 18:42:28347 return;
[email protected]478c6c32013-03-09 02:50:58348 shelf_->launcher()->SetVisible(true);
349 shelf_->status_area_widget()->Show();
[email protected]e74aaf0a2012-10-12 18:42:28350}
351
[email protected]756bda12013-07-03 08:17:06352void RootWindowController::OnLauncherCreated() {
353 if (panel_layout_manager_)
354 panel_layout_manager_->SetLauncher(shelf_->launcher());
[email protected]7115bd32013-07-19 08:25:39355 if (docked_layout_manager_) {
[email protected]756bda12013-07-03 08:17:06356 docked_layout_manager_->SetLauncher(shelf_->launcher());
[email protected]7115bd32013-07-19 08:25:39357 if (shelf_->shelf_layout_manager())
358 docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager());
359 }
[email protected]756bda12013-07-03 08:17:06360}
361
[email protected]16059276d2012-10-22 18:59:50362void RootWindowController::UpdateAfterLoginStatusChange(
363 user::LoginStatus status) {
[email protected]cf6fea22013-08-07 14:24:01364 if (status != user::LOGGED_IN_NONE)
365 mouse_event_target_.reset();
[email protected]80549c152013-07-02 01:42:47366 if (shelf_->status_area_widget())
[email protected]478c6c32013-03-09 02:50:58367 shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status);
[email protected]16059276d2012-10-22 18:59:50368}
369
[email protected]bca9a7e2012-11-10 06:25:49370void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() {
[email protected]252eb232013-08-14 22:09:27371#if defined(OS_CHROMEOS)
[email protected]bca9a7e2012-11-10 06:25:49372 if (CommandLine::ForCurrentProcess()->HasSwitch(
373 switches::kAshAnimateFromBootSplashScreen) &&
374 boot_splash_screen_.get()) {
375 // Make the splash screen fade out so it doesn't obscure the desktop
376 // wallpaper's brightness/grayscale animation.
377 boot_splash_screen_->StartHideAnimation(
378 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs));
379 }
[email protected]252eb232013-08-14 22:09:27380#endif
[email protected]bca9a7e2012-11-10 06:25:49381}
382
[email protected]0bf61732013-07-02 04:35:10383void RootWindowController::OnWallpaperAnimationFinished(views::Widget* widget) {
384 // Make sure the wallpaper is visible.
[email protected]bca9a7e2012-11-10 06:25:49385 system_background_->SetColor(SK_ColorBLACK);
[email protected]252eb232013-08-14 22:09:27386#if defined(OS_CHROMEOS)
[email protected]bca9a7e2012-11-10 06:25:49387 boot_splash_screen_.reset();
[email protected]252eb232013-08-14 22:09:27388#endif
[email protected]0bf61732013-07-02 04:35:10389
390 Shell::GetInstance()->user_wallpaper_delegate()->
391 OnWallpaperAnimationFinished();
392 // Only removes old component when wallpaper animation finished. If we
393 // remove the old one before the new wallpaper is done fading in there will
394 // be a white flash during the animation.
395 if (animating_wallpaper_controller()) {
396 DesktopBackgroundWidgetController* controller =
397 animating_wallpaper_controller()->GetController(true);
398 // |desktop_widget_| should be the same animating widget we try to move
399 // to |kDesktopController|. Otherwise, we may close |desktop_widget_|
400 // before move it to |kDesktopController|.
401 DCHECK_EQ(controller->widget(), widget);
402 // Release the old controller and close its background widget.
403 SetWallpaperController(controller);
404 }
[email protected]697f04c2012-10-03 01:15:10405}
406
[email protected]d90b8392012-06-13 09:34:56407void RootWindowController::CloseChildWindows() {
[email protected]cf6fea22013-08-07 14:24:01408 mouse_event_target_.reset();
409
[email protected]80549c152013-07-02 01:42:47410 if (!shelf_.get())
411 return;
[email protected]79a87b7e2013-01-25 05:08:22412 // panel_layout_manager_ needs to be shut down before windows are destroyed.
413 if (panel_layout_manager_) {
414 panel_layout_manager_->Shutdown();
415 panel_layout_manager_ = NULL;
416 }
[email protected]7115bd32013-07-19 08:25:39417 // docked_layout_manager_ needs to be shut down before windows are destroyed.
418 if (docked_layout_manager_) {
419 if (shelf_->shelf_layout_manager())
420 docked_layout_manager_->RemoveObserver(shelf_->shelf_layout_manager());
421 docked_layout_manager_->Shutdown();
422 docked_layout_manager_ = NULL;
423 }
[email protected]79a87b7e2013-01-25 05:08:22424
[email protected]8b3e3d82013-08-20 14:36:30425 aura::client::SetDragDropClient(root_window_.get(), NULL);
426
[email protected]478c6c32013-03-09 02:50:58427 // TODO(harrym): Remove when Status Area Widget is a child view.
[email protected]80549c152013-07-02 01:42:47428 shelf_->ShutdownStatusAreaWidget();
[email protected]478c6c32013-03-09 02:50:58429
[email protected]80549c152013-07-02 01:42:47430 if (shelf_->shelf_layout_manager())
[email protected]a3e412712013-07-11 09:32:58431 shelf_->shelf_layout_manager()->PrepareForShutdown();
[email protected]e74aaf0a2012-10-12 18:42:28432
[email protected]d90b8392012-06-13 09:34:56433 // Close background widget first as it depends on tooltip.
[email protected]0bf61732013-07-02 04:35:10434 wallpaper_controller_.reset();
435 animating_wallpaper_controller_.reset();
[email protected]b4ddc7a2012-08-07 04:17:32436
[email protected]d90b8392012-06-13 09:34:56437 workspace_controller_.reset();
438 aura::client::SetTooltipClient(root_window_.get(), NULL);
439
[email protected]0fbfa972013-10-02 19:23:33440 // Explicitly destroy top level windows. We do this as during part of
441 // destruction such windows may query the RootWindow for state.
[email protected]8b3e3d82013-08-20 14:36:30442 std::queue<aura::Window*> non_toplevel_windows;
443 non_toplevel_windows.push(root_window_.get());
444 while (!non_toplevel_windows.empty()) {
445 aura::Window* non_toplevel_window = non_toplevel_windows.front();
446 non_toplevel_windows.pop();
447 aura::WindowTracker toplevel_windows;
448 for (size_t i = 0; i < non_toplevel_window->children().size(); ++i) {
449 aura::Window* child = non_toplevel_window->children()[i];
[email protected]0fbfa972013-10-02 19:23:33450 if (!child->owned_by_parent())
451 continue;
[email protected]8b3e3d82013-08-20 14:36:30452 if (child->delegate())
453 toplevel_windows.Add(child);
454 else
455 non_toplevel_windows.push(child);
456 }
457 while (!toplevel_windows.windows().empty())
458 delete *toplevel_windows.windows().begin();
[email protected]d90b8392012-06-13 09:34:56459 }
[email protected]8b3e3d82013-08-20 14:36:30460 // And then remove the containers.
[email protected]0fbfa972013-10-02 19:23:33461 while (!root_window_->children().empty()) {
462 aura::Window* window = root_window_->children()[0];
463 if (window->owned_by_parent()) {
464 delete window;
465 } else {
466 root_window_->RemoveChild(window);
467 }
468 }
[email protected]478c6c32013-03-09 02:50:58469
470 shelf_.reset(NULL);
[email protected]d90b8392012-06-13 09:34:56471}
472
[email protected]f1853122012-06-27 16:21:26473void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) {
[email protected]8039e06c2013-01-17 23:34:50474 // Forget the shelf early so that shelf don't update itself using wrong
475 // display info.
476 workspace_controller_->SetShelf(NULL);
[email protected]95058572012-08-20 14:57:29477 ReparentAllWindows(root_window_.get(), dst);
[email protected]f1853122012-06-27 16:21:26478}
479
[email protected]478c6c32013-03-09 02:50:58480ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
[email protected]80549c152013-07-02 01:42:47481 return shelf_->shelf_layout_manager();
[email protected]478c6c32013-03-09 02:50:58482}
483
[email protected]a0afeb12012-12-10 22:57:09484SystemTray* RootWindowController::GetSystemTray() {
485 // We assume in throughout the code that this will not return NULL. If code
486 // triggers this for valid reasons, it should test status_area_widget first.
[email protected]80549c152013-07-02 01:42:47487 CHECK(shelf_->status_area_widget());
[email protected]478c6c32013-03-09 02:50:58488 return shelf_->status_area_widget()->system_tray();
[email protected]a0afeb12012-12-10 22:57:09489}
490
[email protected]940fb1c2013-06-18 16:54:28491void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen,
492 ui::MenuSourceType source_type) {
[email protected]431552c2012-10-23 00:38:33493 DCHECK(Shell::GetInstance()->delegate());
494 scoped_ptr<ui::MenuModel> menu_model(
[email protected]8c0ec432013-05-10 04:33:39495 Shell::GetInstance()->delegate()->CreateContextMenu(root_window()));
[email protected]7f7f65c2013-04-17 16:47:13496 if (!menu_model)
[email protected]8e837ec2013-01-31 01:48:33497 return;
[email protected]431552c2012-10-23 00:38:33498
[email protected]6175fc42013-04-05 05:58:58499 // Background controller may not be set yet if user clicked on status are
500 // before initial animation completion. See crbug.com/222218
[email protected]0bf61732013-07-02 04:35:10501 if (!wallpaper_controller_.get())
[email protected]431552c2012-10-23 00:38:33502 return;
503
[email protected]6175fc42013-04-05 05:58:58504 views::MenuRunner menu_runner(menu_model.get());
[email protected]0bf61732013-07-02 04:35:10505 if (menu_runner.RunMenuAt(wallpaper_controller_->widget(),
[email protected]6175fc42013-04-05 05:58:58506 NULL, gfx::Rect(location_in_screen, gfx::Size()),
[email protected]940fb1c2013-06-18 16:54:28507 views::MenuItemView::TOPLEFT, source_type,
508 views::MenuRunner::CONTEXT_MENU) ==
[email protected]6175fc42013-04-05 05:58:58509 views::MenuRunner::MENU_DELETED) {
510 return;
511 }
512
[email protected]431552c2012-10-23 00:38:33513 Shell::GetInstance()->UpdateShelfVisibility();
514}
515
[email protected]e74aaf0a2012-10-12 18:42:28516void RootWindowController::UpdateShelfVisibility() {
[email protected]478c6c32013-03-09 02:50:58517 shelf_->shelf_layout_manager()->UpdateVisibilityState();
[email protected]e74aaf0a2012-10-12 18:42:28518}
519
[email protected]e3bc88e2013-09-06 06:22:06520const aura::Window* RootWindowController::GetTopmostFullscreenWindow() const {
521 const aura::Window::Windows& windows =
522 GetContainer(kShellWindowId_DefaultContainer)->children();
523 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin();
524 iter != windows.rend(); ++iter) {
[email protected]a41b4e12013-09-20 04:36:34525 if (wm::GetWindowState(*iter)->IsFullscreen())
[email protected]e3bc88e2013-09-06 06:22:06526 return *iter;
[email protected]2ee2f5d2013-01-10 23:37:16527 }
[email protected]700849f2013-04-30 17:49:20528 return NULL;
[email protected]2ee2f5d2013-01-10 23:37:16529}
530
[email protected]86459e2c2013-04-10 13:39:24531void RootWindowController::InitKeyboard() {
532 if (keyboard::IsKeyboardEnabled()) {
533 aura::Window* parent = root_window();
534
535 keyboard::KeyboardControllerProxy* proxy =
536 Shell::GetInstance()->delegate()->CreateKeyboardControllerProxy();
537 keyboard_controller_.reset(
538 new keyboard::KeyboardController(proxy));
[email protected]5416f282013-04-29 20:52:48539
540 keyboard_controller_->AddObserver(shelf()->shelf_layout_manager());
541 keyboard_controller_->AddObserver(panel_layout_manager_);
542
[email protected]45c66672013-10-01 22:48:56543 // Deletes the old container since |keyboard_controller_| creates a
544 // new container window in GetContainerWindow().
545 delete GetContainer(kShellWindowId_VirtualKeyboardContainer);
546
[email protected]86459e2c2013-04-10 13:39:24547 aura::Window* keyboard_container =
548 keyboard_controller_->GetContainerWindow();
[email protected]eff4c7f2013-08-13 01:45:50549 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer);
[email protected]86459e2c2013-04-10 13:39:24550 parent->AddChild(keyboard_container);
[email protected]e0f71132013-04-17 12:32:51551 keyboard_container->SetBounds(parent->bounds());
[email protected]86459e2c2013-04-10 13:39:24552 }
553}
554
555
[email protected]a4cd6d32012-09-12 03:42:13556////////////////////////////////////////////////////////////////////////////////
557// RootWindowController, private:
558
[email protected]756bda12013-07-03 08:17:06559void RootWindowController::InitLayoutManagers() {
560 root_window_layout_ =
561 new RootWindowLayoutManager(root_window_.get());
562 root_window_->SetLayoutManager(root_window_layout_);
563
564 aura::Window* default_container =
565 GetContainer(kShellWindowId_DefaultContainer);
566 // Workspace manager has its own layout managers.
567 workspace_controller_.reset(
568 new WorkspaceController(default_container));
569
570 aura::Window* always_on_top_container =
571 GetContainer(kShellWindowId_AlwaysOnTopContainer);
572 always_on_top_container->SetLayoutManager(
573 new BaseLayoutManager(
574 always_on_top_container->GetRootWindow()));
575 always_on_top_controller_.reset(new internal::AlwaysOnTopController);
576 always_on_top_controller_->SetAlwaysOnTopContainer(always_on_top_container);
577
578 DCHECK(!shelf_.get());
579 aura::Window* shelf_container =
580 GetContainer(internal::kShellWindowId_ShelfContainer);
581 // TODO(harrym): Remove when status area is view.
582 aura::Window* status_container =
583 GetContainer(internal::kShellWindowId_StatusContainer);
584 shelf_.reset(new ShelfWidget(
585 shelf_container, status_container, workspace_controller()));
586
[email protected]cf6fea22013-08-07 14:24:01587 if (!Shell::GetInstance()->session_state_delegate()->
588 IsActiveUserSessionStarted()) {
589 // This window exists only to be a event target on login screen.
590 // It does not have to handle events, nor be visible.
591 mouse_event_target_.reset(new aura::Window(new EmptyWindowDelegate));
592 mouse_event_target_->Init(ui::LAYER_NOT_DRAWN);
593
594 aura::Window* lock_background_container =
595 GetContainer(internal::kShellWindowId_LockScreenBackgroundContainer);
596 lock_background_container->AddChild(mouse_event_target_.get());
597 mouse_event_target_->Show();
598 }
599
[email protected]756bda12013-07-03 08:17:06600 // Create Docked windows layout manager
601 aura::Window* docked_container = GetContainer(
602 internal::kShellWindowId_DockedContainer);
603 docked_layout_manager_ =
604 new internal::DockedWindowLayoutManager(docked_container);
605 docked_container_handler_.reset(
606 new ToplevelWindowEventHandler(docked_container));
607 docked_container->SetLayoutManager(docked_layout_manager_);
608
609 // Create Panel layout manager
610 aura::Window* panel_container = GetContainer(
611 internal::kShellWindowId_PanelContainer);
612 panel_layout_manager_ =
613 new internal::PanelLayoutManager(panel_container);
614 panel_container_handler_.reset(
615 new PanelWindowEventHandler(panel_container));
616 panel_container->SetLayoutManager(panel_layout_manager_);
617}
618
619void RootWindowController::InitTouchHuds() {
620 CommandLine* command_line = CommandLine::ForCurrentProcess();
621 if (command_line->HasSwitch(switches::kAshTouchHud))
622 set_touch_hud_debug(new TouchHudDebug(root_window_.get()));
623 if (Shell::GetInstance()->is_touch_hud_projection_enabled())
624 EnableTouchHudProjection();
625}
626
627void RootWindowController::CreateSystemBackground(
628 bool is_first_run_after_boot) {
629 SkColor color = SK_ColorBLACK;
630#if defined(OS_CHROMEOS)
631 if (is_first_run_after_boot)
632 color = kChromeOsBootColor;
633#endif
634 system_background_.reset(
635 new SystemBackgroundController(root_window_.get(), color));
636
637#if defined(OS_CHROMEOS)
638 // Make a copy of the system's boot splash screen so we can composite it
639 // onscreen until the desktop background is ready.
640 if (is_first_run_after_boot &&
641 (CommandLine::ForCurrentProcess()->HasSwitch(
642 switches::kAshCopyHostBackgroundAtBoot) ||
643 CommandLine::ForCurrentProcess()->HasSwitch(
644 switches::kAshAnimateFromBootSplashScreen)))
645 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get()));
646#endif
647}
648
[email protected]a4cd6d32012-09-12 03:42:13649void RootWindowController::CreateContainersInRootWindow(
650 aura::RootWindow* root_window) {
651 // These containers are just used by PowerButtonController to animate groups
652 // of containers simultaneously without messing up the current transformations
653 // on those containers. These are direct children of the root window; all of
654 // the other containers are their children.
[email protected]e6e41d2f2012-10-29 19:22:19655
656 // The desktop background container is not part of the lock animation, so it
657 // is not included in those animate groups.
[email protected]a4cd6d32012-09-12 03:42:13658 // When screen is locked desktop background is moved to lock screen background
659 // container (moved back on unlock). We want to make sure that there's an
660 // opaque layer occluding the non-lock-screen layers.
[email protected]e6e41d2f2012-10-29 19:22:19661 aura::Window* desktop_background_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27662 kShellWindowId_DesktopBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13663 "DesktopBackgroundContainer",
664 root_window);
[email protected]b5756e22012-11-30 01:32:02665 views::corewm::SetChildWindowVisibilityChangesAnimated(
666 desktop_background_container);
[email protected]a4cd6d32012-09-12 03:42:13667
668 aura::Window* non_lock_screen_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27669 kShellWindowId_NonLockScreenContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13670 "NonLockScreenContainersContainer",
671 root_window);
672
673 aura::Window* lock_background_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27674 kShellWindowId_LockScreenBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13675 "LockScreenBackgroundContainer",
676 root_window);
[email protected]b5756e22012-11-30 01:32:02677 views::corewm::SetChildWindowVisibilityChangesAnimated(
678 lock_background_containers);
[email protected]a4cd6d32012-09-12 03:42:13679
680 aura::Window* lock_screen_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27681 kShellWindowId_LockScreenContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13682 "LockScreenContainersContainer",
683 root_window);
684 aura::Window* lock_screen_related_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27685 kShellWindowId_LockScreenRelatedContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13686 "LockScreenRelatedContainersContainer",
687 root_window);
688
[email protected]c0ce80e2012-10-05 23:28:27689 CreateContainer(kShellWindowId_UnparentedControlContainer,
[email protected]a4cd6d32012-09-12 03:42:13690 "UnparentedControlContainer",
691 non_lock_screen_containers);
692
693 aura::Window* default_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27694 kShellWindowId_DefaultContainer,
[email protected]a4cd6d32012-09-12 03:42:13695 "DefaultContainer",
696 non_lock_screen_containers);
[email protected]b5756e22012-11-30 01:32:02697 views::corewm::SetChildWindowVisibilityChangesAnimated(default_container);
[email protected]a4cd6d32012-09-12 03:42:13698 SetUsesScreenCoordinates(default_container);
699
700 aura::Window* always_on_top_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27701 kShellWindowId_AlwaysOnTopContainer,
[email protected]a4cd6d32012-09-12 03:42:13702 "AlwaysOnTopContainer",
703 non_lock_screen_containers);
704 always_on_top_container_handler_.reset(
705 new ToplevelWindowEventHandler(always_on_top_container));
[email protected]b5756e22012-11-30 01:32:02706 views::corewm::SetChildWindowVisibilityChangesAnimated(
707 always_on_top_container);
[email protected]a4cd6d32012-09-12 03:42:13708 SetUsesScreenCoordinates(always_on_top_container);
709
[email protected]beb4e5c2013-06-18 15:37:07710 aura::Window* docked_container = CreateContainer(
711 kShellWindowId_DockedContainer,
712 "DockedContainer",
713 non_lock_screen_containers);
[email protected]5eab6e92013-09-19 19:09:27714 views::corewm::SetChildWindowVisibilityChangesAnimated(docked_container);
[email protected]beb4e5c2013-06-18 15:37:07715 SetUsesScreenCoordinates(docked_container);
716
[email protected]a4cd6d32012-09-12 03:42:13717 aura::Window* panel_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27718 kShellWindowId_PanelContainer,
[email protected]a4cd6d32012-09-12 03:42:13719 "PanelContainer",
720 non_lock_screen_containers);
721 SetUsesScreenCoordinates(panel_container);
722
[email protected]3f13cf12013-07-12 05:13:59723 aura::Window* shelf_container =
[email protected]478c6c32013-03-09 02:50:58724 CreateContainer(kShellWindowId_ShelfContainer,
[email protected]3f13cf12013-07-12 05:13:59725 "ShelfContainer",
[email protected]a4cd6d32012-09-12 03:42:13726 non_lock_screen_containers);
[email protected]3f13cf12013-07-12 05:13:59727 SetUsesScreenCoordinates(shelf_container);
728 DescendantShouldStayInSameRootWindow(shelf_container);
[email protected]a4cd6d32012-09-12 03:42:13729
[email protected]dc851a4e52012-10-03 00:05:55730 aura::Window* app_list_container =
[email protected]c0ce80e2012-10-05 23:28:27731 CreateContainer(kShellWindowId_AppListContainer,
[email protected]dc851a4e52012-10-03 00:05:55732 "AppListContainer",
733 non_lock_screen_containers);
734 SetUsesScreenCoordinates(app_list_container);
[email protected]a4cd6d32012-09-12 03:42:13735
736 aura::Window* modal_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27737 kShellWindowId_SystemModalContainer,
[email protected]a4cd6d32012-09-12 03:42:13738 "SystemModalContainer",
739 non_lock_screen_containers);
740 modal_container_handler_.reset(
741 new ToplevelWindowEventHandler(modal_container));
[email protected]a4cd6d32012-09-12 03:42:13742 modal_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27743 new SystemModalContainerLayoutManager(modal_container));
[email protected]b5756e22012-11-30 01:32:02744 views::corewm::SetChildWindowVisibilityChangesAnimated(modal_container);
[email protected]a4cd6d32012-09-12 03:42:13745 SetUsesScreenCoordinates(modal_container);
746
747 aura::Window* input_method_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27748 kShellWindowId_InputMethodContainer,
[email protected]a4cd6d32012-09-12 03:42:13749 "InputMethodContainer",
750 non_lock_screen_containers);
751 SetUsesScreenCoordinates(input_method_container);
752
753 // TODO(beng): Figure out if we can make this use
754 // SystemModalContainerEventFilter instead of stops_event_propagation.
755 aura::Window* lock_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27756 kShellWindowId_LockScreenContainer,
[email protected]a4cd6d32012-09-12 03:42:13757 "LockScreenContainer",
758 lock_screen_containers);
759 lock_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27760 new BaseLayoutManager(root_window));
[email protected]a4cd6d32012-09-12 03:42:13761 SetUsesScreenCoordinates(lock_container);
762 // TODO(beng): stopsevents
763
764 aura::Window* lock_modal_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27765 kShellWindowId_LockSystemModalContainer,
[email protected]a4cd6d32012-09-12 03:42:13766 "LockSystemModalContainer",
767 lock_screen_containers);
768 lock_modal_container_handler_.reset(
769 new ToplevelWindowEventHandler(lock_modal_container));
[email protected]a4cd6d32012-09-12 03:42:13770 lock_modal_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27771 new SystemModalContainerLayoutManager(lock_modal_container));
[email protected]b5756e22012-11-30 01:32:02772 views::corewm::SetChildWindowVisibilityChangesAnimated(lock_modal_container);
[email protected]a4cd6d32012-09-12 03:42:13773 SetUsesScreenCoordinates(lock_modal_container);
774
775 aura::Window* status_container =
[email protected]c0ce80e2012-10-05 23:28:27776 CreateContainer(kShellWindowId_StatusContainer,
[email protected]a4cd6d32012-09-12 03:42:13777 "StatusContainer",
778 lock_screen_related_containers);
779 SetUsesScreenCoordinates(status_container);
[email protected]e887c6c2013-07-08 19:35:53780 DescendantShouldStayInSameRootWindow(status_container);
[email protected]a4cd6d32012-09-12 03:42:13781
782 aura::Window* settings_bubble_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27783 kShellWindowId_SettingBubbleContainer,
[email protected]a4cd6d32012-09-12 03:42:13784 "SettingBubbleContainer",
785 lock_screen_related_containers);
[email protected]b5756e22012-11-30 01:32:02786 views::corewm::SetChildWindowVisibilityChangesAnimated(
787 settings_bubble_container);
[email protected]a4cd6d32012-09-12 03:42:13788 SetUsesScreenCoordinates(settings_bubble_container);
[email protected]e887c6c2013-07-08 19:35:53789 DescendantShouldStayInSameRootWindow(settings_bubble_container);
[email protected]a4cd6d32012-09-12 03:42:13790
791 aura::Window* menu_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27792 kShellWindowId_MenuContainer,
[email protected]a4cd6d32012-09-12 03:42:13793 "MenuContainer",
794 lock_screen_related_containers);
[email protected]b5756e22012-11-30 01:32:02795 views::corewm::SetChildWindowVisibilityChangesAnimated(menu_container);
[email protected]a4cd6d32012-09-12 03:42:13796 SetUsesScreenCoordinates(menu_container);
797
798 aura::Window* drag_drop_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27799 kShellWindowId_DragImageAndTooltipContainer,
[email protected]a4cd6d32012-09-12 03:42:13800 "DragImageAndTooltipContainer",
801 lock_screen_related_containers);
[email protected]b5756e22012-11-30 01:32:02802 views::corewm::SetChildWindowVisibilityChangesAnimated(drag_drop_container);
[email protected]a4cd6d32012-09-12 03:42:13803 SetUsesScreenCoordinates(drag_drop_container);
804
805 aura::Window* overlay_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27806 kShellWindowId_OverlayContainer,
[email protected]a4cd6d32012-09-12 03:42:13807 "OverlayContainer",
808 lock_screen_related_containers);
809 SetUsesScreenCoordinates(overlay_container);
[email protected]a07615f2012-10-24 08:23:08810
811 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
812 "PowerButtonAnimationContainer", root_window) ;
[email protected]a4cd6d32012-09-12 03:42:13813}
814
[email protected]d141b922013-07-09 08:13:17815void RootWindowController::EnableTouchHudProjection() {
816 if (touch_hud_projection_)
817 return;
818 set_touch_hud_projection(new TouchHudProjection(root_window_.get()));
819}
820
821void RootWindowController::DisableTouchHudProjection() {
822 if (!touch_hud_projection_)
823 return;
824 touch_hud_projection_->Remove();
825}
826
827void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
[email protected]fb23d562013-09-25 00:43:10828 if (status != user::LOGGED_IN_NONE)
829 InitKeyboard();
[email protected]d141b922013-07-09 08:13:17830 shelf_->shelf_layout_manager()->UpdateVisibilityState();
831}
832
833void RootWindowController::OnTouchHudProjectionToggled(bool enabled) {
834 if (enabled)
835 EnableTouchHudProjection();
836 else
837 DisableTouchHudProjection();
838}
839
[email protected]6b2d4a0b2013-09-06 06:29:54840RootWindowController* GetRootWindowController(
841 const aura::RootWindow* root_window) {
842 return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
843}
844
[email protected]d90b8392012-06-13 09:34:56845} // namespace internal
846} // namespace ash