summaryrefslogtreecommitdiffstats
path: root/ash/root_window_controller.cc
blob: 0634ec93954fead5b3b4ee25955948ae9d69f559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/root_window_controller.h"

#include <vector>

#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/display/display_controller.h"
#include "ash/display/multi_display_manager.h"
#include "ash/focus_cycler.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/shell_factory.h"
#include "ash/shell_window_ids.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/wm/base_layout_manager.h"
#include "ash/wm/panel_layout_manager.h"
#include "ash/wm/panel_window_event_filter.h"
#include "ash/wm/property_util.h"
#include "ash/wm/root_window_layout_manager.h"
#include "ash/wm/screen_dimmer.h"
#include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/shelf_types.h"
#include "ash/wm/status_area_layout_manager.h"
#include "ash/wm/system_modal_container_layout_manager.h"
#include "ash/wm/toplevel_window_event_handler.h"
#include "ash/wm/visibility_controller.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/workspace/colored_window_controller.h"
#include "ash/wm/workspace_controller.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/client/tooltip_client.h"
#include "ui/aura/focus_manager.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/aura/window_tracker.h"
#include "ui/base/models/menu_model.h"
#include "ui/gfx/display.h"
#include "ui/gfx/screen.h"
#include "ui/views/controls/menu/menu_model_adapter.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/view_model.h"
#include "ui/views/view_model_utils.h"

namespace ash {
namespace {

#if defined(OS_CHROMEOS)
// Color initially used for the system background after the system has first
// booted.
const SkColor kBootSystemBackgroundColor = 0xFFFEFEFE;
#endif

// Creates a new window for use as a container.
aura::Window* CreateContainer(int window_id,
                              const char* name,
                              aura::Window* parent) {
  aura::Window* container = new aura::Window(NULL);
  container->set_id(window_id);
  container->SetName(name);
  container->Init(ui::LAYER_NOT_DRAWN);
  parent->AddChild(container);
  if (window_id != internal::kShellWindowId_UnparentedControlContainer)
    container->Show();
  return container;
}

// Returns all the children of the workspace windows, eg the standard top-level
// windows.
std::vector<aura::Window*> GetWorkspaceWindows(aura::RootWindow* root) {
  using aura::Window;

  std::vector<Window*> windows;
  Window* container = Shell::GetContainer(
      root, internal::kShellWindowId_DefaultContainer);
  for (Window::Windows::const_reverse_iterator i =
           container->children().rbegin();
       i != container->children().rend(); ++i) {
    Window* workspace_window = *i;
    if (workspace_window->id() == internal::kShellWindowId_WorkspaceContainer) {
      windows.insert(windows.end(), workspace_window->children().begin(),
                     workspace_window->children().end());
    }
  }
  return windows;
}

// Reparents |window| to |new_parent|.
void ReparentWindow(aura::Window* window, aura::Window* new_parent) {
  // Update the restore bounds to make it relative to the display.
  gfx::Rect restore_bounds(GetRestoreBoundsInParent(window));
  new_parent->AddChild(window);
  if (!restore_bounds.IsEmpty())
    SetRestoreBoundsInParent(window, restore_bounds);
}

// Reparents the appropriate set of windows from |src| to |dst|.
void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) {
  // Set of windows to move.
  const int kContainerIdsToMove[] = {
    internal::kShellWindowId_DefaultContainer,
    internal::kShellWindowId_AlwaysOnTopContainer,
    internal::kShellWindowId_SystemModalContainer,
    internal::kShellWindowId_LockSystemModalContainer,
    internal::kShellWindowId_InputMethodContainer,
  };
  // For Workspace2 we need to manually reparent the windows. This way
  // Workspace2 can move the windows to the appropriate workspace.
  std::vector<aura::Window*> windows(GetWorkspaceWindows(src));
  internal::WorkspaceController* workspace_controller =
      GetRootWindowController(dst)->workspace_controller();
  for (size_t i = 0; i < windows.size(); ++i) {
    aura::Window* new_parent =
        workspace_controller->GetParentForNewWindow(windows[i]);
    ReparentWindow(windows[i], new_parent);
  }
  for (size_t i = 0; i < arraysize(kContainerIdsToMove); i++) {
    int id = kContainerIdsToMove[i];
    if (id == internal::kShellWindowId_DefaultContainer)
      continue;

    aura::Window* src_container = Shell::GetContainer(src, id);
    aura::Window* dst_container = Shell::GetContainer(dst, id);
    aura::Window::Windows children = src_container->children();
    for (aura::Window::Windows::iterator iter = children.begin();
         iter != children.end(); ++iter) {
      aura::Window* window = *iter;
      // Don't move modal screen.
      if (internal::SystemModalContainerLayoutManager::IsModalBackground(
              window))
        continue;

      ReparentWindow(window, dst_container);
    }
  }
}

// Mark the container window so that a widget added to this container will
// use the virtual screeen coordinates instead of parent.
void SetUsesScreenCoordinates(aura::Window* container) {
  container->SetProperty(internal::kUsesScreenCoordinatesKey, true);
}

}  // namespace

namespace internal {

RootWindowController::RootWindowController(aura::RootWindow* root_window)
    : root_window_(root_window),
      root_window_layout_(NULL),
      status_area_widget_(NULL),
      shelf_(NULL),
      panel_layout_manager_(NULL) {
  SetRootWindowController(root_window, this);
  screen_dimmer_.reset(new ScreenDimmer(root_window));
}

RootWindowController::~RootWindowController() {
  Shutdown();
  root_window_.reset();
}

// static
internal::RootWindowController*
RootWindowController::ForLauncher(aura::Window* window) {
  if (Shell::IsLauncherPerDisplayEnabled())
    return GetRootWindowController(window->GetRootWindow());
  else
    return Shell::GetPrimaryRootWindowController();
}

void RootWindowController::Shutdown() {
  CloseChildWindows();
  if (Shell::GetActiveRootWindow() == root_window_.get()) {
    Shell::GetInstance()->set_active_root_window(
        Shell::GetPrimaryRootWindow() == root_window_.get() ?
        NULL : Shell::GetPrimaryRootWindow());
  }
  SetRootWindowController(root_window_.get(), NULL);
  screen_dimmer_.reset();
  workspace_controller_.reset();
  // Forget with the display ID so that display lookup
  // ends up with invalid display.
  root_window_->ClearProperty(kDisplayIdKey);
  // And this root window should no longer process events.
  root_window_->PrepareForShutdown();

  // Launcher widget has an InputMethodBridge that references to
  // |input_method_filter_|'s |input_method_|. So explicitly release
  // |launcher_| before |input_method_filter_|. And this needs to be
  // after we delete all containers in case there are still live
  // browser windows which access LauncherModel during close.
  launcher_.reset();
}

SystemModalContainerLayoutManager*
RootWindowController::GetSystemModalLayoutManager(aura::Window* window) {
  aura::Window* container = NULL;
  if (window) {
    container = GetContainer(
        kShellWindowId_LockSystemModalContainer);
    if (!container->Contains(window))
      container = GetContainer(kShellWindowId_SystemModalContainer);
  } else {
    user::LoginStatus login = Shell::GetInstance()->tray_delegate() ?
        Shell::GetInstance()->tray_delegate()->GetUserLoginStatus() :
        user::LOGGED_IN_NONE;
    int modal_window_id = (login == user::LOGGED_IN_LOCKED ||
                           login == user::LOGGED_IN_NONE) ?
        kShellWindowId_LockSystemModalContainer :
        kShellWindowId_SystemModalContainer;
    container = GetContainer(modal_window_id);
  }
  return static_cast<SystemModalContainerLayoutManager*>(
      container->layout_manager());
}

aura::Window* RootWindowController::GetContainer(int container_id) {
  return root_window_->GetChildById(container_id);
}

void RootWindowController::InitLayoutManagers() {
  root_window_layout_ =
      new RootWindowLayoutManager(root_window_.get());
  root_window_->SetLayoutManager(root_window_layout_);

  aura::Window* default_container =
      GetContainer(kShellWindowId_DefaultContainer);
  // Workspace manager has its own layout managers.
  workspace_controller_.reset(
      new WorkspaceController(default_container));

  aura::Window* always_on_top_container =
      GetContainer(kShellWindowId_AlwaysOnTopContainer);
  always_on_top_container->SetLayoutManager(
      new BaseLayoutManager(
          always_on_top_container->GetRootWindow()));
}

void RootWindowController::InitForPrimaryDisplay() {
  DCHECK(!status_area_widget_);
  ShellDelegate* delegate = Shell::GetInstance()->delegate();
  aura::Window* status_container =
      GetContainer(ash::internal::kShellWindowId_StatusContainer);
  // Initialize Primary RootWindow specific items.
  status_area_widget_ = new internal::StatusAreaWidget(status_container);
  status_area_widget_->CreateTrayViews(delegate);
  // Login screen manages status area visibility by itself.
  if (delegate && delegate->IsSessionStarted())
    status_area_widget_->Show();

  Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_);

  internal::ShelfLayoutManager* shelf_layout_manager =
      new internal::ShelfLayoutManager(status_area_widget_);
  GetContainer(internal::kShellWindowId_LauncherContainer)->
      SetLayoutManager(shelf_layout_manager);
  shelf_ = shelf_layout_manager;

  internal::StatusAreaLayoutManager* status_area_layout_manager =
      new internal::StatusAreaLayoutManager(shelf_layout_manager);
  GetContainer(internal::kShellWindowId_StatusContainer)->
      SetLayoutManager(status_area_layout_manager);

  shelf_layout_manager->set_workspace_controller(
      workspace_controller());

  workspace_controller()->SetShelf(shelf_);

  // Create Panel layout manager
  aura::Window* panel_container = GetContainer(
      internal::kShellWindowId_PanelContainer);
  panel_layout_manager_ =
      new internal::PanelLayoutManager(panel_container);
  panel_container->SetEventFilter(
      new internal::PanelWindowEventFilter(
          panel_container, panel_layout_manager_));
  panel_container->SetLayoutManager(panel_layout_manager_);

  if (!delegate || delegate->IsUserLoggedIn())
    CreateLauncher();
}

void RootWindowController::CreateContainers() {
  CreateContainersInRootWindow(root_window_.get());
}

void RootWindowController::CreateSystemBackground(
    bool is_first_run_after_boot) {
  SkColor color = SK_ColorBLACK;
#if defined(OS_CHROMEOS)
  if (is_first_run_after_boot)
    color = kBootSystemBackgroundColor;
#endif
  background_.reset(new ColoredWindowController(
      root_window_->GetChildById(kShellWindowId_SystemBackgroundContainer),
      "SystemBackground"));
  background_->SetColor(color);
  background_->GetWidget()->Show();
}

void RootWindowController::CreateLauncher() {
  if (launcher_.get())
    return;

  aura::Window* default_container =
      GetContainer(internal::kShellWindowId_DefaultContainer);
  launcher_.reset(new Launcher(default_container, shelf_));

  launcher_->SetFocusCycler(Shell::GetInstance()->focus_cycler());
  shelf_->SetLauncher(launcher_.get());

  if (panel_layout_manager_)
    panel_layout_manager_->SetLauncher(launcher_.get());

  ShellDelegate* delegate = Shell::GetInstance()->delegate();
  if (delegate)
    launcher_->SetVisible(delegate->IsSessionStarted());
  launcher_->widget()->Show();
}

void RootWindowController::ShowLauncher() {
  if (!launcher_.get())
    return;
  launcher_->SetVisible(true);
}

void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
  // TODO(oshima): remove if when launcher per display is enabled by
  // default.
  if (shelf_)
    shelf_->UpdateVisibilityState();
}

void RootWindowController::UpdateAfterLoginStatusChange(
    user::LoginStatus status) {
  if (status_area_widget_)
    status_area_widget_->UpdateAfterLoginStatusChange(status);
}

void RootWindowController::HandleDesktopBackgroundVisible() {
  if (background_.get())
    background_->SetColor(SK_ColorBLACK);
}

void RootWindowController::CloseChildWindows() {
  // The status area needs to be shut down before the windows are destroyed.
  if (status_area_widget_) {
    status_area_widget_->Shutdown();
    status_area_widget_ = NULL;
  }

  // Closing the windows frees the workspace controller.
  if (shelf_)
    shelf_->set_workspace_controller(NULL);

  // Close background widget first as it depends on tooltip.
  root_window_->SetProperty(kDesktopController,
      static_cast<DesktopBackgroundWidgetController*>(NULL));
  root_window_->SetProperty(kAnimatingDesktopController,
                            static_cast<AnimatingDesktopController*>(NULL));

  workspace_controller_.reset();
  aura::client::SetTooltipClient(root_window_.get(), NULL);

  while (!root_window_->children().empty()) {
    aura::Window* child = root_window_->children()[0];
    delete child;
  }

  // All containers are deleted, so reset shelf_.
  shelf_ = NULL;
}

void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) {
  aura::Window* focused = dst->GetFocusManager()->GetFocusedWindow();
  aura::WindowTracker tracker;
  if (focused)
    tracker.Add(focused);
  aura::client::ActivationClient* activation_client =
      aura::client::GetActivationClient(dst);
  aura::Window* active = activation_client->GetActiveWindow();
  if (active && focused != active)
    tracker.Add(active);
  // Deactivate the window to close menu / bubble windows.
  activation_client->DeactivateWindow(active);
  // Release capture if any.
  aura::client::GetCaptureClient(root_window_.get())->
      SetCapture(NULL);
  // Clear the focused window if any. This is necessary because a
  // window may be deleted when losing focus (fullscreen flash for
  // example).  If the focused window is still alive after move, it'll
  // be re-focused below.
  dst->GetFocusManager()->SetFocusedWindow(NULL, NULL);

  ReparentAllWindows(root_window_.get(), dst);

  // Restore focused or active window if it's still alive.
  if (focused && tracker.Contains(focused) && dst->Contains(focused)) {
    dst->GetFocusManager()->SetFocusedWindow(focused, NULL);
  } else if (active && tracker.Contains(active) && dst->Contains(active)) {
    activation_client->ActivateWindow(active);
  }
}

void RootWindowController::ShowContextMenu(
    const gfx::Point& location_in_screen) {
  aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ?
      root_window() : Shell::GetPrimaryRootWindow();
  DCHECK(Shell::GetInstance()->delegate());
  scoped_ptr<ui::MenuModel> menu_model(
      Shell::GetInstance()->delegate()->CreateContextMenu(target));

  views::MenuModelAdapter menu_model_adapter(menu_model.get());
  views::MenuRunner menu_runner(menu_model_adapter.CreateMenu());
  views::Widget* widget =
      root_window_->GetProperty(kDesktopController)->widget();

  if (menu_runner.RunMenuAt(
          widget, NULL, gfx::Rect(location_in_screen, gfx::Size()),
          views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) ==
      views::MenuRunner::MENU_DELETED)
    return;

  Shell::GetInstance()->UpdateShelfVisibility();
}

void RootWindowController::UpdateShelfVisibility() {
  shelf_->UpdateVisibilityState();
}

void RootWindowController::SetShelfAutoHideBehavior(
    ShelfAutoHideBehavior behavior) {
  shelf_->SetAutoHideBehavior(behavior);
}

ShelfAutoHideBehavior RootWindowController::GetShelfAutoHideBehavior() const {
  return shelf_->auto_hide_behavior();
}

bool RootWindowController::SetShelfAlignment(ShelfAlignment alignment) {
  return shelf_->SetAlignment(alignment);
}

ShelfAlignment RootWindowController::GetShelfAlignment() {
  return shelf_->alignment();
}

bool RootWindowController::IsShelfAutoHideMenuHideChecked() {
  return GetShelfAutoHideBehavior() == ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
}

ShelfAutoHideBehavior
RootWindowController::GetToggledShelfAutoHideBehavior() {
  return IsShelfAutoHideMenuHideChecked() ?
      ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER :
      ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
}

////////////////////////////////////////////////////////////////////////////////
// RootWindowController, private:

void RootWindowController::CreateContainersInRootWindow(
    aura::RootWindow* root_window) {
  // These containers are just used by PowerButtonController to animate groups
  // of containers simultaneously without messing up the current transformations
  // on those containers. These are direct children of the root window; all of
  // the other containers are their children.
  // Desktop and lock screen background containers are not part of the
  // lock animation so they are not included in those animate groups.
  // When screen is locked desktop background is moved to lock screen background
  // container (moved back on unlock). We want to make sure that there's an
  // opaque layer occluding the non-lock-screen layers.

  CreateContainer(kShellWindowId_SystemBackgroundContainer,
                  "SystemBackgroundContainer", root_window);

  aura::Window* desktop_background_containers = CreateContainer(
      kShellWindowId_DesktopBackgroundContainer,
      "DesktopBackgroundContainer",
      root_window);
  SetChildWindowVisibilityChangesAnimated(desktop_background_containers);

  aura::Window* non_lock_screen_containers = CreateContainer(
      kShellWindowId_NonLockScreenContainersContainer,
      "NonLockScreenContainersContainer",
      root_window);

  aura::Window* lock_background_containers = CreateContainer(
      kShellWindowId_LockScreenBackgroundContainer,
      "LockScreenBackgroundContainer",
      root_window);
  SetChildWindowVisibilityChangesAnimated(lock_background_containers);

  aura::Window* lock_screen_containers = CreateContainer(
      kShellWindowId_LockScreenContainersContainer,
      "LockScreenContainersContainer",
      root_window);
  aura::Window* lock_screen_related_containers = CreateContainer(
      kShellWindowId_LockScreenRelatedContainersContainer,
      "LockScreenRelatedContainersContainer",
      root_window);

  CreateContainer(kShellWindowId_UnparentedControlContainer,
                  "UnparentedControlContainer",
                  non_lock_screen_containers);

  aura::Window* default_container = CreateContainer(
      kShellWindowId_DefaultContainer,
      "DefaultContainer",
      non_lock_screen_containers);
  SetChildWindowVisibilityChangesAnimated(default_container);
  SetUsesScreenCoordinates(default_container);

  aura::Window* always_on_top_container = CreateContainer(
      kShellWindowId_AlwaysOnTopContainer,
      "AlwaysOnTopContainer",
      non_lock_screen_containers);
  always_on_top_container_handler_.reset(
      new ToplevelWindowEventHandler(always_on_top_container));
  SetChildWindowVisibilityChangesAnimated(always_on_top_container);
  SetUsesScreenCoordinates(always_on_top_container);

  aura::Window* panel_container = CreateContainer(
      kShellWindowId_PanelContainer,
      "PanelContainer",
      non_lock_screen_containers);
  SetUsesScreenCoordinates(panel_container);

  aura::Window* launcher_container =
      CreateContainer(kShellWindowId_LauncherContainer,
                      "LauncherContainer",
                      non_lock_screen_containers);
  SetUsesScreenCoordinates(launcher_container);

  aura::Window* app_list_container =
      CreateContainer(kShellWindowId_AppListContainer,
                      "AppListContainer",
                      non_lock_screen_containers);
  SetUsesScreenCoordinates(app_list_container);

  aura::Window* modal_container = CreateContainer(
      kShellWindowId_SystemModalContainer,
      "SystemModalContainer",
      non_lock_screen_containers);
  modal_container_handler_.reset(
      new ToplevelWindowEventHandler(modal_container));
  modal_container->SetLayoutManager(
      new SystemModalContainerLayoutManager(modal_container));
  SetChildWindowVisibilityChangesAnimated(modal_container);
  SetUsesScreenCoordinates(modal_container);

  aura::Window* input_method_container = CreateContainer(
      kShellWindowId_InputMethodContainer,
      "InputMethodContainer",
      non_lock_screen_containers);
  SetUsesScreenCoordinates(input_method_container);

  // TODO(beng): Figure out if we can make this use
  // SystemModalContainerEventFilter instead of stops_event_propagation.
  aura::Window* lock_container = CreateContainer(
      kShellWindowId_LockScreenContainer,
      "LockScreenContainer",
      lock_screen_containers);
  lock_container->SetLayoutManager(
      new BaseLayoutManager(root_window));
  SetUsesScreenCoordinates(lock_container);
  // TODO(beng): stopsevents

  aura::Window* lock_modal_container = CreateContainer(
      kShellWindowId_LockSystemModalContainer,
      "LockSystemModalContainer",
      lock_screen_containers);
  lock_modal_container_handler_.reset(
      new ToplevelWindowEventHandler(lock_modal_container));
  lock_modal_container->SetLayoutManager(
      new SystemModalContainerLayoutManager(lock_modal_container));
  SetChildWindowVisibilityChangesAnimated(lock_modal_container);
  SetUsesScreenCoordinates(lock_modal_container);

  aura::Window* status_container =
      CreateContainer(kShellWindowId_StatusContainer,
                      "StatusContainer",
                      lock_screen_related_containers);
  SetUsesScreenCoordinates(status_container);

  aura::Window* settings_bubble_container = CreateContainer(
      kShellWindowId_SettingBubbleContainer,
      "SettingBubbleContainer",
      lock_screen_related_containers);
  SetChildWindowVisibilityChangesAnimated(settings_bubble_container);
  SetUsesScreenCoordinates(settings_bubble_container);

  aura::Window* menu_container = CreateContainer(
      kShellWindowId_MenuContainer,
      "MenuContainer",
      lock_screen_related_containers);
  SetChildWindowVisibilityChangesAnimated(menu_container);
  SetUsesScreenCoordinates(menu_container);

  aura::Window* drag_drop_container = CreateContainer(
      kShellWindowId_DragImageAndTooltipContainer,
      "DragImageAndTooltipContainer",
      lock_screen_related_containers);
  SetChildWindowVisibilityChangesAnimated(drag_drop_container);
  SetUsesScreenCoordinates(drag_drop_container);

  aura::Window* overlay_container = CreateContainer(
      kShellWindowId_OverlayContainer,
      "OverlayContainer",
      lock_screen_related_containers);
  SetUsesScreenCoordinates(overlay_container);

  CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
                  "PowerButtonAnimationContainer", root_window) ;
}

}  // namespace internal
}  // namespace ash