blob: 8640429b1f1f4e844de375f8c2eff692bc8cf86d [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
164void RootWindowController::Shutdown() {
165 CloseChildWindows();
[email protected]f634dd32012-07-23 22:49:07166 if (Shell::GetActiveRootWindow() == root_window_.get()) {
167 Shell::GetInstance()->set_active_root_window(
168 Shell::GetPrimaryRootWindow() == root_window_.get() ?
169 NULL : Shell::GetPrimaryRootWindow());
170 }
[email protected]d90b8392012-06-13 09:34:56171 SetRootWindowController(root_window_.get(), NULL);
[email protected]d90b8392012-06-13 09:34:56172 screen_dimmer_.reset();
173 workspace_controller_.reset();
[email protected]6675e1c2012-09-11 09:15:45174 // Forget with the display ID so that display lookup
175 // ends up with invalid display.
176 root_window_->ClearProperty(kDisplayIdKey);
177 // And this root window should no longer process events.
178 root_window_->PrepareForShutdown();
[email protected]e74aaf0a2012-10-12 18:42:28179
180 // Launcher widget has an InputMethodBridge that references to
181 // |input_method_filter_|'s |input_method_|. So explicitly release
182 // |launcher_| before |input_method_filter_|. And this needs to be
183 // after we delete all containers in case there are still live
184 // browser windows which access LauncherModel during close.
185 launcher_.reset();
[email protected]d90b8392012-06-13 09:34:56186}
187
[email protected]c0ce80e2012-10-05 23:28:27188SystemModalContainerLayoutManager*
[email protected]8674b312012-10-12 19:02:44189RootWindowController::GetSystemModalLayoutManager(aura::Window* window) {
190 aura::Window* container = NULL;
191 if (window) {
192 container = GetContainer(
193 kShellWindowId_LockSystemModalContainer);
194 if (!container->Contains(window))
195 container = GetContainer(kShellWindowId_SystemModalContainer);
196 } else {
197 user::LoginStatus login = Shell::GetInstance()->tray_delegate() ?
198 Shell::GetInstance()->tray_delegate()->GetUserLoginStatus() :
199 user::LOGGED_IN_NONE;
200 int modal_window_id = (login == user::LOGGED_IN_LOCKED ||
201 login == user::LOGGED_IN_NONE) ?
202 kShellWindowId_LockSystemModalContainer :
203 kShellWindowId_SystemModalContainer;
204 container = GetContainer(modal_window_id);
205 }
[email protected]c0ce80e2012-10-05 23:28:27206 return static_cast<SystemModalContainerLayoutManager*>(
[email protected]8674b312012-10-12 19:02:44207 container->layout_manager());
[email protected]c0ce80e2012-10-05 23:28:27208}
209
[email protected]d90b8392012-06-13 09:34:56210aura::Window* RootWindowController::GetContainer(int container_id) {
211 return root_window_->GetChildById(container_id);
212}
213
214void RootWindowController::InitLayoutManagers() {
215 root_window_layout_ =
[email protected]c0ce80e2012-10-05 23:28:27216 new RootWindowLayoutManager(root_window_.get());
[email protected]d90b8392012-06-13 09:34:56217 root_window_->SetLayoutManager(root_window_layout_);
218
219 aura::Window* default_container =
[email protected]c0ce80e2012-10-05 23:28:27220 GetContainer(kShellWindowId_DefaultContainer);
[email protected]d90b8392012-06-13 09:34:56221 // Workspace manager has its own layout managers.
222 workspace_controller_.reset(
[email protected]c0ce80e2012-10-05 23:28:27223 new WorkspaceController(default_container));
[email protected]d90b8392012-06-13 09:34:56224
225 aura::Window* always_on_top_container =
[email protected]c0ce80e2012-10-05 23:28:27226 GetContainer(kShellWindowId_AlwaysOnTopContainer);
[email protected]d90b8392012-06-13 09:34:56227 always_on_top_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27228 new BaseLayoutManager(
[email protected]d90b8392012-06-13 09:34:56229 always_on_top_container->GetRootWindow()));
230}
231
[email protected]e74aaf0a2012-10-12 18:42:28232void RootWindowController::InitForPrimaryDisplay() {
233 DCHECK(!status_area_widget_);
234 ShellDelegate* delegate = Shell::GetInstance()->delegate();
235
236 // Initialize Primary RootWindow specific items.
237 status_area_widget_ = new internal::StatusAreaWidget();
238 status_area_widget_->CreateTrayViews(delegate);
239 // Login screen manages status area visibility by itself.
240 if (delegate && delegate->IsSessionStarted())
241 status_area_widget_->Show();
242
243 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_);
244
245 internal::ShelfLayoutManager* shelf_layout_manager =
246 new internal::ShelfLayoutManager(status_area_widget_);
247 GetContainer(internal::kShellWindowId_LauncherContainer)->
248 SetLayoutManager(shelf_layout_manager);
249 shelf_ = shelf_layout_manager;
250
251 internal::StatusAreaLayoutManager* status_area_layout_manager =
252 new internal::StatusAreaLayoutManager(shelf_layout_manager);
253 GetContainer(internal::kShellWindowId_StatusContainer)->
254 SetLayoutManager(status_area_layout_manager);
255
256 shelf_layout_manager->set_workspace_controller(
257 workspace_controller());
258
259 workspace_controller()->SetShelf(shelf_);
260
261 // Create Panel layout manager
262 aura::Window* panel_container = GetContainer(
263 internal::kShellWindowId_PanelContainer);
264 panel_layout_manager_ =
265 new internal::PanelLayoutManager(panel_container);
266 panel_container->SetEventFilter(
267 new internal::PanelWindowEventFilter(
268 panel_container, panel_layout_manager_));
269 panel_container->SetLayoutManager(panel_layout_manager_);
270
271 if (!delegate || delegate->IsUserLoggedIn())
272 CreateLauncher();
273}
274
[email protected]d90b8392012-06-13 09:34:56275void RootWindowController::CreateContainers() {
276 CreateContainersInRootWindow(root_window_.get());
277}
278
[email protected]697f04c2012-10-03 01:15:10279void RootWindowController::CreateSystemBackground(
280 bool is_first_run_after_boot) {
281 SkColor color = SK_ColorBLACK;
282#if defined(OS_CHROMEOS)
283 if (is_first_run_after_boot)
284 color = kBootSystemBackgroundColor;
285#endif
[email protected]c601e732012-10-11 15:39:37286 background_.reset(new ColoredWindowController(
287 root_window_->GetChildById(kShellWindowId_SystemBackgroundContainer),
288 "SystemBackground"));
289 background_->SetColor(color);
290 background_->GetWidget()->Show();
[email protected]697f04c2012-10-03 01:15:10291}
292
[email protected]e74aaf0a2012-10-12 18:42:28293void RootWindowController::CreateLauncher() {
294 if (launcher_.get())
295 return;
296
297 aura::Window* default_container =
298 GetContainer(internal::kShellWindowId_DefaultContainer);
299 launcher_.reset(new Launcher(default_container, shelf_));
300
301 launcher_->SetFocusCycler(Shell::GetInstance()->focus_cycler());
302 shelf_->SetLauncher(launcher_.get());
303
304 if (panel_layout_manager_)
305 panel_layout_manager_->SetLauncher(launcher_.get());
306
307 ShellDelegate* delegate = Shell::GetInstance()->delegate();
308 if (delegate)
309 launcher_->SetVisible(delegate->IsSessionStarted());
310 launcher_->widget()->Show();
311}
312
313void RootWindowController::ShowLauncher() {
314 if (!launcher_.get())
315 return;
316 launcher_->SetVisible(true);
317}
318
[email protected]697f04c2012-10-03 01:15:10319void RootWindowController::HandleDesktopBackgroundVisible() {
320 if (background_.get())
321 background_->SetColor(SK_ColorBLACK);
322}
323
[email protected]d90b8392012-06-13 09:34:56324void RootWindowController::CloseChildWindows() {
[email protected]e74aaf0a2012-10-12 18:42:28325 // The status area needs to be shut down before the windows are destroyed.
[email protected]8674b312012-10-12 19:02:44326 if (status_area_widget_) {
[email protected]e74aaf0a2012-10-12 18:42:28327 status_area_widget_->Shutdown();
[email protected]8674b312012-10-12 19:02:44328 status_area_widget_ = NULL;
329 }
[email protected]e74aaf0a2012-10-12 18:42:28330
331 // Closing the windows frees the workspace controller.
332 if (shelf_)
333 shelf_->set_workspace_controller(NULL);
334
[email protected]d90b8392012-06-13 09:34:56335 // Close background widget first as it depends on tooltip.
[email protected]d86de6b22012-10-05 19:32:58336 root_window_->SetProperty(kDesktopController,
[email protected]b4ddc7a2012-08-07 04:17:32337 static_cast<DesktopBackgroundWidgetController*>(NULL));
[email protected]d86de6b22012-10-05 19:32:58338 root_window_->SetProperty(kAnimatingDesktopController,
339 static_cast<AnimatingDesktopController*>(NULL));
[email protected]b4ddc7a2012-08-07 04:17:32340
[email protected]d90b8392012-06-13 09:34:56341 workspace_controller_.reset();
342 aura::client::SetTooltipClient(root_window_.get(), NULL);
343
344 while (!root_window_->children().empty()) {
345 aura::Window* child = root_window_->children()[0];
346 delete child;
347 }
[email protected]e74aaf0a2012-10-12 18:42:28348
349 // All containers are deleted, so reset shelf_.
350 shelf_ = NULL;
[email protected]d90b8392012-06-13 09:34:56351}
352
[email protected]f1853122012-06-27 16:21:26353void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) {
354 aura::Window* focused = dst->GetFocusManager()->GetFocusedWindow();
[email protected]dbf835d82012-09-11 18:23:09355 aura::WindowTracker tracker;
356 if (focused)
357 tracker.Add(focused);
[email protected]f1853122012-06-27 16:21:26358 aura::client::ActivationClient* activation_client =
359 aura::client::GetActivationClient(dst);
360 aura::Window* active = activation_client->GetActiveWindow();
[email protected]dbf835d82012-09-11 18:23:09361 if (active && focused != active)
362 tracker.Add(active);
[email protected]f1853122012-06-27 16:21:26363 // Deactivate the window to close menu / bubble windows.
364 activation_client->DeactivateWindow(active);
365 // Release capture if any.
366 aura::client::GetCaptureClient(root_window_.get())->
367 SetCapture(NULL);
[email protected]dbf835d82012-09-11 18:23:09368 // Clear the focused window if any. This is necessary because a
369 // window may be deleted when losing focus (fullscreen flash for
370 // example). If the focused window is still alive after move, it'll
371 // be re-focused below.
372 dst->GetFocusManager()->SetFocusedWindow(NULL, NULL);
[email protected]f1853122012-06-27 16:21:26373
[email protected]95058572012-08-20 14:57:29374 ReparentAllWindows(root_window_.get(), dst);
[email protected]f1853122012-06-27 16:21:26375
376 // Restore focused or active window if it's still alive.
[email protected]1d030242012-06-28 18:34:08377 if (focused && tracker.Contains(focused) && dst->Contains(focused)) {
[email protected]f1853122012-06-27 16:21:26378 dst->GetFocusManager()->SetFocusedWindow(focused, NULL);
[email protected]1d030242012-06-28 18:34:08379 } else if (active && tracker.Contains(active) && dst->Contains(active)) {
[email protected]f1853122012-06-27 16:21:26380 activation_client->ActivateWindow(active);
381 }
382}
383
[email protected]e74aaf0a2012-10-12 18:42:28384void RootWindowController::UpdateShelfVisibility() {
385 shelf_->UpdateVisibilityState();
386}
387
388void RootWindowController::SetShelfAutoHideBehavior(
389 ShelfAutoHideBehavior behavior) {
390 shelf_->SetAutoHideBehavior(behavior);
391}
392
393ShelfAutoHideBehavior RootWindowController::GetShelfAutoHideBehavior() const {
394 return shelf_->auto_hide_behavior();
395}
396
397bool RootWindowController::SetShelfAlignment(ShelfAlignment alignment) {
398 return shelf_->SetAlignment(alignment);
399}
400
401ShelfAlignment RootWindowController::GetShelfAlignment() {
402 return shelf_->alignment();
403}
404
[email protected]a4cd6d32012-09-12 03:42:13405////////////////////////////////////////////////////////////////////////////////
406// RootWindowController, private:
407
408void RootWindowController::CreateContainersInRootWindow(
409 aura::RootWindow* root_window) {
410 // These containers are just used by PowerButtonController to animate groups
411 // of containers simultaneously without messing up the current transformations
412 // on those containers. These are direct children of the root window; all of
413 // the other containers are their children.
414 // Desktop and lock screen background containers are not part of the
415 // lock animation so they are not included in those animate groups.
416 // When screen is locked desktop background is moved to lock screen background
417 // container (moved back on unlock). We want to make sure that there's an
418 // opaque layer occluding the non-lock-screen layers.
419
[email protected]c0ce80e2012-10-05 23:28:27420 CreateContainer(kShellWindowId_SystemBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13421 "SystemBackgroundContainer", root_window);
422
423 aura::Window* desktop_background_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27424 kShellWindowId_DesktopBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13425 "DesktopBackgroundContainer",
426 root_window);
427 SetChildWindowVisibilityChangesAnimated(desktop_background_containers);
428
429 aura::Window* non_lock_screen_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27430 kShellWindowId_NonLockScreenContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13431 "NonLockScreenContainersContainer",
432 root_window);
433
434 aura::Window* lock_background_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27435 kShellWindowId_LockScreenBackgroundContainer,
[email protected]a4cd6d32012-09-12 03:42:13436 "LockScreenBackgroundContainer",
437 root_window);
438 SetChildWindowVisibilityChangesAnimated(lock_background_containers);
439
440 aura::Window* lock_screen_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27441 kShellWindowId_LockScreenContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13442 "LockScreenContainersContainer",
443 root_window);
444 aura::Window* lock_screen_related_containers = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27445 kShellWindowId_LockScreenRelatedContainersContainer,
[email protected]a4cd6d32012-09-12 03:42:13446 "LockScreenRelatedContainersContainer",
447 root_window);
448
[email protected]c0ce80e2012-10-05 23:28:27449 CreateContainer(kShellWindowId_UnparentedControlContainer,
[email protected]a4cd6d32012-09-12 03:42:13450 "UnparentedControlContainer",
451 non_lock_screen_containers);
452
453 aura::Window* default_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27454 kShellWindowId_DefaultContainer,
[email protected]a4cd6d32012-09-12 03:42:13455 "DefaultContainer",
456 non_lock_screen_containers);
[email protected]a4cd6d32012-09-12 03:42:13457 SetChildWindowVisibilityChangesAnimated(default_container);
458 SetUsesScreenCoordinates(default_container);
459
460 aura::Window* always_on_top_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27461 kShellWindowId_AlwaysOnTopContainer,
[email protected]a4cd6d32012-09-12 03:42:13462 "AlwaysOnTopContainer",
463 non_lock_screen_containers);
464 always_on_top_container_handler_.reset(
465 new ToplevelWindowEventHandler(always_on_top_container));
[email protected]a4cd6d32012-09-12 03:42:13466 SetChildWindowVisibilityChangesAnimated(always_on_top_container);
467 SetUsesScreenCoordinates(always_on_top_container);
468
469 aura::Window* panel_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27470 kShellWindowId_PanelContainer,
[email protected]a4cd6d32012-09-12 03:42:13471 "PanelContainer",
472 non_lock_screen_containers);
473 SetUsesScreenCoordinates(panel_container);
474
475 aura::Window* launcher_container =
[email protected]c0ce80e2012-10-05 23:28:27476 CreateContainer(kShellWindowId_LauncherContainer,
[email protected]a4cd6d32012-09-12 03:42:13477 "LauncherContainer",
478 non_lock_screen_containers);
479 SetUsesScreenCoordinates(launcher_container);
480
[email protected]dc851a4e52012-10-03 00:05:55481 aura::Window* app_list_container =
[email protected]c0ce80e2012-10-05 23:28:27482 CreateContainer(kShellWindowId_AppListContainer,
[email protected]dc851a4e52012-10-03 00:05:55483 "AppListContainer",
484 non_lock_screen_containers);
485 SetUsesScreenCoordinates(app_list_container);
[email protected]a4cd6d32012-09-12 03:42:13486
487 aura::Window* modal_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27488 kShellWindowId_SystemModalContainer,
[email protected]a4cd6d32012-09-12 03:42:13489 "SystemModalContainer",
490 non_lock_screen_containers);
491 modal_container_handler_.reset(
492 new ToplevelWindowEventHandler(modal_container));
[email protected]a4cd6d32012-09-12 03:42:13493 modal_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27494 new SystemModalContainerLayoutManager(modal_container));
[email protected]a4cd6d32012-09-12 03:42:13495 SetChildWindowVisibilityChangesAnimated(modal_container);
496 SetUsesScreenCoordinates(modal_container);
497
498 aura::Window* input_method_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27499 kShellWindowId_InputMethodContainer,
[email protected]a4cd6d32012-09-12 03:42:13500 "InputMethodContainer",
501 non_lock_screen_containers);
502 SetUsesScreenCoordinates(input_method_container);
503
504 // TODO(beng): Figure out if we can make this use
505 // SystemModalContainerEventFilter instead of stops_event_propagation.
506 aura::Window* lock_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27507 kShellWindowId_LockScreenContainer,
[email protected]a4cd6d32012-09-12 03:42:13508 "LockScreenContainer",
509 lock_screen_containers);
510 lock_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27511 new BaseLayoutManager(root_window));
[email protected]a4cd6d32012-09-12 03:42:13512 SetUsesScreenCoordinates(lock_container);
513 // TODO(beng): stopsevents
514
515 aura::Window* lock_modal_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27516 kShellWindowId_LockSystemModalContainer,
[email protected]a4cd6d32012-09-12 03:42:13517 "LockSystemModalContainer",
518 lock_screen_containers);
519 lock_modal_container_handler_.reset(
520 new ToplevelWindowEventHandler(lock_modal_container));
[email protected]a4cd6d32012-09-12 03:42:13521 lock_modal_container->SetLayoutManager(
[email protected]c0ce80e2012-10-05 23:28:27522 new SystemModalContainerLayoutManager(lock_modal_container));
[email protected]a4cd6d32012-09-12 03:42:13523 SetChildWindowVisibilityChangesAnimated(lock_modal_container);
524 SetUsesScreenCoordinates(lock_modal_container);
525
526 aura::Window* status_container =
[email protected]c0ce80e2012-10-05 23:28:27527 CreateContainer(kShellWindowId_StatusContainer,
[email protected]a4cd6d32012-09-12 03:42:13528 "StatusContainer",
529 lock_screen_related_containers);
530 SetUsesScreenCoordinates(status_container);
531
532 aura::Window* settings_bubble_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27533 kShellWindowId_SettingBubbleContainer,
[email protected]a4cd6d32012-09-12 03:42:13534 "SettingBubbleContainer",
535 lock_screen_related_containers);
536 SetChildWindowVisibilityChangesAnimated(settings_bubble_container);
537 SetUsesScreenCoordinates(settings_bubble_container);
538
539 aura::Window* menu_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27540 kShellWindowId_MenuContainer,
[email protected]a4cd6d32012-09-12 03:42:13541 "MenuContainer",
542 lock_screen_related_containers);
543 SetChildWindowVisibilityChangesAnimated(menu_container);
544 SetUsesScreenCoordinates(menu_container);
545
546 aura::Window* drag_drop_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27547 kShellWindowId_DragImageAndTooltipContainer,
[email protected]a4cd6d32012-09-12 03:42:13548 "DragImageAndTooltipContainer",
549 lock_screen_related_containers);
550 SetChildWindowVisibilityChangesAnimated(drag_drop_container);
551 SetUsesScreenCoordinates(drag_drop_container);
552
553 aura::Window* overlay_container = CreateContainer(
[email protected]c0ce80e2012-10-05 23:28:27554 kShellWindowId_OverlayContainer,
[email protected]a4cd6d32012-09-12 03:42:13555 "OverlayContainer",
556 lock_screen_related_containers);
557 SetUsesScreenCoordinates(overlay_container);
558}
559
[email protected]d90b8392012-06-13 09:34:56560} // namespace internal
561} // namespace ash