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