[content shell] implement testRunner.overridePreference
[chromium-blink-merge.git] / ash / root_window_controller.cc
blob1993e4184e3c7d404a58a6228c84512e224ea183
1 // 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.
5 #include "ash/root_window_controller.h"
7 #include <vector>
9 #include "ash/ash_switches.h"
10 #include "ash/desktop_background/desktop_background_widget_controller.h"
11 #include "ash/display/display_controller.h"
12 #include "ash/display/display_manager.h"
13 #include "ash/focus_cycler.h"
14 #include "ash/shelf_types.h"
15 #include "ash/shell.h"
16 #include "ash/shell_delegate.h"
17 #include "ash/shell_factory.h"
18 #include "ash/shell_window_ids.h"
19 #include "ash/system/status_area_widget.h"
20 #include "ash/system/tray/system_tray_delegate.h"
21 #include "ash/wm/base_layout_manager.h"
22 #include "ash/wm/boot_splash_screen.h"
23 #include "ash/wm/panel_layout_manager.h"
24 #include "ash/wm/panel_window_event_filter.h"
25 #include "ash/wm/property_util.h"
26 #include "ash/wm/root_window_layout_manager.h"
27 #include "ash/wm/screen_dimmer.h"
28 #include "ash/wm/shelf_layout_manager.h"
29 #include "ash/wm/status_area_layout_manager.h"
30 #include "ash/wm/system_background_controller.h"
31 #include "ash/wm/system_modal_container_layout_manager.h"
32 #include "ash/wm/toplevel_window_event_handler.h"
33 #include "ash/wm/window_properties.h"
34 #include "ash/wm/workspace_controller.h"
35 #include "base/command_line.h"
36 #include "base/time.h"
37 #include "ui/aura/client/activation_client.h"
38 #include "ui/aura/client/aura_constants.h"
39 #include "ui/aura/client/capture_client.h"
40 #include "ui/aura/client/focus_client.h"
41 #include "ui/aura/client/tooltip_client.h"
42 #include "ui/aura/root_window.h"
43 #include "ui/aura/window.h"
44 #include "ui/aura/window_observer.h"
45 #include "ui/aura/window_tracker.h"
46 #include "ui/base/models/menu_model.h"
47 #include "ui/gfx/display.h"
48 #include "ui/gfx/screen.h"
49 #include "ui/views/controls/menu/menu_model_adapter.h"
50 #include "ui/views/controls/menu/menu_runner.h"
51 #include "ui/views/corewm/visibility_controller.h"
52 #include "ui/views/view_model.h"
53 #include "ui/views/view_model_utils.h"
55 namespace ash {
56 namespace {
58 #if defined(OS_CHROMEOS)
59 // Background color used for the Chrome OS boot splash screen.
60 const SkColor kChromeOsBootColor = SkColorSetARGB(0xff, 0xfe, 0xfe, 0xfe);
61 #endif
63 // Duration for the animation that hides the boot splash screen, in
64 // milliseconds. This should be short enough in relation to
65 // wm/window_animation.cc's brightness/grayscale fade animation that the login
66 // background image animation isn't hidden by the splash screen animation.
67 const int kBootSplashScreenHideDurationMs = 500;
69 // Creates a new window for use as a container.
70 aura::Window* CreateContainer(int window_id,
71 const char* name,
72 aura::Window* parent) {
73 aura::Window* container = new aura::Window(NULL);
74 container->set_id(window_id);
75 container->SetName(name);
76 container->Init(ui::LAYER_NOT_DRAWN);
77 parent->AddChild(container);
78 if (window_id != internal::kShellWindowId_UnparentedControlContainer)
79 container->Show();
80 return container;
83 // Returns all the children of the workspace windows, eg the standard top-level
84 // windows.
85 std::vector<aura::Window*> GetWorkspaceWindows(aura::RootWindow* root) {
86 using aura::Window;
88 std::vector<Window*> windows;
89 Window* container = Shell::GetContainer(
90 root, internal::kShellWindowId_DefaultContainer);
91 for (Window::Windows::const_reverse_iterator i =
92 container->children().rbegin();
93 i != container->children().rend(); ++i) {
94 Window* workspace_window = *i;
95 if (workspace_window->id() == internal::kShellWindowId_WorkspaceContainer) {
96 windows.insert(windows.end(), workspace_window->children().begin(),
97 workspace_window->children().end());
100 return windows;
103 // Reparents |window| to |new_parent|.
104 void ReparentWindow(aura::Window* window, aura::Window* new_parent) {
105 // Update the restore bounds to make it relative to the display.
106 gfx::Rect restore_bounds(GetRestoreBoundsInParent(window));
107 new_parent->AddChild(window);
108 if (!restore_bounds.IsEmpty())
109 SetRestoreBoundsInParent(window, restore_bounds);
112 // Reparents the appropriate set of windows from |src| to |dst|.
113 void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) {
114 // Set of windows to move.
115 const int kContainerIdsToMove[] = {
116 internal::kShellWindowId_DefaultContainer,
117 internal::kShellWindowId_AlwaysOnTopContainer,
118 internal::kShellWindowId_SystemModalContainer,
119 internal::kShellWindowId_LockSystemModalContainer,
120 internal::kShellWindowId_InputMethodContainer,
122 // For workspace windows we need to manually reparent the windows. This way
123 // workspace can move the windows to the appropriate workspace.
124 std::vector<aura::Window*> windows(GetWorkspaceWindows(src));
125 internal::WorkspaceController* workspace_controller =
126 GetRootWindowController(dst)->workspace_controller();
127 for (size_t i = 0; i < windows.size(); ++i) {
128 aura::Window* new_parent =
129 workspace_controller->GetParentForNewWindow(windows[i]);
130 ReparentWindow(windows[i], new_parent);
132 for (size_t i = 0; i < arraysize(kContainerIdsToMove); i++) {
133 int id = kContainerIdsToMove[i];
134 if (id == internal::kShellWindowId_DefaultContainer)
135 continue;
137 aura::Window* src_container = Shell::GetContainer(src, id);
138 aura::Window* dst_container = Shell::GetContainer(dst, id);
139 aura::Window::Windows children = src_container->children();
140 for (aura::Window::Windows::iterator iter = children.begin();
141 iter != children.end(); ++iter) {
142 aura::Window* window = *iter;
143 // Don't move modal screen.
144 if (internal::SystemModalContainerLayoutManager::IsModalBackground(
145 window))
146 continue;
148 ReparentWindow(window, dst_container);
153 // Mark the container window so that a widget added to this container will
154 // use the virtual screeen coordinates instead of parent.
155 void SetUsesScreenCoordinates(aura::Window* container) {
156 container->SetProperty(internal::kUsesScreenCoordinatesKey, true);
159 } // namespace
161 namespace internal {
163 RootWindowController::RootWindowController(aura::RootWindow* root_window)
164 : root_window_(root_window),
165 root_window_layout_(NULL),
166 status_area_widget_(NULL),
167 shelf_(NULL),
168 panel_layout_manager_(NULL) {
169 SetRootWindowController(root_window, this);
170 screen_dimmer_.reset(new ScreenDimmer(root_window));
173 RootWindowController::~RootWindowController() {
174 Shutdown();
175 root_window_.reset();
178 // static
179 RootWindowController* RootWindowController::ForLauncher(aura::Window* window) {
180 if (Shell::IsLauncherPerDisplayEnabled())
181 return GetRootWindowController(window->GetRootWindow());
182 else
183 return Shell::GetPrimaryRootWindowController();
186 // static
187 RootWindowController* RootWindowController::ForWindow(aura::Window* window) {
188 return GetRootWindowController(window->GetRootWindow());
191 // static
192 RootWindowController* RootWindowController::ForActiveRootWindow() {
193 return GetRootWindowController(Shell::GetActiveRootWindow());
196 void RootWindowController::Shutdown() {
197 CloseChildWindows();
198 if (Shell::GetActiveRootWindow() == root_window_.get()) {
199 Shell::GetInstance()->set_active_root_window(
200 Shell::GetPrimaryRootWindow() == root_window_.get() ?
201 NULL : Shell::GetPrimaryRootWindow());
203 SetRootWindowController(root_window_.get(), NULL);
204 screen_dimmer_.reset();
205 workspace_controller_.reset();
206 // Forget with the display ID so that display lookup
207 // ends up with invalid display.
208 root_window_->ClearProperty(kDisplayIdKey);
209 // And this root window should no longer process events.
210 root_window_->PrepareForShutdown();
212 system_background_.reset();
214 // Launcher widget has an InputMethodBridge that references to
215 // |input_method_filter_|'s |input_method_|. So explicitly release
216 // |launcher_| before |input_method_filter_|. And this needs to be
217 // after we delete all containers in case there are still live
218 // browser windows which access LauncherModel during close.
219 launcher_.reset();
222 SystemModalContainerLayoutManager*
223 RootWindowController::GetSystemModalLayoutManager(aura::Window* window) {
224 aura::Window* container = NULL;
225 if (window) {
226 if (window->parent() &&
227 window->parent()->id() >= kShellWindowId_LockScreenContainer) {
228 container = GetContainer(kShellWindowId_LockSystemModalContainer);
229 } else {
230 container = GetContainer(kShellWindowId_SystemModalContainer);
232 } else {
233 user::LoginStatus login = Shell::GetInstance()->system_tray_delegate() ?
234 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() :
235 user::LOGGED_IN_NONE;
236 int modal_window_id = (login == user::LOGGED_IN_LOCKED ||
237 login == user::LOGGED_IN_NONE) ?
238 kShellWindowId_LockSystemModalContainer :
239 kShellWindowId_SystemModalContainer;
240 container = GetContainer(modal_window_id);
242 return static_cast<SystemModalContainerLayoutManager*>(
243 container->layout_manager());
246 aura::Window* RootWindowController::GetContainer(int container_id) {
247 return root_window_->GetChildById(container_id);
250 void RootWindowController::InitLayoutManagers() {
251 root_window_layout_ =
252 new RootWindowLayoutManager(root_window_.get());
253 root_window_->SetLayoutManager(root_window_layout_);
255 aura::Window* default_container =
256 GetContainer(kShellWindowId_DefaultContainer);
257 // Workspace manager has its own layout managers.
258 workspace_controller_.reset(
259 new WorkspaceController(default_container));
261 aura::Window* always_on_top_container =
262 GetContainer(kShellWindowId_AlwaysOnTopContainer);
263 always_on_top_container->SetLayoutManager(
264 new BaseLayoutManager(
265 always_on_top_container->GetRootWindow()));
268 void RootWindowController::InitForPrimaryDisplay() {
269 DCHECK(!status_area_widget_);
270 aura::Window* status_container =
271 GetContainer(ash::internal::kShellWindowId_StatusContainer);
272 // Initialize Primary RootWindow specific items.
273 status_area_widget_ = new internal::StatusAreaWidget(status_container);
274 status_area_widget_->CreateTrayViews();
275 // Login screen manages status area visibility by itself.
276 ShellDelegate* shell_delegate = Shell::GetInstance()->delegate();
277 if (shell_delegate->IsSessionStarted())
278 status_area_widget_->Show();
280 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_);
282 internal::ShelfLayoutManager* shelf_layout_manager =
283 new internal::ShelfLayoutManager(status_area_widget_);
284 GetContainer(internal::kShellWindowId_LauncherContainer)->
285 SetLayoutManager(shelf_layout_manager);
286 shelf_ = shelf_layout_manager;
288 internal::StatusAreaLayoutManager* status_area_layout_manager =
289 new internal::StatusAreaLayoutManager(shelf_layout_manager);
290 GetContainer(internal::kShellWindowId_StatusContainer)->
291 SetLayoutManager(status_area_layout_manager);
293 shelf_layout_manager->set_workspace_controller(
294 workspace_controller());
296 workspace_controller()->SetShelf(shelf_);
298 // TODO(oshima): Disable panels on non primary display for now.
299 // crbug.com/166195.
300 if (root_window_ == Shell::GetPrimaryRootWindow()) {
301 // Create Panel layout manager
302 aura::Window* panel_container = GetContainer(
303 internal::kShellWindowId_PanelContainer);
304 panel_layout_manager_ =
305 new internal::PanelLayoutManager(panel_container);
306 panel_container->AddPreTargetHandler(
307 new internal::PanelWindowEventFilter(
308 panel_container, panel_layout_manager_));
309 panel_container->SetLayoutManager(panel_layout_manager_);
312 if (shell_delegate->IsUserLoggedIn())
313 CreateLauncher();
316 void RootWindowController::CreateContainers() {
317 CreateContainersInRootWindow(root_window_.get());
320 void RootWindowController::CreateSystemBackground(
321 bool is_first_run_after_boot) {
322 SkColor color = SK_ColorBLACK;
323 #if defined(OS_CHROMEOS)
324 if (is_first_run_after_boot)
325 color = kChromeOsBootColor;
326 #endif
327 system_background_.reset(
328 new SystemBackgroundController(root_window_.get(), color));
330 #if defined(OS_CHROMEOS)
331 // Make a copy of the system's boot splash screen so we can composite it
332 // onscreen until the desktop background is ready.
333 if (is_first_run_after_boot &&
334 (CommandLine::ForCurrentProcess()->HasSwitch(
335 switches::kAshCopyHostBackgroundAtBoot) ||
336 CommandLine::ForCurrentProcess()->HasSwitch(
337 switches::kAshAnimateFromBootSplashScreen)))
338 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get()));
339 #endif
342 void RootWindowController::CreateLauncher() {
343 if (launcher_.get())
344 return;
346 aura::Window* default_container =
347 GetContainer(internal::kShellWindowId_DefaultContainer);
348 // Get the delegate first to make sure the launcher model is created.
349 LauncherDelegate* launcher_delegate =
350 Shell::GetInstance()->GetLauncherDelegate();
351 launcher_.reset(new Launcher(Shell::GetInstance()->launcher_model(),
352 launcher_delegate,
353 default_container,
354 shelf_));
356 launcher_->SetFocusCycler(Shell::GetInstance()->focus_cycler());
357 shelf_->SetLauncher(launcher_.get());
359 if (panel_layout_manager_)
360 panel_layout_manager_->SetLauncher(launcher_.get());
362 ShellDelegate* delegate = Shell::GetInstance()->delegate();
363 if (delegate)
364 launcher_->SetVisible(delegate->IsSessionStarted());
365 launcher_->widget()->Show();
368 void RootWindowController::ShowLauncher() {
369 if (!launcher_.get())
370 return;
371 launcher_->SetVisible(true);
372 status_area_widget_->Show();
375 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
376 // TODO(oshima): remove if when launcher per display is enabled by
377 // default.
378 if (shelf_)
379 shelf_->UpdateVisibilityState();
382 void RootWindowController::UpdateAfterLoginStatusChange(
383 user::LoginStatus status) {
384 if (status_area_widget_)
385 status_area_widget_->UpdateAfterLoginStatusChange(status);
388 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() {
389 if (CommandLine::ForCurrentProcess()->HasSwitch(
390 switches::kAshAnimateFromBootSplashScreen) &&
391 boot_splash_screen_.get()) {
392 // Make the splash screen fade out so it doesn't obscure the desktop
393 // wallpaper's brightness/grayscale animation.
394 boot_splash_screen_->StartHideAnimation(
395 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs));
399 void RootWindowController::HandleDesktopBackgroundVisible() {
400 system_background_->SetColor(SK_ColorBLACK);
401 boot_splash_screen_.reset();
404 void RootWindowController::CloseChildWindows() {
405 // The status area needs to be shut down before the windows are destroyed.
406 if (status_area_widget_) {
407 status_area_widget_->Shutdown();
408 status_area_widget_ = NULL;
411 // Closing the windows frees the workspace controller.
412 if (shelf_)
413 shelf_->set_workspace_controller(NULL);
415 // Close background widget first as it depends on tooltip.
416 root_window_->SetProperty(kDesktopController,
417 static_cast<DesktopBackgroundWidgetController*>(NULL));
418 root_window_->SetProperty(kAnimatingDesktopController,
419 static_cast<AnimatingDesktopController*>(NULL));
421 workspace_controller_.reset();
422 aura::client::SetTooltipClient(root_window_.get(), NULL);
424 while (!root_window_->children().empty()) {
425 aura::Window* child = root_window_->children()[0];
426 delete child;
428 launcher_.reset();
429 // All containers are deleted, so reset shelf_.
430 shelf_ = NULL;
433 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) {
434 aura::Window* focused = aura::client::GetFocusClient(dst)->GetFocusedWindow();
435 aura::WindowTracker tracker;
436 if (focused)
437 tracker.Add(focused);
438 aura::client::ActivationClient* activation_client =
439 aura::client::GetActivationClient(dst);
440 aura::Window* active = activation_client->GetActiveWindow();
441 if (active && focused != active)
442 tracker.Add(active);
443 // Deactivate the window to close menu / bubble windows.
444 activation_client->DeactivateWindow(active);
445 // Release capture if any.
446 aura::client::GetCaptureClient(root_window_.get())->
447 SetCapture(NULL);
448 // Clear the focused window if any. This is necessary because a
449 // window may be deleted when losing focus (fullscreen flash for
450 // example). If the focused window is still alive after move, it'll
451 // be re-focused below.
452 aura::client::GetFocusClient(dst)->FocusWindow(NULL, NULL);
454 ReparentAllWindows(root_window_.get(), dst);
456 // Restore focused or active window if it's still alive.
457 if (focused && tracker.Contains(focused) && dst->Contains(focused)) {
458 aura::client::GetFocusClient(dst)->FocusWindow(focused, NULL);
459 } else if (active && tracker.Contains(active) && dst->Contains(active)) {
460 activation_client->ActivateWindow(active);
464 SystemTray* RootWindowController::GetSystemTray() {
465 // We assume in throughout the code that this will not return NULL. If code
466 // triggers this for valid reasons, it should test status_area_widget first.
467 internal::StatusAreaWidget* status_area = status_area_widget();
468 CHECK(status_area);
469 return status_area->system_tray();
472 void RootWindowController::ShowContextMenu(
473 const gfx::Point& location_in_screen) {
474 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ?
475 root_window() : Shell::GetPrimaryRootWindow();
476 DCHECK(Shell::GetInstance()->delegate());
477 scoped_ptr<ui::MenuModel> menu_model(
478 Shell::GetInstance()->delegate()->CreateContextMenu(target));
480 views::MenuModelAdapter menu_model_adapter(menu_model.get());
481 views::MenuRunner menu_runner(menu_model_adapter.CreateMenu());
482 views::Widget* widget =
483 root_window_->GetProperty(kDesktopController)->widget();
485 if (menu_runner.RunMenuAt(
486 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()),
487 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) ==
488 views::MenuRunner::MENU_DELETED)
489 return;
491 Shell::GetInstance()->UpdateShelfVisibility();
494 void RootWindowController::UpdateShelfVisibility() {
495 shelf_->UpdateVisibilityState();
498 void RootWindowController::SetShelfAutoHideBehavior(
499 ShelfAutoHideBehavior behavior) {
500 shelf_->SetAutoHideBehavior(behavior);
503 ShelfAutoHideBehavior RootWindowController::GetShelfAutoHideBehavior() const {
504 return shelf_->auto_hide_behavior();
507 bool RootWindowController::SetShelfAlignment(ShelfAlignment alignment) {
508 return shelf_->SetAlignment(alignment);
511 ShelfAlignment RootWindowController::GetShelfAlignment() {
512 return shelf_->GetAlignment();
515 ////////////////////////////////////////////////////////////////////////////////
516 // RootWindowController, private:
518 void RootWindowController::CreateContainersInRootWindow(
519 aura::RootWindow* root_window) {
520 // These containers are just used by PowerButtonController to animate groups
521 // of containers simultaneously without messing up the current transformations
522 // on those containers. These are direct children of the root window; all of
523 // the other containers are their children.
525 // The desktop background container is not part of the lock animation, so it
526 // is not included in those animate groups.
527 // When screen is locked desktop background is moved to lock screen background
528 // container (moved back on unlock). We want to make sure that there's an
529 // opaque layer occluding the non-lock-screen layers.
530 aura::Window* desktop_background_container = CreateContainer(
531 kShellWindowId_DesktopBackgroundContainer,
532 "DesktopBackgroundContainer",
533 root_window);
534 views::corewm::SetChildWindowVisibilityChangesAnimated(
535 desktop_background_container);
537 aura::Window* non_lock_screen_containers = CreateContainer(
538 kShellWindowId_NonLockScreenContainersContainer,
539 "NonLockScreenContainersContainer",
540 root_window);
542 aura::Window* lock_background_containers = CreateContainer(
543 kShellWindowId_LockScreenBackgroundContainer,
544 "LockScreenBackgroundContainer",
545 root_window);
546 views::corewm::SetChildWindowVisibilityChangesAnimated(
547 lock_background_containers);
549 aura::Window* lock_screen_containers = CreateContainer(
550 kShellWindowId_LockScreenContainersContainer,
551 "LockScreenContainersContainer",
552 root_window);
553 aura::Window* lock_screen_related_containers = CreateContainer(
554 kShellWindowId_LockScreenRelatedContainersContainer,
555 "LockScreenRelatedContainersContainer",
556 root_window);
558 CreateContainer(kShellWindowId_UnparentedControlContainer,
559 "UnparentedControlContainer",
560 non_lock_screen_containers);
562 aura::Window* default_container = CreateContainer(
563 kShellWindowId_DefaultContainer,
564 "DefaultContainer",
565 non_lock_screen_containers);
566 views::corewm::SetChildWindowVisibilityChangesAnimated(default_container);
567 SetUsesScreenCoordinates(default_container);
569 aura::Window* always_on_top_container = CreateContainer(
570 kShellWindowId_AlwaysOnTopContainer,
571 "AlwaysOnTopContainer",
572 non_lock_screen_containers);
573 always_on_top_container_handler_.reset(
574 new ToplevelWindowEventHandler(always_on_top_container));
575 views::corewm::SetChildWindowVisibilityChangesAnimated(
576 always_on_top_container);
577 SetUsesScreenCoordinates(always_on_top_container);
579 aura::Window* panel_container = CreateContainer(
580 kShellWindowId_PanelContainer,
581 "PanelContainer",
582 non_lock_screen_containers);
583 SetUsesScreenCoordinates(panel_container);
585 aura::Window* launcher_container =
586 CreateContainer(kShellWindowId_LauncherContainer,
587 "LauncherContainer",
588 non_lock_screen_containers);
589 SetUsesScreenCoordinates(launcher_container);
591 aura::Window* app_list_container =
592 CreateContainer(kShellWindowId_AppListContainer,
593 "AppListContainer",
594 non_lock_screen_containers);
595 SetUsesScreenCoordinates(app_list_container);
597 aura::Window* modal_container = CreateContainer(
598 kShellWindowId_SystemModalContainer,
599 "SystemModalContainer",
600 non_lock_screen_containers);
601 modal_container_handler_.reset(
602 new ToplevelWindowEventHandler(modal_container));
603 modal_container->SetLayoutManager(
604 new SystemModalContainerLayoutManager(modal_container));
605 views::corewm::SetChildWindowVisibilityChangesAnimated(modal_container);
606 SetUsesScreenCoordinates(modal_container);
608 aura::Window* input_method_container = CreateContainer(
609 kShellWindowId_InputMethodContainer,
610 "InputMethodContainer",
611 non_lock_screen_containers);
612 SetUsesScreenCoordinates(input_method_container);
614 // TODO(beng): Figure out if we can make this use
615 // SystemModalContainerEventFilter instead of stops_event_propagation.
616 aura::Window* lock_container = CreateContainer(
617 kShellWindowId_LockScreenContainer,
618 "LockScreenContainer",
619 lock_screen_containers);
620 lock_container->SetLayoutManager(
621 new BaseLayoutManager(root_window));
622 SetUsesScreenCoordinates(lock_container);
623 // TODO(beng): stopsevents
625 aura::Window* lock_modal_container = CreateContainer(
626 kShellWindowId_LockSystemModalContainer,
627 "LockSystemModalContainer",
628 lock_screen_containers);
629 lock_modal_container_handler_.reset(
630 new ToplevelWindowEventHandler(lock_modal_container));
631 lock_modal_container->SetLayoutManager(
632 new SystemModalContainerLayoutManager(lock_modal_container));
633 views::corewm::SetChildWindowVisibilityChangesAnimated(lock_modal_container);
634 SetUsesScreenCoordinates(lock_modal_container);
636 aura::Window* status_container =
637 CreateContainer(kShellWindowId_StatusContainer,
638 "StatusContainer",
639 lock_screen_related_containers);
640 SetUsesScreenCoordinates(status_container);
642 aura::Window* settings_bubble_container = CreateContainer(
643 kShellWindowId_SettingBubbleContainer,
644 "SettingBubbleContainer",
645 lock_screen_related_containers);
646 views::corewm::SetChildWindowVisibilityChangesAnimated(
647 settings_bubble_container);
648 SetUsesScreenCoordinates(settings_bubble_container);
650 aura::Window* menu_container = CreateContainer(
651 kShellWindowId_MenuContainer,
652 "MenuContainer",
653 lock_screen_related_containers);
654 views::corewm::SetChildWindowVisibilityChangesAnimated(menu_container);
655 SetUsesScreenCoordinates(menu_container);
657 aura::Window* drag_drop_container = CreateContainer(
658 kShellWindowId_DragImageAndTooltipContainer,
659 "DragImageAndTooltipContainer",
660 lock_screen_related_containers);
661 views::corewm::SetChildWindowVisibilityChangesAnimated(drag_drop_container);
662 SetUsesScreenCoordinates(drag_drop_container);
664 aura::Window* overlay_container = CreateContainer(
665 kShellWindowId_OverlayContainer,
666 "OverlayContainer",
667 lock_screen_related_containers);
668 SetUsesScreenCoordinates(overlay_container);
670 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
671 "PowerButtonAnimationContainer", root_window) ;
674 } // namespace internal
675 } // namespace ash