blob: 8afa501ddabbb1a502bc88a8363b9dce9d81ca35 [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]a273d33a2013-10-17 12:41:2112#include "ash/desktop_background/desktop_background_controller.h"
[email protected]b4ddc7a2012-08-07 04:17:3213#include "ash/desktop_background/desktop_background_widget_controller.h"
[email protected]0bf61732013-07-02 04:35:1014#include "ash/desktop_background/user_wallpaper_delegate.h"
[email protected]6bdf7952012-11-14 10:10:5815#include "ash/display/display_manager.h"
[email protected]e74aaf0a2012-10-12 18:42:2816#include "ash/focus_cycler.h"
[email protected]a273d33a2013-10-17 12:41:2117#include "ash/high_contrast/high_contrast_controller.h"
[email protected]f8e6aad2013-08-30 21:49:1118#include "ash/root_window_settings.h"
[email protected]fcb123d2013-04-17 15:58:4919#include "ash/session_state_delegate.h"
[email protected]478c6c32013-03-09 02:50:5820#include "ash/shelf/shelf_layout_manager.h"
21#include "ash/shelf/shelf_types.h"
22#include "ash/shelf/shelf_widget.h"
[email protected]d90b8392012-06-13 09:34:5623#include "ash/shell.h"
[email protected]e74aaf0a2012-10-12 18:42:2824#include "ash/shell_delegate.h"
[email protected]d90b8392012-06-13 09:34:5625#include "ash/shell_factory.h"
26#include "ash/shell_window_ids.h"
[email protected]e74aaf0a2012-10-12 18:42:2827#include "ash/system/status_area_widget.h"
[email protected]8674b312012-10-12 19:02:4428#include "ash/system/tray/system_tray_delegate.h"
[email protected]2b8a9bb2013-07-01 22:43:4029#include "ash/touch/touch_hud_debug.h"
30#include "ash/touch/touch_hud_projection.h"
[email protected]80549c152013-07-02 01:42:4731#include "ash/touch/touch_observer_hud.h"
32#include "ash/wm/always_on_top_controller.h"
[email protected]d90b8392012-06-13 09:34:5633#include "ash/wm/base_layout_manager.h"
[email protected]beb4e5c2013-06-18 15:37:0734#include "ash/wm/dock/docked_window_layout_manager.h"
[email protected]7095a652013-03-07 19:41:4935#include "ash/wm/panels/panel_layout_manager.h"
[email protected]100659412013-06-21 22:59:5536#include "ash/wm/panels/panel_window_event_handler.h"
[email protected]d90b8392012-06-13 09:34:5637#include "ash/wm/root_window_layout_manager.h"
38#include "ash/wm/screen_dimmer.h"
[email protected]2a2caa02013-01-22 20:50:3639#include "ash/wm/stacking_controller.h"
[email protected]e74aaf0a2012-10-12 18:42:2840#include "ash/wm/status_area_layout_manager.h"
[email protected]e6e41d2f2012-10-29 19:22:1941#include "ash/wm/system_background_controller.h"
[email protected]d90b8392012-06-13 09:34:5642#include "ash/wm/system_modal_container_layout_manager.h"
[email protected]5dc51db82012-09-11 03:39:0143#include "ash/wm/toplevel_window_event_handler.h"
[email protected]8d625fb2012-07-18 16:40:0644#include "ash/wm/window_properties.h"
[email protected]a41b4e12013-09-20 04:36:3445#include "ash/wm/window_state.h"
[email protected]700849f2013-04-30 17:49:2046#include "ash/wm/window_util.h"
[email protected]d90b8392012-06-13 09:34:5647#include "ash/wm/workspace_controller.h"
[email protected]e6e41d2f2012-10-29 19:22:1948#include "base/command_line.h"
[email protected]1e84c632013-06-27 23:12:2149#include "base/time/time.h"
[email protected]f1853122012-06-27 16:21:2650#include "ui/aura/client/aura_constants.h"
[email protected]8b3e3d82013-08-20 14:36:3051#include "ui/aura/client/drag_drop_client.h"
[email protected]d90b8392012-06-13 09:34:5652#include "ui/aura/client/tooltip_client.h"
53#include "ui/aura/root_window.h"
[email protected]f1853122012-06-27 16:21:2654#include "ui/aura/window.h"
[email protected]cf6fea22013-08-07 14:24:0155#include "ui/aura/window_delegate.h"
[email protected]f1853122012-06-27 16:21:2656#include "ui/aura/window_observer.h"
[email protected]8b3e3d82013-08-20 14:36:3057#include "ui/aura/window_tracker.h"
[email protected]cf6fea22013-08-07 14:24:0158#include "ui/base/hit_test.h"
[email protected]431552c2012-10-23 00:38:3359#include "ui/base/models/menu_model.h"
[email protected]f8e6aad2013-08-30 21:49:1160#include "ui/gfx/display.h"
[email protected]8d625fb2012-07-18 16:40:0661#include "ui/gfx/screen.h"
[email protected]86459e2c2013-04-10 13:39:2462#include "ui/keyboard/keyboard_controller.h"
63#include "ui/keyboard/keyboard_util.h"
[email protected]431552c2012-10-23 00:38:3364#include "ui/views/controls/menu/menu_runner.h"
[email protected]23a2dc82013-08-22 15:04:2265#include "ui/views/corewm/capture_controller.h"
[email protected]b5756e22012-11-30 01:32:0266#include "ui/views/corewm/visibility_controller.h"
[email protected]431552c2012-10-23 00:38:3367#include "ui/views/view_model.h"
68#include "ui/views/view_model_utils.h"
[email protected]d90b8392012-06-13 09:34:5669
[email protected]252eb232013-08-14 22:09:2770#if defined(OS_CHROMEOS)
71#include "ash/wm/boot_splash_screen_chromeos.h"
72#endif
73
[email protected]d90b8392012-06-13 09:34:5674namespace ash {
75namespace {
76
[email protected]252eb232013-08-14 22:09:2777#if defined(OS_CHROMEOS)
[email protected]bca9a7e2012-11-10 06:25:4978// Duration for the animation that hides the boot splash screen, in
79// milliseconds. This should be short enough in relation to
80// wm/window_animation.cc's brightness/grayscale fade animation that the login
81// background image animation isn't hidden by the splash screen animation.
82const int kBootSplashScreenHideDurationMs = 500;
[email protected]252eb232013-08-14 22:09:2783#endif
[email protected]bca9a7e2012-11-10 06:25:4984
[email protected]d90b8392012-06-13 09:34:5685// Creates a new window for use as a container.
86aura::Window* CreateContainer(int window_id,
87 const char* name,
88 aura::Window* parent) {
89 aura::Window* container = new aura::Window(NULL);
90 container->set_id(window_id);
91 container->SetName(name);
92 container->Init(ui::LAYER_NOT_DRAWN);
93 parent->AddChild(container);
94 if (window_id != internal::kShellWindowId_UnparentedControlContainer)
95 container->Show();
96 return container;
97}
98
[email protected]95058572012-08-20 14:57:2999// Reparents |window| to |new_parent|.
100void ReparentWindow(aura::Window* window, aura::Window* new_parent) {
101 // Update the restore bounds to make it relative to the display.
[email protected]a41b4e12013-09-20 04:36:34102 wm::WindowState* state = wm::GetWindowState(window);
103 gfx::Rect restore_bounds;
104 bool has_restore_bounds = state->HasRestoreBounds();
105 if (has_restore_bounds)
106 restore_bounds = state->GetRestoreBoundsInParent();
[email protected]95058572012-08-20 14:57:29107 new_parent->AddChild(window);
[email protected]a41b4e12013-09-20 04:36:34108 if (has_restore_bounds)
109 state->SetRestoreBoundsInParent(restore_bounds);
[email protected]95058572012-08-20 14:57:29110}
111
112// Reparents the appropriate set of windows from |src| to |dst|.
[email protected]bf9cdb362013-10-25 19:22:45113void ReparentAllWindows(aura::Window* src, aura::Window* dst) {
[email protected]95058572012-08-20 14:57:29114 // Set of windows to move.
[email protected]f1853122012-06-27 16:21:26115 const int kContainerIdsToMove[] = {
116 internal::kShellWindowId_DefaultContainer,
[email protected]beb4e5c2013-06-18 15:37:07117 internal::kShellWindowId_DockedContainer,
[email protected]95db9c12013-01-31 11:47:44118 internal::kShellWindowId_PanelContainer,
[email protected]f1853122012-06-27 16:21:26119 internal::kShellWindowId_AlwaysOnTopContainer,
120 internal::kShellWindowId_SystemModalContainer,
121 internal::kShellWindowId_LockSystemModalContainer,
[email protected]6274d312012-10-04 22:06:41122 internal::kShellWindowId_InputMethodContainer,
[email protected]a9754872013-01-25 07:44:00123 internal::kShellWindowId_UnparentedControlContainer,
[email protected]f1853122012-06-27 16:21:26124 };
[email protected]f1853122012-06-27 16:21:26125 for (size_t i = 0; i < arraysize(kContainerIdsToMove); i++) {
126 int id = kContainerIdsToMove[i];
127 aura::Window* src_container = Shell::GetContainer(src, id);
128 aura::Window* dst_container = Shell::GetContainer(dst, id);
[email protected]5b6021902013-02-26 05:33:29129 while (!src_container->children().empty()) {
130 // Restart iteration from the source container windows each time as they
131 // may change as a result of moving other windows.
132 aura::Window::Windows::const_iterator iter =
133 src_container->children().begin();
134 while (iter != src_container->children().end() &&
135 internal::SystemModalContainerLayoutManager::IsModalBackground(
136 *iter)) {
137 ++iter;
138 }
139 // If the entire window list is modal background windows then stop.
140 if (iter == src_container->children().end())
141 break;
142 ReparentWindow(*iter, dst_container);
[email protected]f1853122012-06-27 16:21:26143 }
144 }
145}
146
[email protected]8d625fb2012-07-18 16:40:06147// Mark the container window so that a widget added to this container will
148// use the virtual screeen coordinates instead of parent.
149void SetUsesScreenCoordinates(aura::Window* container) {
150 container->SetProperty(internal::kUsesScreenCoordinatesKey, true);
151}
152
[email protected]e887c6c2013-07-08 19:35:53153// Mark the container window so that a widget added to this container will
154// say in the same root window regardless of the bounds specified.
155void DescendantShouldStayInSameRootWindow(aura::Window* container) {
156 container->SetProperty(internal::kStayInSameRootWindowKey, true);
157}
158
[email protected]cf6fea22013-08-07 14:24:01159// A window delegate which does nothing. Used to create a window that
160// is a event target, but do nothing.
161class EmptyWindowDelegate : public aura::WindowDelegate {
162 public:
163 EmptyWindowDelegate() {}
164 virtual ~EmptyWindowDelegate() {}
165
166 // aura::WindowDelegate overrides:
167 virtual gfx::Size GetMinimumSize() const OVERRIDE {
168 return gfx::Size();
169 }
170 virtual gfx::Size GetMaximumSize() const OVERRIDE {
171 return gfx::Size();
172 }
173 virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
174 const gfx::Rect& new_bounds) OVERRIDE {
175 }
176 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
177 return gfx::kNullCursor;
178 }
179 virtual int GetNonClientComponent(
180 const gfx::Point& point) const OVERRIDE {
181 return HTNOWHERE;
182 }
183 virtual bool ShouldDescendIntoChildForEventHandling(
184 aura::Window* child,
185 const gfx::Point& location) OVERRIDE {
186 return false;
187 }
188 virtual bool CanFocus() OVERRIDE {
189 return false;
190 }
191 virtual void OnCaptureLost() OVERRIDE {
192 }
193 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
194 }
195 virtual void OnDeviceScaleFactorChanged(
196 float device_scale_factor) OVERRIDE {
197 }
198 virtual void OnWindowDestroying() OVERRIDE {}
[email protected]febe1fd62013-08-07 16:07:24199 virtual void OnWindowDestroyed() OVERRIDE {
200 delete this;
201 }
[email protected]cf6fea22013-08-07 14:24:01202 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {
203 }
204 virtual bool HasHitTestMask() const OVERRIDE {
205 return false;
206 }
207 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {}
[email protected]1ddbe932013-09-12 06:23:16208 virtual void DidRecreateLayer(ui::Layer* old_layer,
209 ui::Layer* new_layer) OVERRIDE {}
[email protected]cf6fea22013-08-07 14:24:01210
211 private:
212 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate);
213};
214
[email protected]d90b8392012-06-13 09:34:56215} // namespace
216
217namespace internal {
218
[email protected]a273d33a2013-10-17 12:41:21219void RootWindowController::CreateForPrimaryDisplay(
[email protected]bf9cdb362013-10-25 19:22:45220 aura::RootWindow* root) {
[email protected]a273d33a2013-10-17 12:41:21221 RootWindowController* controller = new RootWindowController(root);
222 controller->Init(true /* primary */,
223 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot());
[email protected]d90b8392012-06-13 09:34:56224}
225
[email protected]a273d33a2013-10-17 12:41:21226void RootWindowController::CreateForSecondaryDisplay(aura::RootWindow * root) {
227 RootWindowController* controller = new RootWindowController(root);
228 controller->Init(false /* secondary */, false /* first run */);
[email protected]6675e1c2012-09-11 09:15:45229}
230
[email protected]88d71122012-10-18 07:11:01231// static
[email protected]a0afeb12012-12-10 22:57:09232RootWindowController* RootWindowController::ForLauncher(aura::Window* window) {
[email protected]8c0ec432013-05-10 04:33:39233 return GetRootWindowController(window->GetRootWindow());
[email protected]88d71122012-10-18 07:11:01234}
235
[email protected]a0afeb12012-12-10 22:57:09236// static
[email protected]ccff3d72013-02-06 04:26:28237RootWindowController* RootWindowController::ForWindow(
238 const aura::Window* window) {
[email protected]a0afeb12012-12-10 22:57:09239 return GetRootWindowController(window->GetRootWindow());
240}
241
242// static
[email protected]d17642d2013-09-12 23:44:38243RootWindowController* RootWindowController::ForTargetRootWindow() {
244 return internal::GetRootWindowController(Shell::GetTargetRootWindow());
[email protected]a0afeb12012-12-10 22:57:09245}
246
[email protected]a273d33a2013-10-17 12:41:21247RootWindowController::~RootWindowController() {
248 Shutdown();
249 root_window_.reset();
250 // The CaptureClient needs to be around for as long as the RootWindow is
251 // valid.
252 capture_client_.reset();
253}
254
[email protected]0bf61732013-07-02 04:35:10255void RootWindowController::SetWallpaperController(
256 DesktopBackgroundWidgetController* controller) {
257 wallpaper_controller_.reset(controller);
258}
259
260void RootWindowController::SetAnimatingWallpaperController(
261 AnimatingDesktopController* controller) {
262 if (animating_wallpaper_controller_.get())
263 animating_wallpaper_controller_->StopAnimating();
264 animating_wallpaper_controller_.reset(controller);
265}
266
[email protected]6675e1c2012-09-11 09:15:45267void RootWindowController::Shutdown() {
[email protected]d141b922013-07-09 08:13:17268 Shell::GetInstance()->RemoveShellObserver(this);
269
[email protected]0bf61732013-07-02 04:35:10270 if (animating_wallpaper_controller_.get())
271 animating_wallpaper_controller_->StopAnimating();
272 wallpaper_controller_.reset();
273 animating_wallpaper_controller_.reset();
274
[email protected]d17642d2013-09-12 23:44:38275 // Change the target root window before closing child windows. If any child
[email protected]c98a4922013-09-05 20:01:42276 // being removed triggers a relayout of the shelf it will try to build a
[email protected]d17642d2013-09-12 23:44:38277 // window list adding windows from the target root window's containers which
[email protected]c98a4922013-09-05 20:01:42278 // may have already gone away.
[email protected]bf9cdb362013-10-25 19:22:45279 if (Shell::GetTargetRootWindow()->GetDispatcher() == root_window_) {
[email protected]d17642d2013-09-12 23:44:38280 Shell::GetInstance()->set_target_root_window(
[email protected]f634dd32012-07-23 22:49:07281 Shell::GetPrimaryRootWindow() == root_window_.get() ?
282 NULL : Shell::GetPrimaryRootWindow());
283 }
[email protected]c98a4922013-09-05 20:01:42284
285 CloseChildWindows();
[email protected]6b2d4a0b2013-09-06 06:29:54286 GetRootWindowSettings(root_window_.get())->controller = NULL;
[email protected]d90b8392012-06-13 09:34:56287 screen_dimmer_.reset();
288 workspace_controller_.reset();
[email protected]6675e1c2012-09-11 09:15:45289 // Forget with the display ID so that display lookup
290 // ends up with invalid display.
[email protected]f8e6aad2013-08-30 21:49:11291 internal::GetRootWindowSettings(root_window_.get())->display_id =
292 gfx::Display::kInvalidDisplayID;
[email protected]6675e1c2012-09-11 09:15:45293 // And this root window should no longer process events.
294 root_window_->PrepareForShutdown();
[email protected]e74aaf0a2012-10-12 18:42:28295
[email protected]956a6a42012-10-29 23:58:10296 system_background_.reset();
[email protected]d90b8392012-06-13 09:34:56297}
298
[email protected]c0ce80e2012-10-05 23:28:27299SystemModalContainerLayoutManager*
[email protected]8674b312012-10-12 19:02:44300RootWindowController::GetSystemModalLayoutManager(aura::Window* window) {
301 aura::Window* container = NULL;
302 if (window) {
[email protected]3b162e12012-11-09 11:52:35303 if (window->parent() &&
304 window->parent()->id() >= kShellWindowId_LockScreenContainer) {
305 container = GetContainer(kShellWindowId_LockSystemModalContainer);
306 } else {
[email protected]8674b312012-10-12 19:02:44307 container = GetContainer(kShellWindowId_SystemModalContainer);
[email protected]3b162e12012-11-09 11:52:35308 }
[email protected]8674b312012-10-12 19:02:44309 } else {
[email protected]a44afbbd2013-07-24 21:49:35310 int modal_window_id = Shell::GetInstance()->session_state_delegate()
311 ->IsUserSessionBlocked() ? kShellWindowId_LockSystemModalContainer :
312 kShellWindowId_SystemModalContainer;
[email protected]8674b312012-10-12 19:02:44313 container = GetContainer(modal_window_id);
314 }
[email protected]bb0c7cd42013-05-20 23:39:45315 return container ? static_cast<SystemModalContainerLayoutManager*>(
316 container->layout_manager()) : NULL;
[email protected]c0ce80e2012-10-05 23:28:27317}
318
[email protected]d90b8392012-06-13 09:34:56319aura::Window* RootWindowController::GetContainer(int container_id) {
320 return root_window_->GetChildById(container_id);
321}
322
[email protected]d8a24952013-08-05 20:05:05323const aura::Window* RootWindowController::GetContainer(int container_id) const {
324 return root_window_->GetChildById(container_id);
325}
326
[email protected]e74aaf0a2012-10-12 18:42:28327void RootWindowController::ShowLauncher() {
[email protected]80549c152013-07-02 01:42:47328 if (!shelf_->launcher())
[email protected]e74aaf0a2012-10-12 18:42:28329 return;
[email protected]478c6c32013-03-09 02:50:58330 shelf_->launcher()->SetVisible(true);
331 shelf_->status_area_widget()->Show();
[email protected]e74aaf0a2012-10-12 18:42:28332}
333
[email protected]756bda12013-07-03 08:17:06334void RootWindowController::OnLauncherCreated() {
335 if (panel_layout_manager_)
336 panel_layout_manager_->SetLauncher(shelf_->launcher());
[email protected]7115bd32013-07-19 08:25:39337 if (docked_layout_manager_) {
[email protected]756bda12013-07-03 08:17:06338 docked_layout_manager_->SetLauncher(shelf_->launcher());
[email protected]7115bd32013-07-19 08:25:39339 if (shelf_->shelf_layout_manager())
340 docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager());
341 }
[email protected]756bda12013-07-03 08:17:06342}
343
[email protected]16059276d2012-10-22 18:59:50344void RootWindowController::UpdateAfterLoginStatusChange(
345 user::LoginStatus status) {
[email protected]cf6fea22013-08-07 14:24:01346 if (status != user::LOGGED_IN_NONE)
347 mouse_event_target_.reset();
[email protected]80549c152013-07-02 01:42:47348 if (shelf_->status_area_widget())
[email protected]478c6c32013-03-09 02:50:58349 shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status);
[email protected]16059276d2012-10-22 18:59:50350}
351
[email protected]bca9a7e2012-11-10 06:25:49352void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() {
[email protected]252eb232013-08-14 22:09:27353#if defined(OS_CHROMEOS)
[email protected]bca9a7e2012-11-10 06:25:49354 if (CommandLine::ForCurrentProcess()->HasSwitch(
355 switches::kAshAnimateFromBootSplashScreen) &&
356 boot_splash_screen_.get()) {
357 // Make the splash screen fade out so it doesn't obscure the desktop
358 // wallpaper's brightness/grayscale animation.
359 boot_splash_screen_->StartHideAnimation(
360 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs));
361 }
[email protected]252eb232013-08-14 22:09:27362#endif
[email protected]bca9a7e2012-11-10 06:25:49363}
364
[email protected]0bf61732013-07-02 04:35:10365void RootWindowController::OnWallpaperAnimationFinished(views::Widget* widget) {
366 // Make sure the wallpaper is visible.
[email protected]bca9a7e2012-11-10 06:25:49367 system_background_->SetColor(SK_ColorBLACK);
[email protected]252eb232013-08-14 22:09:27368#if defined(OS_CHROMEOS)
[email protected]bca9a7e2012-11-10 06:25:49369 boot_splash_screen_.reset();
[email protected]252eb232013-08-14 22:09:27370#endif
[email protected]0bf61732013-07-02 04:35:10371
372 Shell::GetInstance()->user_wallpaper_delegate()->
373 OnWallpaperAnimationFinished();
374 // Only removes old component when wallpaper animation finished. If we
375 // remove the old one before the new wallpaper is done fading in there will
376 // be a white flash during the animation.
377 if (animating_wallpaper_controller()) {
378 DesktopBackgroundWidgetController* controller =
379 animating_wallpaper_controller()->GetController(true);
380 // |desktop_widget_| should be the same animating widget we try to move
381 // to |kDesktopController|. Otherwise, we may close |desktop_widget_|
382 // before move it to |kDesktopController|.
383 DCHECK_EQ(controller->widget(), widget);
384 // Release the old controller and close its background widget.
385 SetWallpaperController(controller);
386 }
[email protected]697f04c2012-10-03 01:15:10387}
388
[email protected]d90b8392012-06-13 09:34:56389void RootWindowController::CloseChildWindows() {
[email protected]cf6fea22013-08-07 14:24:01390 mouse_event_target_.reset();
391
[email protected]b6ba05d902013-10-04 21:38:45392 // Deactivate keyboard container before closing child windows and shutting
393 // down associated layout managers.
394 DeactivateKeyboard(Shell::GetInstance()->keyboard_controller());
395
[email protected]80549c152013-07-02 01:42:47396 if (!shelf_.get())
397 return;
[email protected]79a87b7e2013-01-25 05:08:22398 // panel_layout_manager_ needs to be shut down before windows are destroyed.
399 if (panel_layout_manager_) {
400 panel_layout_manager_->Shutdown();
401 panel_layout_manager_ = NULL;
402 }
[email protected]7115bd32013-07-19 08:25:39403 // docked_layout_manager_ needs to be shut down before windows are destroyed.
404 if (docked_layout_manager_) {
405 if (shelf_->shelf_layout_manager())
406 docked_layout_manager_->RemoveObserver(shelf_->shelf_layout_manager());
407 docked_layout_manager_->Shutdown();
408 docked_layout_manager_ = NULL;
409 }
[email protected]79a87b7e2013-01-25 05:08:22410
[email protected]8b3e3d82013-08-20 14:36:30411 aura::client::SetDragDropClient(root_window_.get(), NULL);
412
[email protected]478c6c32013-03-09 02:50:58413 // TODO(harrym): Remove when Status Area Widget is a child view.
[email protected]80549c152013-07-02 01:42:47414 shelf_->ShutdownStatusAreaWidget();
[email protected]478c6c32013-03-09 02:50:58415
[email protected]80549c152013-07-02 01:42:47416 if (shelf_->shelf_layout_manager())
[email protected]a3e412712013-07-11 09:32:58417 shelf_->shelf_layout_manager()->PrepareForShutdown();
[email protected]e74aaf0a2012-10-12 18:42:28418
[email protected]d90b8392012-06-13 09:34:56419 // Close background widget first as it depends on tooltip.
[email protected]0bf61732013-07-02 04:35:10420 wallpaper_controller_.reset();
421 animating_wallpaper_controller_.reset();
[email protected]b4ddc7a2012-08-07 04:17:32422
[email protected]d90b8392012-06-13 09:34:56423 workspace_controller_.reset();
424 aura::client::SetTooltipClient(root_window_.get(), NULL);
425
[email protected]0fbfa972013-10-02 19:23:33426 // Explicitly destroy top level windows. We do this as during part of
427 // destruction such windows may query the RootWindow for state.
[email protected]8b3e3d82013-08-20 14:36:30428 std::queue<aura::Window*> non_toplevel_windows;
429 non_toplevel_windows.push(root_window_.get());
430 while (!non_toplevel_windows.empty()) {
431 aura::Window* non_toplevel_window = non_toplevel_windows.front();
432 non_toplevel_windows.pop();
433 aura::WindowTracker toplevel_windows;
434 for (size_t i = 0; i < non_toplevel_window->children().size(); ++i) {
435 aura::Window* child = non_toplevel_window->children()[i];
[email protected]0fbfa972013-10-02 19:23:33436 if (!child->owned_by_parent())
437 continue;
[email protected]8b3e3d82013-08-20 14:36:30438 if (child->delegate())
439 toplevel_windows.Add(child);
440 else
441 non_toplevel_windows.push(child);
442 }
443 while (!toplevel_windows.windows().empty())
444 delete *toplevel_windows.windows().begin();
[email protected]d90b8392012-06-13 09:34:56445 }
[email protected]8b3e3d82013-08-20 14:36:30446 // And then remove the containers.
[email protected]0fbfa972013-10-02 19:23:33447 while (!root_window_->children().empty()) {
448 aura::Window* window = root_window_->children()[0];
449 if (window->owned_by_parent()) {
450 delete window;
451 } else {
452 root_window_->RemoveChild(window);
453 }
454 }
[email protected]478c6c32013-03-09 02:50:58455
456 shelf_.reset(NULL);
[email protected]d90b8392012-06-13 09:34:56457}
458
[email protected]bf9cdb362013-10-25 19:22:45459void RootWindowController::MoveWindowsTo(aura::Window* dst) {
[email protected]8039e06c2013-01-17 23:34:50460 // Forget the shelf early so that shelf don't update itself using wrong
461 // display info.
462 workspace_controller_->SetShelf(NULL);
[email protected]95058572012-08-20 14:57:29463 ReparentAllWindows(root_window_.get(), dst);
[email protected]f1853122012-06-27 16:21:26464}
465
[email protected]478c6c32013-03-09 02:50:58466ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
[email protected]80549c152013-07-02 01:42:47467 return shelf_->shelf_layout_manager();
[email protected]478c6c32013-03-09 02:50:58468}
469
[email protected]a0afeb12012-12-10 22:57:09470SystemTray* RootWindowController::GetSystemTray() {
471 // We assume in throughout the code that this will not return NULL. If code
472 // triggers this for valid reasons, it should test status_area_widget first.
[email protected]80549c152013-07-02 01:42:47473 CHECK(shelf_->status_area_widget());
[email protected]478c6c32013-03-09 02:50:58474 return shelf_->status_area_widget()->system_tray();
[email protected]a0afeb12012-12-10 22:57:09475}
476
[email protected]940fb1c2013-06-18 16:54:28477void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen,
478 ui::MenuSourceType source_type) {
[email protected]431552c2012-10-23 00:38:33479 DCHECK(Shell::GetInstance()->delegate());
480 scoped_ptr<ui::MenuModel> menu_model(
[email protected]8c0ec432013-05-10 04:33:39481 Shell::GetInstance()->delegate()->CreateContextMenu(root_window()));
[email protected]7f7f65c2013-04-17 16:47:13482 if (!menu_model)
[email protected]8e837ec2013-01-31 01:48:33483 return;
[email protected]431552c2012-10-23 00:38:33484
[email protected]6175fc42013-04-05 05:58:58485 // Background controller may not be set yet if user clicked on status are
486 // before initial animation completion. See crbug.com/222218
[email protected]0bf61732013-07-02 04:35:10487 if (!wallpaper_controller_.get())
[email protected]431552c2012-10-23 00:38:33488 return;
489
[email protected]6175fc42013-04-05 05:58:58490 views::MenuRunner menu_runner(menu_model.get());
[email protected]0bf61732013-07-02 04:35:10491 if (menu_runner.RunMenuAt(wallpaper_controller_->widget(),
[email protected]6175fc42013-04-05 05:58:58492 NULL, gfx::Rect(location_in_screen, gfx::Size()),
[email protected]940fb1c2013-06-18 16:54:28493 views::MenuItemView::TOPLEFT, source_type,
494 views::MenuRunner::CONTEXT_MENU) ==
[email protected]6175fc42013-04-05 05:58:58495 views::MenuRunner::MENU_DELETED) {
496 return;
497 }
498
[email protected]431552c2012-10-23 00:38:33499 Shell::GetInstance()->UpdateShelfVisibility();
500}
501
[email protected]e74aaf0a2012-10-12 18:42:28502void RootWindowController::UpdateShelfVisibility() {
[email protected]478c6c32013-03-09 02:50:58503 shelf_->shelf_layout_manager()->UpdateVisibilityState();
[email protected]e74aaf0a2012-10-12 18:42:28504}
505
[email protected]e3bc88e2013-09-06 06:22:06506const aura::Window* RootWindowController::GetTopmostFullscreenWindow() const {
507 const aura::Window::Windows& windows =
508 GetContainer(kShellWindowId_DefaultContainer)->children();
509 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin();
510 iter != windows.rend(); ++iter) {
[email protected]a41b4e12013-09-20 04:36:34511 if (wm::GetWindowState(*iter)->IsFullscreen())
[email protected]e3bc88e2013-09-06 06:22:06512 return *iter;
[email protected]2ee2f5d2013-01-10 23:37:16513 }
[email protected]700849f2013-04-30 17:49:20514 return NULL;
[email protected]2ee2f5d2013-01-10 23:37:16515}
516
[email protected]b6ba05d902013-10-04 21:38:45517void RootWindowController::ActivateKeyboard(
518 keyboard::KeyboardController* keyboard_controller) {
519 if (!keyboard::IsKeyboardEnabled() ||
520 GetContainer(kShellWindowId_VirtualKeyboardContainer)) {
521 return;
522 }
523 DCHECK(keyboard_controller);
524 keyboard_controller->AddObserver(shelf()->shelf_layout_manager());
525 keyboard_controller->AddObserver(panel_layout_manager_);
526 keyboard_controller->AddObserver(docked_layout_manager_);
527 aura::Window* parent = root_window();
528 aura::Window* keyboard_container =
529 keyboard_controller->GetContainerWindow();
530 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer);
531 parent->AddChild(keyboard_container);
532 // TODO(oshima): Bounds of keyboard container should be handled by
533 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager.
534 keyboard_container->SetBounds(parent->bounds());
535}
[email protected]86459e2c2013-04-10 13:39:24536
[email protected]b6ba05d902013-10-04 21:38:45537void RootWindowController::DeactivateKeyboard(
538 keyboard::KeyboardController* keyboard_controller) {
539 if (!keyboard::IsKeyboardEnabled())
540 return;
[email protected]5416f282013-04-29 20:52:48541
[email protected]b6ba05d902013-10-04 21:38:45542 DCHECK(keyboard_controller);
543 aura::Window* keyboard_container =
544 keyboard_controller->GetContainerWindow();
545 if (keyboard_container->GetRootWindow() == root_window()) {
546 root_window()->RemoveChild(keyboard_container);
547 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager());
548 keyboard_controller->RemoveObserver(panel_layout_manager_);
549 keyboard_controller->RemoveObserver(docked_layout_manager_);
[email protected]86459e2c2013-04-10 13:39:24550 }
551}
552
553
[email protected]a4cd6d32012-09-12 03:42:13554////////////////////////////////////////////////////////////////////////////////
555// RootWindowController, private:
556
[email protected]a273d33a2013-10-17 12:41:21557RootWindowController::RootWindowController(aura::RootWindow* root_window)
558 : root_window_(root_window),
559 root_window_layout_(NULL),
560 docked_layout_manager_(NULL),
561 panel_layout_manager_(NULL),
562 touch_hud_debug_(NULL),
563 touch_hud_projection_(NULL) {
564 GetRootWindowSettings(root_window)->controller = this;
565 screen_dimmer_.reset(new ScreenDimmer(root_window));
566
567 stacking_controller_.reset(new StackingController);
[email protected]e3225e02013-10-23 20:44:37568 aura::client::SetWindowTreeClient(root_window, stacking_controller_.get());
[email protected]a273d33a2013-10-17 12:41:21569 capture_client_.reset(new views::corewm::ScopedCaptureClient(root_window));
570}
571
572void RootWindowController::Init(bool is_primary, bool first_run_after_boot) {
573 Shell::GetInstance()->InitRootWindow(root_window_.get());
574
575 root_window_->SetCursor(ui::kCursorPointer);
576 CreateContainersInRootWindow(root_window_.get());
577 CreateSystemBackground(first_run_after_boot);
578
579 InitLayoutManagers();
580 InitTouchHuds();
581
582 if (Shell::GetPrimaryRootWindowController()->
583 GetSystemModalLayoutManager(NULL)->has_modal_background()) {
584 GetSystemModalLayoutManager(NULL)->CreateModalBackground();
585 }
586
587 Shell* shell = Shell::GetInstance();
588 shell->AddShellObserver(this);
589
590 if (is_primary) {
[email protected]a3565792013-10-18 12:52:37591 root_window_layout()->OnWindowResized();
[email protected]a273d33a2013-10-17 12:41:21592 shell->InitKeyboard(this);
593 } else {
594 root_window_layout()->OnWindowResized();
595 shell->desktop_background_controller()->OnRootWindowAdded(
596 root_window_.get());
597 shell->high_contrast_controller()->OnRootWindowAdded(root_window_.get());
598 root_window_->ShowRootWindow();
599 // Activate new root for testing.
600 // TODO(oshima): remove this.
601 shell->set_target_root_window(root_window_.get());
602
603 // Create a launcher if a user is already logged.
604 if (shell->session_state_delegate()->NumberOfLoggedInUsers())
605 shelf()->CreateLauncher();
606 }
607}
608
[email protected]756bda12013-07-03 08:17:06609void RootWindowController::InitLayoutManagers() {
610 root_window_layout_ =
611 new RootWindowLayoutManager(root_window_.get());
612 root_window_->SetLayoutManager(root_window_layout_);
613
614 aura::Window* default_container =
615 GetContainer(kShellWindowId_DefaultContainer);
616 // Workspace manager has its own layout managers.
617 workspace_controller_.reset(
618 new WorkspaceController(default_container));
619
620 aura::Window* always_on_top_container =
621 GetContainer(kShellWindowId_AlwaysOnTopContainer);
622 always_on_top_container->SetLayoutManager(
623 new BaseLayoutManager(
624 always_on_top_container->GetRootWindow()));
625 always_on_top_controller_.reset(new internal::AlwaysOnTopController);
626 always_on_top_controller_->SetAlwaysOnTopContainer(always_on_top_container);
627
628 DCHECK(!shelf_.get());
629 aura::Window* shelf_container =
630 GetContainer(internal::kShellWindowId_ShelfContainer);
631 // TODO(harrym): Remove when status area is view.
632 aura::Window* status_container =
633 GetContainer(internal::kShellWindowId_StatusContainer);
634 shelf_.reset(new ShelfWidget(
635 shelf_container, status_container, workspace_controller()));
636
[email protected]cf6fea22013-08-07 14:24:01637 if (!Shell::GetInstance()->session_state_delegate()->
638 IsActiveUserSessionStarted()) {
639 // This window exists only to be a event target on login screen.
640 // It does not have to handle events, nor be visible.
641 mouse_event_target_.reset(new aura::Window(new EmptyWindowDelegate));
642 mouse_event_target_->Init(ui::LAYER_NOT_DRAWN);
643
644 aura::Window* lock_background_container =
645 GetContainer(internal::kShellWindowId_LockScreenBackgroundContainer);
646 lock_background_container->AddChild(mouse_event_target_.get());
647 mouse_event_target_->Show();
648 }
649
[email protected]756bda12013-07-03 08:17:06650 // Create Docked windows layout manager
651 aura::Window* docked_container = GetContainer(
652 internal::kShellWindowId_DockedContainer);
653 docked_layout_manager_ =
[email protected]375069e2013-10-04 13:54:31654 new internal::DockedWindowLayoutManager(docked_container,
655 workspace_controller());
[email protected]756bda12013-07-03 08:17:06656 docked_container_handler_.reset(
657 new ToplevelWindowEventHandler(docked_container));
658 docked_container->SetLayoutManager(docked_layout_manager_);
659
660 // Create Panel layout manager
661 aura::Window* panel_container = GetContainer(
662 internal::kShellWindowId_PanelContainer);
663 panel_layout_manager_ =
664 new internal::PanelLayoutManager(panel_container);
665 panel_container_handler_.reset(
666 new PanelWindowEventHandler(panel_container));
667 panel_container->SetLayoutManager(panel_layout_manager_);
668}
669
670void RootWindowController::InitTouchHuds() {
671 CommandLine* command_line = CommandLine::ForCurrentProcess();
672 if (command_line->HasSwitch(switches::kAshTouchHud))
673 set_touch_hud_debug(new TouchHudDebug(root_window_.get()));
674 if (Shell::GetInstance()->is_touch_hud_projection_enabled())
675 EnableTouchHudProjection();
676}
677
678void RootWindowController::CreateSystemBackground(
679 bool is_first_run_after_boot) {
680 SkColor color = SK_ColorBLACK;
681#if defined(OS_CHROMEOS)
682 if (is_first_run_after_boot)
683 color = kChromeOsBootColor;
684#endif
685 system_background_.reset(
686 new SystemBackgroundController(root_window_.get(), color));
687
688#if defined(OS_CHROMEOS)
689 // Make a copy of the system's boot splash screen so we can composite it
690 // onscreen until the desktop background is ready.
691 if (is_first_run_after_boot &&
692 (CommandLine::ForCurrentProcess()->HasSwitch(
693 switches::kAshCopyHostBackgroundAtBoot) ||
694 CommandLine::ForCurrentProcess()->HasSwitch(
695 switches::kAshAnimateFromBootSplashScreen)))
696 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get()));
697#endif
698}
699
[email protected]a4cd6d32012-09-12 03:42:13700void RootWindowController::CreateContainersInRootWindow(
701 aura::RootWindow* root_window) {
702 // These containers are just used by PowerButtonController to animate groups
703 // of containers simultaneously without messing up the current transformations
704 // on those containers. These are direct children of the root window; all of
705 // the other containers are their children.
[email protected]e6e41d2f2012-10-29 19:22:19706
707 // The desktop background container is not part of the lock animation, so it
708 // is not included in those animate groups.
[email protected]a4cd6d32012-09-12 03:42:13709 // When screen is locked desktop background is moved to lock screen background
710 // container (moved back on unlock). We want to make sure that there's an
711 // opaque layer occluding the non-lock-screen layers.
[email protected]e6e41d2f2012-10-29 19:22:19712 aura::Window* desktop_background_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27713 kShellWindowId_DesktopBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13714 "DesktopBackgroundContainer",
715 root_window);
[email protected]b5756e22012-11-30 01:32:02716 views::corewm::SetChildWindowVisibilityChangesAnimated(
717 desktop_background_container);
[email protected]a4cd6d32012-09-12 03:42:13718
719 aura::Window* non_lock_screen_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27720 kShellWindowId_NonLockScreenContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13721 "NonLockScreenContainersContainer",
722 root_window);
723
724 aura::Window* lock_background_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27725 kShellWindowId_LockScreenBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13726 "LockScreenBackgroundContainer",
727 root_window);
[email protected]b5756e22012-11-30 01:32:02728 views::corewm::SetChildWindowVisibilityChangesAnimated(
729 lock_background_containers);
[email protected]a4cd6d32012-09-12 03:42:13730
731 aura::Window* lock_screen_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27732 kShellWindowId_LockScreenContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13733 "LockScreenContainersContainer",
734 root_window);
735 aura::Window* lock_screen_related_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27736 kShellWindowId_LockScreenRelatedContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13737 "LockScreenRelatedContainersContainer",
738 root_window);
739
[email protected]c0ce80e2012-10-05 23:28:27740 CreateContainer(kShellWindowId_UnparentedControlContainer,
[email protected]a4cd6d32012-09-12 03:42:13741 "UnparentedControlContainer",
742 non_lock_screen_containers);
743
744 aura::Window* default_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27745 kShellWindowId_DefaultContainer,
[email protected]a4cd6d32012-09-12 03:42:13746 "DefaultContainer",
747 non_lock_screen_containers);
[email protected]b5756e22012-11-30 01:32:02748 views::corewm::SetChildWindowVisibilityChangesAnimated(default_container);
[email protected]a4cd6d32012-09-12 03:42:13749 SetUsesScreenCoordinates(default_container);
750
751 aura::Window* always_on_top_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27752 kShellWindowId_AlwaysOnTopContainer,
[email protected]a4cd6d32012-09-12 03:42:13753 "AlwaysOnTopContainer",
754 non_lock_screen_containers);
755 always_on_top_container_handler_.reset(
756 new ToplevelWindowEventHandler(always_on_top_container));
[email protected]b5756e22012-11-30 01:32:02757 views::corewm::SetChildWindowVisibilityChangesAnimated(
758 always_on_top_container);
[email protected]a4cd6d32012-09-12 03:42:13759 SetUsesScreenCoordinates(always_on_top_container);
760
[email protected]beb4e5c2013-06-18 15:37:07761 aura::Window* docked_container = CreateContainer(
762 kShellWindowId_DockedContainer,
763 "DockedContainer",
764 non_lock_screen_containers);
[email protected]5eab6e92013-09-19 19:09:27765 views::corewm::SetChildWindowVisibilityChangesAnimated(docked_container);
[email protected]beb4e5c2013-06-18 15:37:07766 SetUsesScreenCoordinates(docked_container);
767
[email protected]3f13cf12013-07-12 05:13:59768 aura::Window* shelf_container =
[email protected]478c6c32013-03-09 02:50:58769 CreateContainer(kShellWindowId_ShelfContainer,
[email protected]3f13cf12013-07-12 05:13:59770 "ShelfContainer",
[email protected]a4cd6d32012-09-12 03:42:13771 non_lock_screen_containers);
[email protected]3f13cf12013-07-12 05:13:59772 SetUsesScreenCoordinates(shelf_container);
773 DescendantShouldStayInSameRootWindow(shelf_container);
[email protected]a4cd6d32012-09-12 03:42:13774
[email protected]f2026eb2013-10-22 14:28:56775 aura::Window* panel_container = CreateContainer(
776 kShellWindowId_PanelContainer,
777 "PanelContainer",
778 non_lock_screen_containers);
779 SetUsesScreenCoordinates(panel_container);
780
781 aura::Window* shelf_bubble_container =
782 CreateContainer(kShellWindowId_ShelfBubbleContainer,
783 "ShelfBubbleContainer",
784 non_lock_screen_containers);
785 SetUsesScreenCoordinates(shelf_bubble_container);
786 DescendantShouldStayInSameRootWindow(shelf_bubble_container);
787
[email protected]dc851a4e52012-10-03 00:05:55788 aura::Window* app_list_container =
[email protected]c0ce80e2012-10-05 23:28:27789 CreateContainer(kShellWindowId_AppListContainer,
[email protected]dc851a4e52012-10-03 00:05:55790 "AppListContainer",
791 non_lock_screen_containers);
792 SetUsesScreenCoordinates(app_list_container);
[email protected]a4cd6d32012-09-12 03:42:13793
794 aura::Window* modal_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27795 kShellWindowId_SystemModalContainer,
[email protected]a4cd6d32012-09-12 03:42:13796 "SystemModalContainer",
797 non_lock_screen_containers);
798 modal_container_handler_.reset(
799 new ToplevelWindowEventHandler(modal_container));
[email protected]a4cd6d32012-09-12 03:42:13800 modal_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27801 new SystemModalContainerLayoutManager(modal_container));
[email protected]b5756e22012-11-30 01:32:02802 views::corewm::SetChildWindowVisibilityChangesAnimated(modal_container);
[email protected]a4cd6d32012-09-12 03:42:13803 SetUsesScreenCoordinates(modal_container);
804
805 aura::Window* input_method_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27806 kShellWindowId_InputMethodContainer,
[email protected]a4cd6d32012-09-12 03:42:13807 "InputMethodContainer",
808 non_lock_screen_containers);
[email protected]649eb7462013-10-24 07:52:01809 views::corewm::SetChildWindowVisibilityChangesAnimated(
810 input_method_container);
[email protected]a4cd6d32012-09-12 03:42:13811 SetUsesScreenCoordinates(input_method_container);
812
813 // TODO(beng): Figure out if we can make this use
814 // SystemModalContainerEventFilter instead of stops_event_propagation.
815 aura::Window* lock_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27816 kShellWindowId_LockScreenContainer,
[email protected]a4cd6d32012-09-12 03:42:13817 "LockScreenContainer",
818 lock_screen_containers);
819 lock_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27820 new BaseLayoutManager(root_window));
[email protected]a4cd6d32012-09-12 03:42:13821 SetUsesScreenCoordinates(lock_container);
822 // TODO(beng): stopsevents
823
824 aura::Window* lock_modal_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27825 kShellWindowId_LockSystemModalContainer,
[email protected]a4cd6d32012-09-12 03:42:13826 "LockSystemModalContainer",
827 lock_screen_containers);
828 lock_modal_container_handler_.reset(
829 new ToplevelWindowEventHandler(lock_modal_container));
[email protected]a4cd6d32012-09-12 03:42:13830 lock_modal_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27831 new SystemModalContainerLayoutManager(lock_modal_container));
[email protected]b5756e22012-11-30 01:32:02832 views::corewm::SetChildWindowVisibilityChangesAnimated(lock_modal_container);
[email protected]a4cd6d32012-09-12 03:42:13833 SetUsesScreenCoordinates(lock_modal_container);
834
835 aura::Window* status_container =
[email protected]c0ce80e2012-10-05 23:28:27836 CreateContainer(kShellWindowId_StatusContainer,
[email protected]a4cd6d32012-09-12 03:42:13837 "StatusContainer",
838 lock_screen_related_containers);
839 SetUsesScreenCoordinates(status_container);
[email protected]e887c6c2013-07-08 19:35:53840 DescendantShouldStayInSameRootWindow(status_container);
[email protected]a4cd6d32012-09-12 03:42:13841
842 aura::Window* settings_bubble_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27843 kShellWindowId_SettingBubbleContainer,
[email protected]a4cd6d32012-09-12 03:42:13844 "SettingBubbleContainer",
845 lock_screen_related_containers);
[email protected]b5756e22012-11-30 01:32:02846 views::corewm::SetChildWindowVisibilityChangesAnimated(
847 settings_bubble_container);
[email protected]a4cd6d32012-09-12 03:42:13848 SetUsesScreenCoordinates(settings_bubble_container);
[email protected]e887c6c2013-07-08 19:35:53849 DescendantShouldStayInSameRootWindow(settings_bubble_container);
[email protected]a4cd6d32012-09-12 03:42:13850
851 aura::Window* menu_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27852 kShellWindowId_MenuContainer,
[email protected]a4cd6d32012-09-12 03:42:13853 "MenuContainer",
854 lock_screen_related_containers);
[email protected]b5756e22012-11-30 01:32:02855 views::corewm::SetChildWindowVisibilityChangesAnimated(menu_container);
[email protected]a4cd6d32012-09-12 03:42:13856 SetUsesScreenCoordinates(menu_container);
857
858 aura::Window* drag_drop_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27859 kShellWindowId_DragImageAndTooltipContainer,
[email protected]a4cd6d32012-09-12 03:42:13860 "DragImageAndTooltipContainer",
861 lock_screen_related_containers);
[email protected]b5756e22012-11-30 01:32:02862 views::corewm::SetChildWindowVisibilityChangesAnimated(drag_drop_container);
[email protected]a4cd6d32012-09-12 03:42:13863 SetUsesScreenCoordinates(drag_drop_container);
864
865 aura::Window* overlay_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27866 kShellWindowId_OverlayContainer,
[email protected]a4cd6d32012-09-12 03:42:13867 "OverlayContainer",
868 lock_screen_related_containers);
869 SetUsesScreenCoordinates(overlay_container);
[email protected]a07615f2012-10-24 08:23:08870
871 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
872 "PowerButtonAnimationContainer", root_window) ;
[email protected]a4cd6d32012-09-12 03:42:13873}
874
[email protected]d141b922013-07-09 08:13:17875void RootWindowController::EnableTouchHudProjection() {
876 if (touch_hud_projection_)
877 return;
878 set_touch_hud_projection(new TouchHudProjection(root_window_.get()));
879}
880
881void RootWindowController::DisableTouchHudProjection() {
882 if (!touch_hud_projection_)
883 return;
884 touch_hud_projection_->Remove();
885}
886
887void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
888 shelf_->shelf_layout_manager()->UpdateVisibilityState();
889}
890
891void RootWindowController::OnTouchHudProjectionToggled(bool enabled) {
892 if (enabled)
893 EnableTouchHudProjection();
894 else
895 DisableTouchHudProjection();
896}
897
[email protected]6b2d4a0b2013-09-06 06:29:54898RootWindowController* GetRootWindowController(
[email protected]bf9cdb362013-10-25 19:22:45899 const aura::Window* root_window) {
[email protected]6b2d4a0b2013-09-06 06:29:54900 return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
901}
902
[email protected]d90b8392012-06-13 09:34:56903} // namespace internal
904} // namespace ash