[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 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. |
| 4 | |
| 5 | #include "ash/root_window_controller.h" |
| 6 | |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 7 | #include <vector> |
| 8 | |
[email protected] | 44d444c | 2013-01-30 01:47:44 | [diff] [blame] | 9 | #include "ash/ash_constants.h" |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 10 | #include "ash/ash_switches.h" |
[email protected] | b4ddc7a | 2012-08-07 04:17:32 | [diff] [blame] | 11 | #include "ash/desktop_background/desktop_background_widget_controller.h" |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 12 | #include "ash/display/display_controller.h" |
[email protected] | 6bdf795 | 2012-11-14 10:10:58 | [diff] [blame] | 13 | #include "ash/display/display_manager.h" |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 14 | #include "ash/focus_cycler.h" |
[email protected] | fcb123d | 2013-04-17 15:58:49 | [diff] [blame] | 15 | #include "ash/session_state_delegate.h" |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 16 | #include "ash/shelf/shelf_layout_manager.h" |
| 17 | #include "ash/shelf/shelf_types.h" |
| 18 | #include "ash/shelf/shelf_widget.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 19 | #include "ash/shell.h" |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 20 | #include "ash/shell_delegate.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 21 | #include "ash/shell_factory.h" |
| 22 | #include "ash/shell_window_ids.h" |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 23 | #include "ash/system/status_area_widget.h" |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 24 | #include "ash/system/tray/system_tray_delegate.h" |
[email protected] | 5817504 | 2013-04-01 19:27:13 | [diff] [blame] | 25 | #include "ash/touch/touch_observer_hud.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 26 | #include "ash/wm/base_layout_manager.h" |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 27 | #include "ash/wm/boot_splash_screen.h" |
[email protected] | 7095a65 | 2013-03-07 19:41:49 | [diff] [blame] | 28 | #include "ash/wm/panels/panel_layout_manager.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 29 | #include "ash/wm/property_util.h" |
| 30 | #include "ash/wm/root_window_layout_manager.h" |
| 31 | #include "ash/wm/screen_dimmer.h" |
[email protected] | 2a2caa0 | 2013-01-22 20:50:36 | [diff] [blame] | 32 | #include "ash/wm/stacking_controller.h" |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 33 | #include "ash/wm/status_area_layout_manager.h" |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 34 | #include "ash/wm/system_background_controller.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 35 | #include "ash/wm/system_modal_container_layout_manager.h" |
[email protected] | 5dc51db8 | 2012-09-11 03:39:01 | [diff] [blame] | 36 | #include "ash/wm/toplevel_window_event_handler.h" |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 37 | #include "ash/wm/window_properties.h" |
[email protected] | 700849f | 2013-04-30 17:49:20 | [diff] [blame] | 38 | #include "ash/wm/window_util.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 39 | #include "ash/wm/workspace_controller.h" |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 40 | #include "base/command_line.h" |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 41 | #include "base/time.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 42 | #include "ui/aura/client/aura_constants.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 43 | #include "ui/aura/client/tooltip_client.h" |
| 44 | #include "ui/aura/root_window.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 45 | #include "ui/aura/window.h" |
| 46 | #include "ui/aura/window_observer.h" |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 47 | #include "ui/base/models/menu_model.h" |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 48 | #include "ui/gfx/display.h" |
| 49 | #include "ui/gfx/screen.h" |
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 50 | #include "ui/keyboard/keyboard_controller.h" |
| 51 | #include "ui/keyboard/keyboard_util.h" |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 52 | #include "ui/views/controls/menu/menu_runner.h" |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 53 | #include "ui/views/corewm/visibility_controller.h" |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 54 | #include "ui/views/view_model.h" |
| 55 | #include "ui/views/view_model_utils.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 56 | |
| 57 | namespace ash { |
| 58 | namespace { |
| 59 | |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 60 | // Duration for the animation that hides the boot splash screen, in |
| 61 | // milliseconds. This should be short enough in relation to |
| 62 | // wm/window_animation.cc's brightness/grayscale fade animation that the login |
| 63 | // background image animation isn't hidden by the splash screen animation. |
| 64 | const int kBootSplashScreenHideDurationMs = 500; |
| 65 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 66 | // Creates a new window for use as a container. |
| 67 | aura::Window* CreateContainer(int window_id, |
| 68 | const char* name, |
| 69 | aura::Window* parent) { |
| 70 | aura::Window* container = new aura::Window(NULL); |
| 71 | container->set_id(window_id); |
| 72 | container->SetName(name); |
| 73 | container->Init(ui::LAYER_NOT_DRAWN); |
| 74 | parent->AddChild(container); |
| 75 | if (window_id != internal::kShellWindowId_UnparentedControlContainer) |
| 76 | container->Show(); |
| 77 | return container; |
| 78 | } |
| 79 | |
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 80 | // Returns all the children of the workspace windows, eg the standard top-level |
| 81 | // windows. |
| 82 | std::vector<aura::Window*> GetWorkspaceWindows(aura::RootWindow* root) { |
| 83 | using aura::Window; |
| 84 | |
| 85 | std::vector<Window*> windows; |
| 86 | Window* container = Shell::GetContainer( |
| 87 | root, internal::kShellWindowId_DefaultContainer); |
| 88 | for (Window::Windows::const_reverse_iterator i = |
| 89 | container->children().rbegin(); |
| 90 | i != container->children().rend(); ++i) { |
| 91 | Window* workspace_window = *i; |
| 92 | if (workspace_window->id() == internal::kShellWindowId_WorkspaceContainer) { |
| 93 | windows.insert(windows.end(), workspace_window->children().begin(), |
| 94 | workspace_window->children().end()); |
| 95 | } |
| 96 | } |
| 97 | return windows; |
| 98 | } |
| 99 | |
| 100 | // Reparents |window| to |new_parent|. |
| 101 | void ReparentWindow(aura::Window* window, aura::Window* new_parent) { |
| 102 | // Update the restore bounds to make it relative to the display. |
| 103 | gfx::Rect restore_bounds(GetRestoreBoundsInParent(window)); |
| 104 | new_parent->AddChild(window); |
| 105 | if (!restore_bounds.IsEmpty()) |
| 106 | SetRestoreBoundsInParent(window, restore_bounds); |
| 107 | } |
| 108 | |
| 109 | // Reparents the appropriate set of windows from |src| to |dst|. |
| 110 | void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) { |
| 111 | // Set of windows to move. |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 112 | const int kContainerIdsToMove[] = { |
| 113 | internal::kShellWindowId_DefaultContainer, |
[email protected] | 95db9c1 | 2013-01-31 11:47:44 | [diff] [blame] | 114 | internal::kShellWindowId_PanelContainer, |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 115 | internal::kShellWindowId_AlwaysOnTopContainer, |
| 116 | internal::kShellWindowId_SystemModalContainer, |
| 117 | internal::kShellWindowId_LockSystemModalContainer, |
[email protected] | 6274d31 | 2012-10-04 22:06:41 | [diff] [blame] | 118 | internal::kShellWindowId_InputMethodContainer, |
[email protected] | a975487 | 2013-01-25 07:44:00 | [diff] [blame] | 119 | internal::kShellWindowId_UnparentedControlContainer, |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 120 | }; |
[email protected] | ef0e32cc | 2012-10-31 20:57:33 | [diff] [blame] | 121 | // For workspace windows we need to manually reparent the windows. This way |
| 122 | // workspace can move the windows to the appropriate workspace. |
[email protected] | c96b981 | 2012-10-17 16:04:04 | [diff] [blame] | 123 | std::vector<aura::Window*> windows(GetWorkspaceWindows(src)); |
| 124 | internal::WorkspaceController* workspace_controller = |
| 125 | GetRootWindowController(dst)->workspace_controller(); |
| 126 | for (size_t i = 0; i < windows.size(); ++i) { |
| 127 | aura::Window* new_parent = |
| 128 | workspace_controller->GetParentForNewWindow(windows[i]); |
| 129 | ReparentWindow(windows[i], new_parent); |
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 130 | } |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 131 | for (size_t i = 0; i < arraysize(kContainerIdsToMove); i++) { |
| 132 | int id = kContainerIdsToMove[i]; |
[email protected] | c96b981 | 2012-10-17 16:04:04 | [diff] [blame] | 133 | if (id == internal::kShellWindowId_DefaultContainer) |
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 134 | continue; |
| 135 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 136 | aura::Window* src_container = Shell::GetContainer(src, id); |
| 137 | aura::Window* dst_container = Shell::GetContainer(dst, id); |
[email protected] | 5b602190 | 2013-02-26 05:33:29 | [diff] [blame] | 138 | while (!src_container->children().empty()) { |
| 139 | // Restart iteration from the source container windows each time as they |
| 140 | // may change as a result of moving other windows. |
| 141 | aura::Window::Windows::const_iterator iter = |
| 142 | src_container->children().begin(); |
| 143 | while (iter != src_container->children().end() && |
| 144 | internal::SystemModalContainerLayoutManager::IsModalBackground( |
| 145 | *iter)) { |
| 146 | ++iter; |
| 147 | } |
| 148 | // If the entire window list is modal background windows then stop. |
| 149 | if (iter == src_container->children().end()) |
| 150 | break; |
| 151 | ReparentWindow(*iter, dst_container); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 152 | } |
| 153 | } |
| 154 | } |
| 155 | |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 156 | // Mark the container window so that a widget added to this container will |
| 157 | // use the virtual screeen coordinates instead of parent. |
| 158 | void SetUsesScreenCoordinates(aura::Window* container) { |
| 159 | container->SetProperty(internal::kUsesScreenCoordinatesKey, true); |
| 160 | } |
| 161 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 162 | } // namespace |
| 163 | |
| 164 | namespace internal { |
| 165 | |
| 166 | RootWindowController::RootWindowController(aura::RootWindow* root_window) |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 167 | : root_window_(root_window), |
| 168 | root_window_layout_(NULL), |
[email protected] | bff1755 | 2013-04-25 04:44:55 | [diff] [blame] | 169 | panel_layout_manager_(NULL), |
| 170 | touch_observer_hud_(NULL) { |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 171 | SetRootWindowController(root_window, this); |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 172 | screen_dimmer_.reset(new ScreenDimmer(root_window)); |
[email protected] | 2a2caa0 | 2013-01-22 20:50:36 | [diff] [blame] | 173 | |
| 174 | stacking_controller_.reset(new ash::StackingController); |
| 175 | aura::client::SetStackingClient(root_window, stacking_controller_.get()); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | RootWindowController::~RootWindowController() { |
[email protected] | 6675e1c | 2012-09-11 09:15:45 | [diff] [blame] | 179 | Shutdown(); |
| 180 | root_window_.reset(); |
| 181 | } |
| 182 | |
[email protected] | 88d7112 | 2012-10-18 07:11:01 | [diff] [blame] | 183 | // static |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 184 | RootWindowController* RootWindowController::ForLauncher(aura::Window* window) { |
[email protected] | 8c0ec43 | 2013-05-10 04:33:39 | [diff] [blame] | 185 | return GetRootWindowController(window->GetRootWindow()); |
[email protected] | 88d7112 | 2012-10-18 07:11:01 | [diff] [blame] | 186 | } |
| 187 | |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 188 | // static |
[email protected] | ccff3d7 | 2013-02-06 04:26:28 | [diff] [blame] | 189 | RootWindowController* RootWindowController::ForWindow( |
| 190 | const aura::Window* window) { |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 191 | return GetRootWindowController(window->GetRootWindow()); |
| 192 | } |
| 193 | |
| 194 | // static |
| 195 | RootWindowController* RootWindowController::ForActiveRootWindow() { |
| 196 | return GetRootWindowController(Shell::GetActiveRootWindow()); |
| 197 | } |
| 198 | |
[email protected] | 6675e1c | 2012-09-11 09:15:45 | [diff] [blame] | 199 | void RootWindowController::Shutdown() { |
| 200 | CloseChildWindows(); |
[email protected] | 7f7f65c | 2013-04-17 16:47:13 | [diff] [blame] | 201 | if (Shell::GetActiveRootWindow() == root_window_) { |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame] | 202 | Shell::GetInstance()->set_active_root_window( |
| 203 | Shell::GetPrimaryRootWindow() == root_window_.get() ? |
| 204 | NULL : Shell::GetPrimaryRootWindow()); |
| 205 | } |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 206 | SetRootWindowController(root_window_.get(), NULL); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 207 | screen_dimmer_.reset(); |
| 208 | workspace_controller_.reset(); |
[email protected] | 6675e1c | 2012-09-11 09:15:45 | [diff] [blame] | 209 | // Forget with the display ID so that display lookup |
| 210 | // ends up with invalid display. |
| 211 | root_window_->ClearProperty(kDisplayIdKey); |
| 212 | // And this root window should no longer process events. |
| 213 | root_window_->PrepareForShutdown(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 214 | |
[email protected] | 956a6a4 | 2012-10-29 23:58:10 | [diff] [blame] | 215 | system_background_.reset(); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 216 | } |
| 217 | |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 218 | SystemModalContainerLayoutManager* |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 219 | RootWindowController::GetSystemModalLayoutManager(aura::Window* window) { |
| 220 | aura::Window* container = NULL; |
| 221 | if (window) { |
[email protected] | 3b162e1 | 2012-11-09 11:52:35 | [diff] [blame] | 222 | if (window->parent() && |
| 223 | window->parent()->id() >= kShellWindowId_LockScreenContainer) { |
| 224 | container = GetContainer(kShellWindowId_LockSystemModalContainer); |
| 225 | } else { |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 226 | container = GetContainer(kShellWindowId_SystemModalContainer); |
[email protected] | 3b162e1 | 2012-11-09 11:52:35 | [diff] [blame] | 227 | } |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 228 | } else { |
[email protected] | 945f9cae | 2012-12-12 09:54:29 | [diff] [blame] | 229 | user::LoginStatus login = Shell::GetInstance()->system_tray_delegate() ? |
| 230 | Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() : |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 231 | user::LOGGED_IN_NONE; |
| 232 | int modal_window_id = (login == user::LOGGED_IN_LOCKED || |
| 233 | login == user::LOGGED_IN_NONE) ? |
| 234 | kShellWindowId_LockSystemModalContainer : |
| 235 | kShellWindowId_SystemModalContainer; |
| 236 | container = GetContainer(modal_window_id); |
| 237 | } |
[email protected] | bb0c7cd4 | 2013-05-20 23:39:45 | [diff] [blame] | 238 | return container ? static_cast<SystemModalContainerLayoutManager*>( |
| 239 | container->layout_manager()) : NULL; |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 240 | } |
| 241 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 242 | aura::Window* RootWindowController::GetContainer(int container_id) { |
| 243 | return root_window_->GetChildById(container_id); |
| 244 | } |
| 245 | |
| 246 | void RootWindowController::InitLayoutManagers() { |
| 247 | root_window_layout_ = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 248 | new RootWindowLayoutManager(root_window_.get()); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 249 | root_window_->SetLayoutManager(root_window_layout_); |
| 250 | |
| 251 | aura::Window* default_container = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 252 | GetContainer(kShellWindowId_DefaultContainer); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 253 | // Workspace manager has its own layout managers. |
| 254 | workspace_controller_.reset( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 255 | new WorkspaceController(default_container)); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 256 | |
| 257 | aura::Window* always_on_top_container = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 258 | GetContainer(kShellWindowId_AlwaysOnTopContainer); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 259 | always_on_top_container->SetLayoutManager( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 260 | new BaseLayoutManager( |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 261 | always_on_top_container->GetRootWindow())); |
| 262 | } |
| 263 | |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 264 | void RootWindowController::InitForPrimaryDisplay() { |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 265 | DCHECK(!shelf_.get()); |
| 266 | aura::Window* shelf_container = |
| 267 | GetContainer(ash::internal::kShellWindowId_ShelfContainer); |
| 268 | // TODO(harrym): Remove when status area is view. |
[email protected] | 16059276d | 2012-10-22 18:59:50 | [diff] [blame] | 269 | aura::Window* status_container = |
| 270 | GetContainer(ash::internal::kShellWindowId_StatusContainer); |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 271 | shelf_.reset(new ash::ShelfWidget( |
| 272 | shelf_container, status_container, workspace_controller())); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 273 | |
[email protected] | 8c0ec43 | 2013-05-10 04:33:39 | [diff] [blame] | 274 | // Create Panel layout manager |
| 275 | aura::Window* panel_container = GetContainer( |
| 276 | internal::kShellWindowId_PanelContainer); |
| 277 | panel_layout_manager_ = |
| 278 | new internal::PanelLayoutManager(panel_container); |
| 279 | panel_container_handler_.reset( |
| 280 | new ToplevelWindowEventHandler(panel_container)); |
| 281 | panel_container->SetLayoutManager(panel_layout_manager_); |
| 282 | |
[email protected] | 8e6986a | 2013-05-31 19:29:55 | [diff] [blame] | 283 | // TODO(stevenjb/oshima): Remove this call to CreateLauncher() and call |
| 284 | // ash::Shell::CreateLauncher() explicitly in ash_shell and ash_unittests |
| 285 | // so that the behavior and construction order is consistent betwheen Ash |
| 286 | // and Chrome. |
[email protected] | c8d19f8 | 2013-05-18 09:09:41 | [diff] [blame] | 287 | if (Shell::GetInstance()->session_state_delegate()->NumberOfLoggedInUsers()) |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 288 | shelf_->CreateLauncher(); |
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 289 | |
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 290 | InitKeyboard(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 291 | } |
| 292 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 293 | void RootWindowController::CreateContainers() { |
| 294 | CreateContainersInRootWindow(root_window_.get()); |
[email protected] | 5817504 | 2013-04-01 19:27:13 | [diff] [blame] | 295 | |
| 296 | // Create touch observer HUD if needed. HUD should be created after the |
| 297 | // containers have been created, so that its widget can be added to them. |
| 298 | CommandLine* command_line = CommandLine::ForCurrentProcess(); |
[email protected] | bff1755 | 2013-04-25 04:44:55 | [diff] [blame] | 299 | if (command_line->HasSwitch(switches::kAshTouchHud)) |
| 300 | touch_observer_hud_ = new TouchObserverHUD(root_window_.get()); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 301 | } |
| 302 | |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 303 | void RootWindowController::CreateSystemBackground( |
| 304 | bool is_first_run_after_boot) { |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 305 | SkColor color = SK_ColorBLACK; |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 306 | #if defined(OS_CHROMEOS) |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 307 | if (is_first_run_after_boot) |
| 308 | color = kChromeOsBootColor; |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 309 | #endif |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 310 | system_background_.reset( |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 311 | new SystemBackgroundController(root_window_.get(), color)); |
| 312 | |
| 313 | #if defined(OS_CHROMEOS) |
| 314 | // Make a copy of the system's boot splash screen so we can composite it |
| 315 | // onscreen until the desktop background is ready. |
| 316 | if (is_first_run_after_boot && |
| 317 | (CommandLine::ForCurrentProcess()->HasSwitch( |
| 318 | switches::kAshCopyHostBackgroundAtBoot) || |
| 319 | CommandLine::ForCurrentProcess()->HasSwitch( |
| 320 | switches::kAshAnimateFromBootSplashScreen))) |
| 321 | boot_splash_screen_.reset(new BootSplashScreen(root_window_.get())); |
| 322 | #endif |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 323 | } |
| 324 | |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 325 | void RootWindowController::OnLauncherCreated() { |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 326 | if (panel_layout_manager_) |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 327 | panel_layout_manager_->SetLauncher(shelf_->launcher()); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | void RootWindowController::ShowLauncher() { |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 331 | if (!shelf_.get() || !shelf_->launcher()) |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 332 | return; |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 333 | shelf_->launcher()->SetVisible(true); |
| 334 | shelf_->status_area_widget()->Show(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 335 | } |
| 336 | |
[email protected] | 16059276d | 2012-10-22 18:59:50 | [diff] [blame] | 337 | void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { |
| 338 | // TODO(oshima): remove if when launcher per display is enabled by |
| 339 | // default. |
[email protected] | 7f7f65c | 2013-04-17 16:47:13 | [diff] [blame] | 340 | if (shelf_) |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 341 | shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
[email protected] | 16059276d | 2012-10-22 18:59:50 | [diff] [blame] | 342 | } |
| 343 | |
| 344 | void RootWindowController::UpdateAfterLoginStatusChange( |
| 345 | user::LoginStatus status) { |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 346 | if (shelf_.get() && shelf_->status_area_widget()) |
| 347 | shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status); |
[email protected] | 16059276d | 2012-10-22 18:59:50 | [diff] [blame] | 348 | } |
| 349 | |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 350 | void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { |
| 351 | if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 352 | switches::kAshAnimateFromBootSplashScreen) && |
| 353 | boot_splash_screen_.get()) { |
| 354 | // Make the splash screen fade out so it doesn't obscure the desktop |
| 355 | // wallpaper's brightness/grayscale animation. |
| 356 | boot_splash_screen_->StartHideAnimation( |
| 357 | base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); |
| 358 | } |
| 359 | } |
| 360 | |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 361 | void RootWindowController::HandleDesktopBackgroundVisible() { |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 362 | system_background_->SetColor(SK_ColorBLACK); |
| 363 | boot_splash_screen_.reset(); |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 364 | } |
| 365 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 366 | void RootWindowController::CloseChildWindows() { |
[email protected] | 79a87b7e | 2013-01-25 05:08:22 | [diff] [blame] | 367 | // panel_layout_manager_ needs to be shut down before windows are destroyed. |
| 368 | if (panel_layout_manager_) { |
| 369 | panel_layout_manager_->Shutdown(); |
| 370 | panel_layout_manager_ = NULL; |
| 371 | } |
| 372 | |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 373 | // TODO(harrym): Remove when Status Area Widget is a child view. |
[email protected] | 7f7f65c | 2013-04-17 16:47:13 | [diff] [blame] | 374 | if (shelf_) |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 375 | shelf_->ShutdownStatusAreaWidget(); |
| 376 | |
| 377 | if (shelf_.get() && shelf_->shelf_layout_manager()) |
| 378 | shelf_->shelf_layout_manager()->set_workspace_controller(NULL); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 379 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 380 | // Close background widget first as it depends on tooltip. |
[email protected] | d86de6b2 | 2012-10-05 19:32:58 | [diff] [blame] | 381 | root_window_->SetProperty(kDesktopController, |
[email protected] | b4ddc7a | 2012-08-07 04:17:32 | [diff] [blame] | 382 | static_cast<DesktopBackgroundWidgetController*>(NULL)); |
[email protected] | d86de6b2 | 2012-10-05 19:32:58 | [diff] [blame] | 383 | root_window_->SetProperty(kAnimatingDesktopController, |
| 384 | static_cast<AnimatingDesktopController*>(NULL)); |
[email protected] | b4ddc7a | 2012-08-07 04:17:32 | [diff] [blame] | 385 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 386 | workspace_controller_.reset(); |
| 387 | aura::client::SetTooltipClient(root_window_.get(), NULL); |
| 388 | |
| 389 | while (!root_window_->children().empty()) { |
| 390 | aura::Window* child = root_window_->children()[0]; |
| 391 | delete child; |
| 392 | } |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 393 | |
| 394 | shelf_.reset(NULL); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 395 | } |
| 396 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 397 | void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
[email protected] | 8039e06c | 2013-01-17 23:34:50 | [diff] [blame] | 398 | // Forget the shelf early so that shelf don't update itself using wrong |
| 399 | // display info. |
| 400 | workspace_controller_->SetShelf(NULL); |
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 401 | ReparentAllWindows(root_window_.get(), dst); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 402 | } |
| 403 | |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 404 | ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
| 405 | return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; |
| 406 | } |
| 407 | |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 408 | SystemTray* RootWindowController::GetSystemTray() { |
| 409 | // We assume in throughout the code that this will not return NULL. If code |
| 410 | // triggers this for valid reasons, it should test status_area_widget first. |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 411 | CHECK(shelf_.get() && shelf_->status_area_widget()); |
| 412 | return shelf_->status_area_widget()->system_tray(); |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 413 | } |
| 414 | |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 415 | void RootWindowController::ShowContextMenu( |
| 416 | const gfx::Point& location_in_screen) { |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 417 | DCHECK(Shell::GetInstance()->delegate()); |
| 418 | scoped_ptr<ui::MenuModel> menu_model( |
[email protected] | 8c0ec43 | 2013-05-10 04:33:39 | [diff] [blame] | 419 | Shell::GetInstance()->delegate()->CreateContextMenu(root_window())); |
[email protected] | 7f7f65c | 2013-04-17 16:47:13 | [diff] [blame] | 420 | if (!menu_model) |
[email protected] | 8e837ec | 2013-01-31 01:48:33 | [diff] [blame] | 421 | return; |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 422 | |
[email protected] | 6175fc4 | 2013-04-05 05:58:58 | [diff] [blame] | 423 | internal::DesktopBackgroundWidgetController* background = |
| 424 | root_window_->GetProperty(kDesktopController); |
| 425 | // Background controller may not be set yet if user clicked on status are |
| 426 | // before initial animation completion. See crbug.com/222218 |
| 427 | if (!background) |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 428 | return; |
| 429 | |
[email protected] | 6175fc4 | 2013-04-05 05:58:58 | [diff] [blame] | 430 | views::MenuRunner menu_runner(menu_model.get()); |
| 431 | if (menu_runner.RunMenuAt(background->widget(), |
| 432 | NULL, gfx::Rect(location_in_screen, gfx::Size()), |
| 433 | views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == |
| 434 | views::MenuRunner::MENU_DELETED) { |
| 435 | return; |
| 436 | } |
| 437 | |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 438 | Shell::GetInstance()->UpdateShelfVisibility(); |
| 439 | } |
| 440 | |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 441 | void RootWindowController::UpdateShelfVisibility() { |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 442 | shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 443 | } |
| 444 | |
[email protected] | 700849f | 2013-04-30 17:49:20 | [diff] [blame] | 445 | aura::Window* RootWindowController::GetFullscreenWindow() const { |
[email protected] | 2ee2f5d | 2013-01-10 23:37:16 | [diff] [blame] | 446 | aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); |
| 447 | for (size_t i = 0; i < container->children().size(); ++i) { |
| 448 | aura::Window* child = container->children()[i]; |
[email protected] | 700849f | 2013-04-30 17:49:20 | [diff] [blame] | 449 | if (ash::wm::IsWindowFullscreen(child)) |
| 450 | return child; |
[email protected] | 2ee2f5d | 2013-01-10 23:37:16 | [diff] [blame] | 451 | } |
[email protected] | 700849f | 2013-04-30 17:49:20 | [diff] [blame] | 452 | return NULL; |
[email protected] | 2ee2f5d | 2013-01-10 23:37:16 | [diff] [blame] | 453 | } |
| 454 | |
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 455 | void RootWindowController::InitKeyboard() { |
| 456 | if (keyboard::IsKeyboardEnabled()) { |
| 457 | aura::Window* parent = root_window(); |
| 458 | |
| 459 | keyboard::KeyboardControllerProxy* proxy = |
| 460 | Shell::GetInstance()->delegate()->CreateKeyboardControllerProxy(); |
| 461 | keyboard_controller_.reset( |
| 462 | new keyboard::KeyboardController(proxy)); |
[email protected] | 5416f28 | 2013-04-29 20:52:48 | [diff] [blame] | 463 | |
| 464 | keyboard_controller_->AddObserver(shelf()->shelf_layout_manager()); |
| 465 | keyboard_controller_->AddObserver(panel_layout_manager_); |
| 466 | |
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 467 | aura::Window* keyboard_container = |
| 468 | keyboard_controller_->GetContainerWindow(); |
| 469 | parent->AddChild(keyboard_container); |
[email protected] | e0f7113 | 2013-04-17 12:32:51 | [diff] [blame] | 470 | keyboard_container->SetBounds(parent->bounds()); |
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 471 | } |
| 472 | } |
| 473 | |
| 474 | |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 475 | //////////////////////////////////////////////////////////////////////////////// |
| 476 | // RootWindowController, private: |
| 477 | |
| 478 | void RootWindowController::CreateContainersInRootWindow( |
| 479 | aura::RootWindow* root_window) { |
| 480 | // These containers are just used by PowerButtonController to animate groups |
| 481 | // of containers simultaneously without messing up the current transformations |
| 482 | // on those containers. These are direct children of the root window; all of |
| 483 | // the other containers are their children. |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 484 | |
| 485 | // The desktop background container is not part of the lock animation, so it |
| 486 | // is not included in those animate groups. |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 487 | // When screen is locked desktop background is moved to lock screen background |
| 488 | // container (moved back on unlock). We want to make sure that there's an |
| 489 | // opaque layer occluding the non-lock-screen layers. |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 490 | aura::Window* desktop_background_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 491 | kShellWindowId_DesktopBackgroundContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 492 | "DesktopBackgroundContainer", |
| 493 | root_window); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 494 | views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 495 | desktop_background_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 496 | |
| 497 | aura::Window* non_lock_screen_containers = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 498 | kShellWindowId_NonLockScreenContainersContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 499 | "NonLockScreenContainersContainer", |
| 500 | root_window); |
| 501 | |
| 502 | aura::Window* lock_background_containers = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 503 | kShellWindowId_LockScreenBackgroundContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 504 | "LockScreenBackgroundContainer", |
| 505 | root_window); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 506 | views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 507 | lock_background_containers); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 508 | |
| 509 | aura::Window* lock_screen_containers = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 510 | kShellWindowId_LockScreenContainersContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 511 | "LockScreenContainersContainer", |
| 512 | root_window); |
| 513 | aura::Window* lock_screen_related_containers = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 514 | kShellWindowId_LockScreenRelatedContainersContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 515 | "LockScreenRelatedContainersContainer", |
| 516 | root_window); |
| 517 | |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 518 | CreateContainer(kShellWindowId_UnparentedControlContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 519 | "UnparentedControlContainer", |
| 520 | non_lock_screen_containers); |
| 521 | |
| 522 | aura::Window* default_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 523 | kShellWindowId_DefaultContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 524 | "DefaultContainer", |
| 525 | non_lock_screen_containers); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 526 | views::corewm::SetChildWindowVisibilityChangesAnimated(default_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 527 | SetUsesScreenCoordinates(default_container); |
| 528 | |
| 529 | aura::Window* always_on_top_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 530 | kShellWindowId_AlwaysOnTopContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 531 | "AlwaysOnTopContainer", |
| 532 | non_lock_screen_containers); |
| 533 | always_on_top_container_handler_.reset( |
| 534 | new ToplevelWindowEventHandler(always_on_top_container)); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 535 | views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 536 | always_on_top_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 537 | SetUsesScreenCoordinates(always_on_top_container); |
| 538 | |
| 539 | aura::Window* panel_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 540 | kShellWindowId_PanelContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 541 | "PanelContainer", |
| 542 | non_lock_screen_containers); |
| 543 | SetUsesScreenCoordinates(panel_container); |
| 544 | |
| 545 | aura::Window* launcher_container = |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 546 | CreateContainer(kShellWindowId_ShelfContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 547 | "LauncherContainer", |
| 548 | non_lock_screen_containers); |
| 549 | SetUsesScreenCoordinates(launcher_container); |
| 550 | |
[email protected] | dc851a4e5 | 2012-10-03 00:05:55 | [diff] [blame] | 551 | aura::Window* app_list_container = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 552 | CreateContainer(kShellWindowId_AppListContainer, |
[email protected] | dc851a4e5 | 2012-10-03 00:05:55 | [diff] [blame] | 553 | "AppListContainer", |
| 554 | non_lock_screen_containers); |
| 555 | SetUsesScreenCoordinates(app_list_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 556 | |
| 557 | aura::Window* modal_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 558 | kShellWindowId_SystemModalContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 559 | "SystemModalContainer", |
| 560 | non_lock_screen_containers); |
| 561 | modal_container_handler_.reset( |
| 562 | new ToplevelWindowEventHandler(modal_container)); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 563 | modal_container->SetLayoutManager( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 564 | new SystemModalContainerLayoutManager(modal_container)); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 565 | views::corewm::SetChildWindowVisibilityChangesAnimated(modal_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 566 | SetUsesScreenCoordinates(modal_container); |
| 567 | |
| 568 | aura::Window* input_method_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 569 | kShellWindowId_InputMethodContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 570 | "InputMethodContainer", |
| 571 | non_lock_screen_containers); |
| 572 | SetUsesScreenCoordinates(input_method_container); |
| 573 | |
| 574 | // TODO(beng): Figure out if we can make this use |
| 575 | // SystemModalContainerEventFilter instead of stops_event_propagation. |
| 576 | aura::Window* lock_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 577 | kShellWindowId_LockScreenContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 578 | "LockScreenContainer", |
| 579 | lock_screen_containers); |
| 580 | lock_container->SetLayoutManager( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 581 | new BaseLayoutManager(root_window)); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 582 | SetUsesScreenCoordinates(lock_container); |
| 583 | // TODO(beng): stopsevents |
| 584 | |
| 585 | aura::Window* lock_modal_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 586 | kShellWindowId_LockSystemModalContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 587 | "LockSystemModalContainer", |
| 588 | lock_screen_containers); |
| 589 | lock_modal_container_handler_.reset( |
| 590 | new ToplevelWindowEventHandler(lock_modal_container)); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 591 | lock_modal_container->SetLayoutManager( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 592 | new SystemModalContainerLayoutManager(lock_modal_container)); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 593 | views::corewm::SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 594 | SetUsesScreenCoordinates(lock_modal_container); |
| 595 | |
| 596 | aura::Window* status_container = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 597 | CreateContainer(kShellWindowId_StatusContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 598 | "StatusContainer", |
| 599 | lock_screen_related_containers); |
| 600 | SetUsesScreenCoordinates(status_container); |
| 601 | |
| 602 | aura::Window* settings_bubble_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 603 | kShellWindowId_SettingBubbleContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 604 | "SettingBubbleContainer", |
| 605 | lock_screen_related_containers); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 606 | views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 607 | settings_bubble_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 608 | SetUsesScreenCoordinates(settings_bubble_container); |
| 609 | |
| 610 | aura::Window* menu_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 611 | kShellWindowId_MenuContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 612 | "MenuContainer", |
| 613 | lock_screen_related_containers); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 614 | views::corewm::SetChildWindowVisibilityChangesAnimated(menu_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 615 | SetUsesScreenCoordinates(menu_container); |
| 616 | |
| 617 | aura::Window* drag_drop_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 618 | kShellWindowId_DragImageAndTooltipContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 619 | "DragImageAndTooltipContainer", |
| 620 | lock_screen_related_containers); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 621 | views::corewm::SetChildWindowVisibilityChangesAnimated(drag_drop_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 622 | SetUsesScreenCoordinates(drag_drop_container); |
| 623 | |
| 624 | aura::Window* overlay_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 625 | kShellWindowId_OverlayContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 626 | "OverlayContainer", |
| 627 | lock_screen_related_containers); |
| 628 | SetUsesScreenCoordinates(overlay_container); |
[email protected] | a07615f | 2012-10-24 08:23:08 | [diff] [blame] | 629 | |
| 630 | CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
| 631 | "PowerButtonAnimationContainer", root_window) ; |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 632 | } |
| 633 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 634 | } // namespace internal |
| 635 | } // namespace ash |