blob: 9bcdf767a0678c36a4a113e8cbe529ecaa754269 [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]8d625fb2012-07-18 16:40:067#include <vector>
8
[email protected]b4ddc7a2012-08-07 04:17:329#include "ash/desktop_background/desktop_background_widget_controller.h"
[email protected]8d625fb2012-07-18 16:40:0610#include "ash/display/display_controller.h"
[email protected]6675e1c2012-09-11 09:15:4511#include "ash/display/multi_display_manager.h"
[email protected]e74aaf0a2012-10-12 18:42:2812#include "ash/focus_cycler.h"
[email protected]d90b8392012-06-13 09:34:5613#include "ash/shell.h"
[email protected]e74aaf0a2012-10-12 18:42:2814#include "ash/shell_delegate.h"
[email protected]d90b8392012-06-13 09:34:5615#include "ash/shell_factory.h"
16#include "ash/shell_window_ids.h"
[email protected]e74aaf0a2012-10-12 18:42:2817#include "ash/system/status_area_widget.h"
[email protected]8674b312012-10-12 19:02:4418#include "ash/system/tray/system_tray_delegate.h"
[email protected]d90b8392012-06-13 09:34:5619#include "ash/wm/base_layout_manager.h"
[email protected]e74aaf0a2012-10-12 18:42:2820#include "ash/wm/panel_layout_manager.h"
21#include "ash/wm/panel_window_event_filter.h"
[email protected]d90b8392012-06-13 09:34:5622#include "ash/wm/property_util.h"
23#include "ash/wm/root_window_layout_manager.h"
24#include "ash/wm/screen_dimmer.h"
[email protected]e74aaf0a2012-10-12 18:42:2825#include "ash/wm/shelf_layout_manager.h"
26#include "ash/wm/shelf_types.h"
27#include "ash/wm/status_area_layout_manager.h"
[email protected]d90b8392012-06-13 09:34:5628#include "ash/wm/system_modal_container_layout_manager.h"
[email protected]5dc51db82012-09-11 03:39:0129#include "ash/wm/toplevel_window_event_handler.h"
[email protected]d90b8392012-06-13 09:34:5630#include "ash/wm/visibility_controller.h"
[email protected]8d625fb2012-07-18 16:40:0631#include "ash/wm/window_properties.h"
[email protected]c601e732012-10-11 15:39:3732#include "ash/wm/workspace/colored_window_controller.h"
[email protected]d90b8392012-06-13 09:34:5633#include "ash/wm/workspace_controller.h"
[email protected]f1853122012-06-27 16:21:2634#include "ui/aura/client/activation_client.h"
35#include "ui/aura/client/aura_constants.h"
36#include "ui/aura/client/capture_client.h"
[email protected]d90b8392012-06-13 09:34:5637#include "ui/aura/client/tooltip_client.h"
[email protected]f1853122012-06-27 16:21:2638#include "ui/aura/focus_manager.h"
[email protected]d90b8392012-06-13 09:34:5639#include "ui/aura/root_window.h"
[email protected]f1853122012-06-27 16:21:2640#include "ui/aura/window.h"
41#include "ui/aura/window_observer.h"
[email protected]1d030242012-06-28 18:34:0842#include "ui/aura/window_tracker.h"
[email protected]8d625fb2012-07-18 16:40:0643#include "ui/gfx/display.h"
44#include "ui/gfx/screen.h"
[email protected]d90b8392012-06-13 09:34:5645
46namespace ash {
47namespace {
48
[email protected]697f04c2012-10-03 01:15:1049#if defined(OS_CHROMEOS)
50// Color initially used for the system background after the system has first
51// booted.
52const SkColor kBootSystemBackgroundColor = 0xFFFEFEFE;
53#endif
54
[email protected]d90b8392012-06-13 09:34:5655// Creates a new window for use as a container.
56aura::Window* CreateContainer(int window_id,
57 const char* name,
58 aura::Window* parent) {
59 aura::Window* container = new aura::Window(NULL);
60 container->set_id(window_id);
61 container->SetName(name);
62 container->Init(ui::LAYER_NOT_DRAWN);
63 parent->AddChild(container);
64 if (window_id != internal::kShellWindowId_UnparentedControlContainer)
65 container->Show();
66 return container;
67}
68
[email protected]95058572012-08-20 14:57:2969// Returns all the children of the workspace windows, eg the standard top-level
70// windows.
71std::vector<aura::Window*> GetWorkspaceWindows(aura::RootWindow* root) {
72 using aura::Window;
73
74 std::vector<Window*> windows;
75 Window* container = Shell::GetContainer(
76 root, internal::kShellWindowId_DefaultContainer);
77 for (Window::Windows::const_reverse_iterator i =
78 container->children().rbegin();
79 i != container->children().rend(); ++i) {
80 Window* workspace_window = *i;
81 if (workspace_window->id() == internal::kShellWindowId_WorkspaceContainer) {
82 windows.insert(windows.end(), workspace_window->children().begin(),
83 workspace_window->children().end());
84 }
85 }
86 return windows;
87}
88
89// Reparents |window| to |new_parent|.
90void ReparentWindow(aura::Window* window, aura::Window* new_parent) {
91 // Update the restore bounds to make it relative to the display.
92 gfx::Rect restore_bounds(GetRestoreBoundsInParent(window));
93 new_parent->AddChild(window);
94 if (!restore_bounds.IsEmpty())
95 SetRestoreBoundsInParent(window, restore_bounds);
96}
97
98// Reparents the appropriate set of windows from |src| to |dst|.
99void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) {
100 // Set of windows to move.
[email protected]f1853122012-06-27 16:21:26101 const int kContainerIdsToMove[] = {
102 internal::kShellWindowId_DefaultContainer,
103 internal::kShellWindowId_AlwaysOnTopContainer,
104 internal::kShellWindowId_SystemModalContainer,
105 internal::kShellWindowId_LockSystemModalContainer,
[email protected]6274d312012-10-04 22:06:41106 internal::kShellWindowId_InputMethodContainer,
[email protected]f1853122012-06-27 16:21:26107 };
[email protected]95058572012-08-20 14:57:29108 // For Workspace2 we need to manually reparent the windows. This way
109 // Workspace2 can move the windows to the appropriate workspace.
[email protected]c96b9812012-10-17 16:04:04110 std::vector<aura::Window*> windows(GetWorkspaceWindows(src));
111 internal::WorkspaceController* workspace_controller =
112 GetRootWindowController(dst)->workspace_controller();
113 for (size_t i = 0; i < windows.size(); ++i) {
114 aura::Window* new_parent =
115 workspace_controller->GetParentForNewWindow(windows[i]);
116 ReparentWindow(windows[i], new_parent);
[email protected]95058572012-08-20 14:57:29117 }
[email protected]f1853122012-06-27 16:21:26118 for (size_t i = 0; i < arraysize(kContainerIdsToMove); i++) {
119 int id = kContainerIdsToMove[i];
[email protected]c96b9812012-10-17 16:04:04120 if (id == internal::kShellWindowId_DefaultContainer)
[email protected]95058572012-08-20 14:57:29121 continue;
122
[email protected]f1853122012-06-27 16:21:26123 aura::Window* src_container = Shell::GetContainer(src, id);
124 aura::Window* dst_container = Shell::GetContainer(dst, id);
125 aura::Window::Windows children = src_container->children();
126 for (aura::Window::Windows::iterator iter = children.begin();
127 iter != children.end(); ++iter) {
128 aura::Window* window = *iter;
129 // Don't move modal screen.
[email protected]c0ce80e2012-10-05 23:28:27130 if (internal::SystemModalContainerLayoutManager::IsModalBackground(
131 window))
[email protected]f1853122012-06-27 16:21:26132 continue;
[email protected]f059c6942012-07-21 14:27:57133
[email protected]95058572012-08-20 14:57:29134 ReparentWindow(window, dst_container);
[email protected]f1853122012-06-27 16:21:26135 }
136 }
137}
138
[email protected]8d625fb2012-07-18 16:40:06139// Mark the container window so that a widget added to this container will
140// use the virtual screeen coordinates instead of parent.
141void SetUsesScreenCoordinates(aura::Window* container) {
142 container->SetProperty(internal::kUsesScreenCoordinatesKey, true);
143}
144
[email protected]d90b8392012-06-13 09:34:56145} // namespace
146
147namespace internal {
148
149RootWindowController::RootWindowController(aura::RootWindow* root_window)
[email protected]e74aaf0a2012-10-12 18:42:28150 : root_window_(root_window),
151 root_window_layout_(NULL),
152 status_area_widget_(NULL),
153 shelf_(NULL),
154 panel_layout_manager_(NULL) {
[email protected]d90b8392012-06-13 09:34:56155 SetRootWindowController(root_window, this);
[email protected]c0ce80e2012-10-05 23:28:27156 screen_dimmer_.reset(new ScreenDimmer(root_window));
[email protected]d90b8392012-06-13 09:34:56157}
158
159RootWindowController::~RootWindowController() {
[email protected]6675e1c2012-09-11 09:15:45160 Shutdown();
161 root_window_.reset();
162}
163
[email protected]88d71122012-10-18 07:11:01164// static
165internal::RootWindowController*
166RootWindowController::ForLauncher(aura::Window* window) {
167 if (Shell::IsLauncherPerDisplayEnabled())
168 return GetRootWindowController(window->GetRootWindow());
169 else
170 return Shell::GetPrimaryRootWindowController();
171}
172
[email protected]6675e1c2012-09-11 09:15:45173void RootWindowController::Shutdown() {
174 CloseChildWindows();
[email protected]f634dd32012-07-23 22:49:07175 if (Shell::GetActiveRootWindow() == root_window_.get()) {
176 Shell::GetInstance()->set_active_root_window(
177 Shell::GetPrimaryRootWindow() == root_window_.get() ?
178 NULL : Shell::GetPrimaryRootWindow());
179 }
[email protected]d90b8392012-06-13 09:34:56180 SetRootWindowController(root_window_.get(), NULL);
[email protected]d90b8392012-06-13 09:34:56181 screen_dimmer_.reset();
182 workspace_controller_.reset();
[email protected]6675e1c2012-09-11 09:15:45183 // Forget with the display ID so that display lookup
184 // ends up with invalid display.
185 root_window_->ClearProperty(kDisplayIdKey);
186 // And this root window should no longer process events.
187 root_window_->PrepareForShutdown();
[email protected]e74aaf0a2012-10-12 18:42:28188
189 // Launcher widget has an InputMethodBridge that references to
190 // |input_method_filter_|'s |input_method_|. So explicitly release
191 // |launcher_| before |input_method_filter_|. And this needs to be
192 // after we delete all containers in case there are still live
193 // browser windows which access LauncherModel during close.
194 launcher_.reset();
[email protected]d90b8392012-06-13 09:34:56195}
196
[email protected]c0ce80e2012-10-05 23:28:27197SystemModalContainerLayoutManager*
[email protected]8674b312012-10-12 19:02:44198RootWindowController::GetSystemModalLayoutManager(aura::Window* window) {
199 aura::Window* container = NULL;
200 if (window) {
201 container = GetContainer(
202 kShellWindowId_LockSystemModalContainer);
203 if (!container->Contains(window))
204 container = GetContainer(kShellWindowId_SystemModalContainer);
205 } else {
206 user::LoginStatus login = Shell::GetInstance()->tray_delegate() ?
207 Shell::GetInstance()->tray_delegate()->GetUserLoginStatus() :
208 user::LOGGED_IN_NONE;
209 int modal_window_id = (login == user::LOGGED_IN_LOCKED ||
210 login == user::LOGGED_IN_NONE) ?
211 kShellWindowId_LockSystemModalContainer :
212 kShellWindowId_SystemModalContainer;
213 container = GetContainer(modal_window_id);
214 }
[email protected]c0ce80e2012-10-05 23:28:27215 return static_cast<SystemModalContainerLayoutManager*>(
[email protected]8674b312012-10-12 19:02:44216 container->layout_manager());
[email protected]c0ce80e2012-10-05 23:28:27217}
218
[email protected]d90b8392012-06-13 09:34:56219aura::Window* RootWindowController::GetContainer(int container_id) {
220 return root_window_->GetChildById(container_id);
221}
222
223void RootWindowController::InitLayoutManagers() {
224 root_window_layout_ =
[email protected]c0ce80e2012-10-05 23:28:27225 new RootWindowLayoutManager(root_window_.get());
[email protected]d90b8392012-06-13 09:34:56226 root_window_->SetLayoutManager(root_window_layout_);
227
228 aura::Window* default_container =
[email protected]c0ce80e2012-10-05 23:28:27229 GetContainer(kShellWindowId_DefaultContainer);
[email protected]d90b8392012-06-13 09:34:56230 // Workspace manager has its own layout managers.
231 workspace_controller_.reset(
[email protected]c0ce80e2012-10-05 23:28:27232 new WorkspaceController(default_container));
[email protected]d90b8392012-06-13 09:34:56233
234 aura::Window* always_on_top_container =
[email protected]c0ce80e2012-10-05 23:28:27235 GetContainer(kShellWindowId_AlwaysOnTopContainer);
[email protected]d90b8392012-06-13 09:34:56236 always_on_top_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27237 new BaseLayoutManager(
[email protected]d90b8392012-06-13 09:34:56238 always_on_top_container->GetRootWindow()));
239}
240
[email protected]e74aaf0a2012-10-12 18:42:28241void RootWindowController::InitForPrimaryDisplay() {
242 DCHECK(!status_area_widget_);
243 ShellDelegate* delegate = Shell::GetInstance()->delegate();
[email protected]16059276d2012-10-22 18:59:50244 aura::Window* status_container =
245 GetContainer(ash::internal::kShellWindowId_StatusContainer);
[email protected]e74aaf0a2012-10-12 18:42:28246 // Initialize Primary RootWindow specific items.
[email protected]16059276d2012-10-22 18:59:50247 status_area_widget_ = new internal::StatusAreaWidget(status_container);
[email protected]e74aaf0a2012-10-12 18:42:28248 status_area_widget_->CreateTrayViews(delegate);
249 // Login screen manages status area visibility by itself.
250 if (delegate && delegate->IsSessionStarted())
251 status_area_widget_->Show();
252
253 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_);
254
255 internal::ShelfLayoutManager* shelf_layout_manager =
256 new internal::ShelfLayoutManager(status_area_widget_);
257 GetContainer(internal::kShellWindowId_LauncherContainer)->
258 SetLayoutManager(shelf_layout_manager);
259 shelf_ = shelf_layout_manager;
260
261 internal::StatusAreaLayoutManager* status_area_layout_manager =
262 new internal::StatusAreaLayoutManager(shelf_layout_manager);
263 GetContainer(internal::kShellWindowId_StatusContainer)->
264 SetLayoutManager(status_area_layout_manager);
265
266 shelf_layout_manager->set_workspace_controller(
267 workspace_controller());
268
269 workspace_controller()->SetShelf(shelf_);
270
271 // Create Panel layout manager
272 aura::Window* panel_container = GetContainer(
273 internal::kShellWindowId_PanelContainer);
274 panel_layout_manager_ =
275 new internal::PanelLayoutManager(panel_container);
276 panel_container->SetEventFilter(
277 new internal::PanelWindowEventFilter(
278 panel_container, panel_layout_manager_));
279 panel_container->SetLayoutManager(panel_layout_manager_);
280
281 if (!delegate || delegate->IsUserLoggedIn())
282 CreateLauncher();
283}
284
[email protected]d90b8392012-06-13 09:34:56285void RootWindowController::CreateContainers() {
286 CreateContainersInRootWindow(root_window_.get());
287}
288
[email protected]697f04c2012-10-03 01:15:10289void RootWindowController::CreateSystemBackground(
290 bool is_first_run_after_boot) {
291 SkColor color = SK_ColorBLACK;
292#if defined(OS_CHROMEOS)
293 if (is_first_run_after_boot)
294 color = kBootSystemBackgroundColor;
295#endif
[email protected]c601e732012-10-11 15:39:37296 background_.reset(new ColoredWindowController(
297 root_window_->GetChildById(kShellWindowId_SystemBackgroundContainer),
298 "SystemBackground"));
299 background_->SetColor(color);
300 background_->GetWidget()->Show();
[email protected]697f04c2012-10-03 01:15:10301}
302
[email protected]e74aaf0a2012-10-12 18:42:28303void RootWindowController::CreateLauncher() {
304 if (launcher_.get())
305 return;
306
307 aura::Window* default_container =
308 GetContainer(internal::kShellWindowId_DefaultContainer);
309 launcher_.reset(new Launcher(default_container, shelf_));
310
311 launcher_->SetFocusCycler(Shell::GetInstance()->focus_cycler());
312 shelf_->SetLauncher(launcher_.get());
313
314 if (panel_layout_manager_)
315 panel_layout_manager_->SetLauncher(launcher_.get());
316
317 ShellDelegate* delegate = Shell::GetInstance()->delegate();
318 if (delegate)
319 launcher_->SetVisible(delegate->IsSessionStarted());
320 launcher_->widget()->Show();
321}
322
323void RootWindowController::ShowLauncher() {
324 if (!launcher_.get())
325 return;
326 launcher_->SetVisible(true);
327}
328
[email protected]16059276d2012-10-22 18:59:50329void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
330 // TODO(oshima): remove if when launcher per display is enabled by
331 // default.
332 if (shelf_)
333 shelf_->UpdateVisibilityState();
334}
335
336void RootWindowController::UpdateAfterLoginStatusChange(
337 user::LoginStatus status) {
338 if (status_area_widget_)
339 status_area_widget_->UpdateAfterLoginStatusChange(status);
340}
341
[email protected]697f04c2012-10-03 01:15:10342void RootWindowController::HandleDesktopBackgroundVisible() {
343 if (background_.get())
344 background_->SetColor(SK_ColorBLACK);
345}
346
[email protected]d90b8392012-06-13 09:34:56347void RootWindowController::CloseChildWindows() {
[email protected]e74aaf0a2012-10-12 18:42:28348 // The status area needs to be shut down before the windows are destroyed.
[email protected]8674b312012-10-12 19:02:44349 if (status_area_widget_) {
[email protected]e74aaf0a2012-10-12 18:42:28350 status_area_widget_->Shutdown();
[email protected]8674b312012-10-12 19:02:44351 status_area_widget_ = NULL;
352 }
[email protected]e74aaf0a2012-10-12 18:42:28353
354 // Closing the windows frees the workspace controller.
355 if (shelf_)
356 shelf_->set_workspace_controller(NULL);
357
[email protected]d90b8392012-06-13 09:34:56358 // Close background widget first as it depends on tooltip.
[email protected]d86de6b22012-10-05 19:32:58359 root_window_->SetProperty(kDesktopController,
[email protected]b4ddc7a2012-08-07 04:17:32360 static_cast<DesktopBackgroundWidgetController*>(NULL));
[email protected]d86de6b22012-10-05 19:32:58361 root_window_->SetProperty(kAnimatingDesktopController,
362 static_cast<AnimatingDesktopController*>(NULL));
[email protected]b4ddc7a2012-08-07 04:17:32363
[email protected]d90b8392012-06-13 09:34:56364 workspace_controller_.reset();
365 aura::client::SetTooltipClient(root_window_.get(), NULL);
366
367 while (!root_window_->children().empty()) {
368 aura::Window* child = root_window_->children()[0];
369 delete child;
370 }
[email protected]e74aaf0a2012-10-12 18:42:28371
372 // All containers are deleted, so reset shelf_.
373 shelf_ = NULL;
[email protected]d90b8392012-06-13 09:34:56374}
375
[email protected]f1853122012-06-27 16:21:26376void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) {
377 aura::Window* focused = dst->GetFocusManager()->GetFocusedWindow();
[email protected]dbf835d82012-09-11 18:23:09378 aura::WindowTracker tracker;
379 if (focused)
380 tracker.Add(focused);
[email protected]f1853122012-06-27 16:21:26381 aura::client::ActivationClient* activation_client =
382 aura::client::GetActivationClient(dst);
383 aura::Window* active = activation_client->GetActiveWindow();
[email protected]dbf835d82012-09-11 18:23:09384 if (active && focused != active)
385 tracker.Add(active);
[email protected]f1853122012-06-27 16:21:26386 // Deactivate the window to close menu / bubble windows.
387 activation_client->DeactivateWindow(active);
388 // Release capture if any.
389 aura::client::GetCaptureClient(root_window_.get())->
390 SetCapture(NULL);
[email protected]dbf835d82012-09-11 18:23:09391 // Clear the focused window if any. This is necessary because a
392 // window may be deleted when losing focus (fullscreen flash for
393 // example). If the focused window is still alive after move, it'll
394 // be re-focused below.
395 dst->GetFocusManager()->SetFocusedWindow(NULL, NULL);
[email protected]f1853122012-06-27 16:21:26396
[email protected]95058572012-08-20 14:57:29397 ReparentAllWindows(root_window_.get(), dst);
[email protected]f1853122012-06-27 16:21:26398
399 // Restore focused or active window if it's still alive.
[email protected]1d030242012-06-28 18:34:08400 if (focused && tracker.Contains(focused) && dst->Contains(focused)) {
[email protected]f1853122012-06-27 16:21:26401 dst->GetFocusManager()->SetFocusedWindow(focused, NULL);
[email protected]1d030242012-06-28 18:34:08402 } else if (active && tracker.Contains(active) && dst->Contains(active)) {
[email protected]f1853122012-06-27 16:21:26403 activation_client->ActivateWindow(active);
404 }
405}
406
[email protected]e74aaf0a2012-10-12 18:42:28407void RootWindowController::UpdateShelfVisibility() {
408 shelf_->UpdateVisibilityState();
409}
410
411void RootWindowController::SetShelfAutoHideBehavior(
412 ShelfAutoHideBehavior behavior) {
413 shelf_->SetAutoHideBehavior(behavior);
414}
415
416ShelfAutoHideBehavior RootWindowController::GetShelfAutoHideBehavior() const {
417 return shelf_->auto_hide_behavior();
418}
419
420bool RootWindowController::SetShelfAlignment(ShelfAlignment alignment) {
421 return shelf_->SetAlignment(alignment);
422}
423
424ShelfAlignment RootWindowController::GetShelfAlignment() {
425 return shelf_->alignment();
426}
427
[email protected]a4cd6d32012-09-12 03:42:13428////////////////////////////////////////////////////////////////////////////////
429// RootWindowController, private:
430
431void RootWindowController::CreateContainersInRootWindow(
432 aura::RootWindow* root_window) {
433 // These containers are just used by PowerButtonController to animate groups
434 // of containers simultaneously without messing up the current transformations
435 // on those containers. These are direct children of the root window; all of
436 // the other containers are their children.
437 // Desktop and lock screen background containers are not part of the
438 // lock animation so they are not included in those animate groups.
439 // When screen is locked desktop background is moved to lock screen background
440 // container (moved back on unlock). We want to make sure that there's an
441 // opaque layer occluding the non-lock-screen layers.
442
[email protected]c0ce80e2012-10-05 23:28:27443 CreateContainer(kShellWindowId_SystemBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13444 "SystemBackgroundContainer", root_window);
445
446 aura::Window* desktop_background_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27447 kShellWindowId_DesktopBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13448 "DesktopBackgroundContainer",
449 root_window);
450 SetChildWindowVisibilityChangesAnimated(desktop_background_containers);
451
452 aura::Window* non_lock_screen_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27453 kShellWindowId_NonLockScreenContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13454 "NonLockScreenContainersContainer",
455 root_window);
456
457 aura::Window* lock_background_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27458 kShellWindowId_LockScreenBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13459 "LockScreenBackgroundContainer",
460 root_window);
461 SetChildWindowVisibilityChangesAnimated(lock_background_containers);
462
463 aura::Window* lock_screen_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27464 kShellWindowId_LockScreenContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13465 "LockScreenContainersContainer",
466 root_window);
467 aura::Window* lock_screen_related_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27468 kShellWindowId_LockScreenRelatedContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13469 "LockScreenRelatedContainersContainer",
470 root_window);
471
[email protected]c0ce80e2012-10-05 23:28:27472 CreateContainer(kShellWindowId_UnparentedControlContainer,
[email protected]a4cd6d32012-09-12 03:42:13473 "UnparentedControlContainer",
474 non_lock_screen_containers);
475
476 aura::Window* default_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27477 kShellWindowId_DefaultContainer,
[email protected]a4cd6d32012-09-12 03:42:13478 "DefaultContainer",
479 non_lock_screen_containers);
[email protected]a4cd6d32012-09-12 03:42:13480 SetChildWindowVisibilityChangesAnimated(default_container);
481 SetUsesScreenCoordinates(default_container);
482
483 aura::Window* always_on_top_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27484 kShellWindowId_AlwaysOnTopContainer,
[email protected]a4cd6d32012-09-12 03:42:13485 "AlwaysOnTopContainer",
486 non_lock_screen_containers);
487 always_on_top_container_handler_.reset(
488 new ToplevelWindowEventHandler(always_on_top_container));
[email protected]a4cd6d32012-09-12 03:42:13489 SetChildWindowVisibilityChangesAnimated(always_on_top_container);
490 SetUsesScreenCoordinates(always_on_top_container);
491
492 aura::Window* panel_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27493 kShellWindowId_PanelContainer,
[email protected]a4cd6d32012-09-12 03:42:13494 "PanelContainer",
495 non_lock_screen_containers);
496 SetUsesScreenCoordinates(panel_container);
497
498 aura::Window* launcher_container =
[email protected]c0ce80e2012-10-05 23:28:27499 CreateContainer(kShellWindowId_LauncherContainer,
[email protected]a4cd6d32012-09-12 03:42:13500 "LauncherContainer",
501 non_lock_screen_containers);
502 SetUsesScreenCoordinates(launcher_container);
503
[email protected]dc851a4e52012-10-03 00:05:55504 aura::Window* app_list_container =
[email protected]c0ce80e2012-10-05 23:28:27505 CreateContainer(kShellWindowId_AppListContainer,
[email protected]dc851a4e52012-10-03 00:05:55506 "AppListContainer",
507 non_lock_screen_containers);
508 SetUsesScreenCoordinates(app_list_container);
[email protected]a4cd6d32012-09-12 03:42:13509
510 aura::Window* modal_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27511 kShellWindowId_SystemModalContainer,
[email protected]a4cd6d32012-09-12 03:42:13512 "SystemModalContainer",
513 non_lock_screen_containers);
514 modal_container_handler_.reset(
515 new ToplevelWindowEventHandler(modal_container));
[email protected]a4cd6d32012-09-12 03:42:13516 modal_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27517 new SystemModalContainerLayoutManager(modal_container));
[email protected]a4cd6d32012-09-12 03:42:13518 SetChildWindowVisibilityChangesAnimated(modal_container);
519 SetUsesScreenCoordinates(modal_container);
520
521 aura::Window* input_method_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27522 kShellWindowId_InputMethodContainer,
[email protected]a4cd6d32012-09-12 03:42:13523 "InputMethodContainer",
524 non_lock_screen_containers);
525 SetUsesScreenCoordinates(input_method_container);
526
527 // TODO(beng): Figure out if we can make this use
528 // SystemModalContainerEventFilter instead of stops_event_propagation.
529 aura::Window* lock_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27530 kShellWindowId_LockScreenContainer,
[email protected]a4cd6d32012-09-12 03:42:13531 "LockScreenContainer",
532 lock_screen_containers);
533 lock_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27534 new BaseLayoutManager(root_window));
[email protected]a4cd6d32012-09-12 03:42:13535 SetUsesScreenCoordinates(lock_container);
536 // TODO(beng): stopsevents
537
538 aura::Window* lock_modal_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27539 kShellWindowId_LockSystemModalContainer,
[email protected]a4cd6d32012-09-12 03:42:13540 "LockSystemModalContainer",
541 lock_screen_containers);
542 lock_modal_container_handler_.reset(
543 new ToplevelWindowEventHandler(lock_modal_container));
[email protected]a4cd6d32012-09-12 03:42:13544 lock_modal_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27545 new SystemModalContainerLayoutManager(lock_modal_container));
[email protected]a4cd6d32012-09-12 03:42:13546 SetChildWindowVisibilityChangesAnimated(lock_modal_container);
547 SetUsesScreenCoordinates(lock_modal_container);
548
549 aura::Window* status_container =
[email protected]c0ce80e2012-10-05 23:28:27550 CreateContainer(kShellWindowId_StatusContainer,
[email protected]a4cd6d32012-09-12 03:42:13551 "StatusContainer",
552 lock_screen_related_containers);
553 SetUsesScreenCoordinates(status_container);
554
555 aura::Window* settings_bubble_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27556 kShellWindowId_SettingBubbleContainer,
[email protected]a4cd6d32012-09-12 03:42:13557 "SettingBubbleContainer",
558 lock_screen_related_containers);
559 SetChildWindowVisibilityChangesAnimated(settings_bubble_container);
560 SetUsesScreenCoordinates(settings_bubble_container);
561
562 aura::Window* menu_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27563 kShellWindowId_MenuContainer,
[email protected]a4cd6d32012-09-12 03:42:13564 "MenuContainer",
565 lock_screen_related_containers);
566 SetChildWindowVisibilityChangesAnimated(menu_container);
567 SetUsesScreenCoordinates(menu_container);
568
569 aura::Window* drag_drop_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27570 kShellWindowId_DragImageAndTooltipContainer,
[email protected]a4cd6d32012-09-12 03:42:13571 "DragImageAndTooltipContainer",
572 lock_screen_related_containers);
573 SetChildWindowVisibilityChangesAnimated(drag_drop_container);
574 SetUsesScreenCoordinates(drag_drop_container);
575
576 aura::Window* overlay_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27577 kShellWindowId_OverlayContainer,
[email protected]a4cd6d32012-09-12 03:42:13578 "OverlayContainer",
579 lock_screen_related_containers);
580 SetUsesScreenCoordinates(overlay_container);
581}
582
[email protected]d90b8392012-06-13 09:34:56583} // namespace internal
584} // namespace ash