[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] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 15 | #include "ash/shelf/shelf_layout_manager.h" |
| 16 | #include "ash/shelf/shelf_types.h" |
| 17 | #include "ash/shelf/shelf_widget.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 18 | #include "ash/shell.h" |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 19 | #include "ash/shell_delegate.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 20 | #include "ash/shell_factory.h" |
| 21 | #include "ash/shell_window_ids.h" |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 22 | #include "ash/system/status_area_widget.h" |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 23 | #include "ash/system/tray/system_tray_delegate.h" |
[email protected] | 5817504 | 2013-04-01 19:27:13 | [diff] [blame] | 24 | #include "ash/touch/touch_observer_hud.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 25 | #include "ash/wm/base_layout_manager.h" |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 26 | #include "ash/wm/boot_splash_screen.h" |
[email protected] | 7095a65 | 2013-03-07 19:41:49 | [diff] [blame] | 27 | #include "ash/wm/panels/panel_layout_manager.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 28 | #include "ash/wm/property_util.h" |
| 29 | #include "ash/wm/root_window_layout_manager.h" |
| 30 | #include "ash/wm/screen_dimmer.h" |
[email protected] | 2a2caa0 | 2013-01-22 20:50:36 | [diff] [blame] | 31 | #include "ash/wm/stacking_controller.h" |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 32 | #include "ash/wm/status_area_layout_manager.h" |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 33 | #include "ash/wm/system_background_controller.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 34 | #include "ash/wm/system_modal_container_layout_manager.h" |
[email protected] | 5dc51db8 | 2012-09-11 03:39:01 | [diff] [blame] | 35 | #include "ash/wm/toplevel_window_event_handler.h" |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 36 | #include "ash/wm/window_properties.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 37 | #include "ash/wm/workspace_controller.h" |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 38 | #include "base/command_line.h" |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 39 | #include "base/time.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 40 | #include "ui/aura/client/activation_client.h" |
| 41 | #include "ui/aura/client/aura_constants.h" |
| 42 | #include "ui/aura/client/capture_client.h" |
[email protected] | 8cfb672 | 2012-11-28 03:28:46 | [diff] [blame] | 43 | #include "ui/aura/client/focus_client.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] | 1d03024 | 2012-06-28 18:34:08 | [diff] [blame] | 48 | #include "ui/aura/window_tracker.h" |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 49 | #include "ui/base/models/menu_model.h" |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 50 | #include "ui/gfx/display.h" |
| 51 | #include "ui/gfx/screen.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] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 169 | shelf_(NULL), |
| 170 | panel_layout_manager_(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] | 88d7112 | 2012-10-18 07:11:01 | [diff] [blame] | 185 | if (Shell::IsLauncherPerDisplayEnabled()) |
| 186 | return GetRootWindowController(window->GetRootWindow()); |
| 187 | else |
| 188 | return Shell::GetPrimaryRootWindowController(); |
| 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() { |
[email protected] | 5817504 | 2013-04-01 19:27:13 | [diff] [blame] | 203 | // Remove touch observer HUD. |
| 204 | SetTouchObserverHUD(NULL); |
| 205 | |
[email protected] | 6675e1c | 2012-09-11 09:15:45 | [diff] [blame] | 206 | CloseChildWindows(); |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame] | 207 | if (Shell::GetActiveRootWindow() == root_window_.get()) { |
| 208 | Shell::GetInstance()->set_active_root_window( |
| 209 | Shell::GetPrimaryRootWindow() == root_window_.get() ? |
| 210 | NULL : Shell::GetPrimaryRootWindow()); |
| 211 | } |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 212 | SetRootWindowController(root_window_.get(), NULL); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 213 | screen_dimmer_.reset(); |
| 214 | workspace_controller_.reset(); |
[email protected] | 6675e1c | 2012-09-11 09:15:45 | [diff] [blame] | 215 | // Forget with the display ID so that display lookup |
| 216 | // ends up with invalid display. |
| 217 | root_window_->ClearProperty(kDisplayIdKey); |
| 218 | // And this root window should no longer process events. |
| 219 | root_window_->PrepareForShutdown(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 220 | |
[email protected] | 956a6a4 | 2012-10-29 23:58:10 | [diff] [blame] | 221 | system_background_.reset(); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 222 | } |
| 223 | |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 224 | SystemModalContainerLayoutManager* |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 225 | RootWindowController::GetSystemModalLayoutManager(aura::Window* window) { |
| 226 | aura::Window* container = NULL; |
| 227 | if (window) { |
[email protected] | 3b162e1 | 2012-11-09 11:52:35 | [diff] [blame] | 228 | if (window->parent() && |
| 229 | window->parent()->id() >= kShellWindowId_LockScreenContainer) { |
| 230 | container = GetContainer(kShellWindowId_LockSystemModalContainer); |
| 231 | } else { |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 232 | container = GetContainer(kShellWindowId_SystemModalContainer); |
[email protected] | 3b162e1 | 2012-11-09 11:52:35 | [diff] [blame] | 233 | } |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 234 | } else { |
[email protected] | 945f9cae | 2012-12-12 09:54:29 | [diff] [blame] | 235 | user::LoginStatus login = Shell::GetInstance()->system_tray_delegate() ? |
| 236 | Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() : |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 237 | user::LOGGED_IN_NONE; |
| 238 | int modal_window_id = (login == user::LOGGED_IN_LOCKED || |
| 239 | login == user::LOGGED_IN_NONE) ? |
| 240 | kShellWindowId_LockSystemModalContainer : |
| 241 | kShellWindowId_SystemModalContainer; |
| 242 | container = GetContainer(modal_window_id); |
| 243 | } |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 244 | return static_cast<SystemModalContainerLayoutManager*>( |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 245 | container->layout_manager()); |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 246 | } |
| 247 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 248 | aura::Window* RootWindowController::GetContainer(int container_id) { |
| 249 | return root_window_->GetChildById(container_id); |
| 250 | } |
| 251 | |
| 252 | void RootWindowController::InitLayoutManagers() { |
| 253 | root_window_layout_ = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 254 | new RootWindowLayoutManager(root_window_.get()); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 255 | root_window_->SetLayoutManager(root_window_layout_); |
| 256 | |
| 257 | aura::Window* default_container = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 258 | GetContainer(kShellWindowId_DefaultContainer); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 259 | // Workspace manager has its own layout managers. |
| 260 | workspace_controller_.reset( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 261 | new WorkspaceController(default_container)); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 262 | |
| 263 | aura::Window* always_on_top_container = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 264 | GetContainer(kShellWindowId_AlwaysOnTopContainer); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 265 | always_on_top_container->SetLayoutManager( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 266 | new BaseLayoutManager( |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 267 | always_on_top_container->GetRootWindow())); |
| 268 | } |
| 269 | |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 270 | void RootWindowController::InitForPrimaryDisplay() { |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 271 | DCHECK(!shelf_.get()); |
| 272 | aura::Window* shelf_container = |
| 273 | GetContainer(ash::internal::kShellWindowId_ShelfContainer); |
| 274 | // TODO(harrym): Remove when status area is view. |
[email protected] | 16059276d | 2012-10-22 18:59:50 | [diff] [blame] | 275 | aura::Window* status_container = |
| 276 | GetContainer(ash::internal::kShellWindowId_StatusContainer); |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 277 | shelf_.reset(new ash::ShelfWidget( |
| 278 | shelf_container, status_container, workspace_controller())); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 279 | |
[email protected] | 95db9c1 | 2013-01-31 11:47:44 | [diff] [blame] | 280 | if (Shell::IsLauncherPerDisplayEnabled() || |
| 281 | root_window_ == Shell::GetPrimaryRootWindow()) { |
[email protected] | e5a3deba | 2012-12-15 20:18:28 | [diff] [blame] | 282 | // Create Panel layout manager |
| 283 | aura::Window* panel_container = GetContainer( |
| 284 | internal::kShellWindowId_PanelContainer); |
| 285 | panel_layout_manager_ = |
| 286 | new internal::PanelLayoutManager(panel_container); |
[email protected] | 58202205 | 2013-02-20 15:19:04 | [diff] [blame] | 287 | panel_container_handler_.reset( |
| 288 | new ToplevelWindowEventHandler(panel_container)); |
[email protected] | e5a3deba | 2012-12-15 20:18:28 | [diff] [blame] | 289 | panel_container->SetLayoutManager(panel_layout_manager_); |
| 290 | } |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 291 | if (Shell::GetInstance()->delegate()->IsUserLoggedIn()) |
| 292 | shelf_->CreateLauncher(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 293 | } |
| 294 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 295 | void RootWindowController::CreateContainers() { |
| 296 | CreateContainersInRootWindow(root_window_.get()); |
[email protected] | 5817504 | 2013-04-01 19:27:13 | [diff] [blame] | 297 | |
| 298 | // Create touch observer HUD if needed. HUD should be created after the |
| 299 | // containers have been created, so that its widget can be added to them. |
| 300 | CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 301 | if (command_line->HasSwitch(switches::kAshTouchHud)) { |
| 302 | int64 id = root_window_->GetProperty(kDisplayIdKey); |
| 303 | const gfx::Display& display = Shell::GetInstance()->display_manager()-> |
| 304 | GetDisplayForId(id); |
| 305 | SetTouchObserverHUD(new TouchObserverHUD(display)); |
| 306 | } |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 307 | } |
| 308 | |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 309 | void RootWindowController::CreateSystemBackground( |
| 310 | bool is_first_run_after_boot) { |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 311 | SkColor color = SK_ColorBLACK; |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 312 | #if defined(OS_CHROMEOS) |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 313 | if (is_first_run_after_boot) |
| 314 | color = kChromeOsBootColor; |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 315 | #endif |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 316 | system_background_.reset( |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 317 | new SystemBackgroundController(root_window_.get(), color)); |
| 318 | |
| 319 | #if defined(OS_CHROMEOS) |
| 320 | // Make a copy of the system's boot splash screen so we can composite it |
| 321 | // onscreen until the desktop background is ready. |
| 322 | if (is_first_run_after_boot && |
| 323 | (CommandLine::ForCurrentProcess()->HasSwitch( |
| 324 | switches::kAshCopyHostBackgroundAtBoot) || |
| 325 | CommandLine::ForCurrentProcess()->HasSwitch( |
| 326 | switches::kAshAnimateFromBootSplashScreen))) |
| 327 | boot_splash_screen_.reset(new BootSplashScreen(root_window_.get())); |
| 328 | #endif |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 329 | } |
| 330 | |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 331 | void RootWindowController::OnLauncherCreated() { |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 332 | if (panel_layout_manager_) |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 333 | panel_layout_manager_->SetLauncher(shelf_->launcher()); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | void RootWindowController::ShowLauncher() { |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 337 | if (!shelf_.get() || !shelf_->launcher()) |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 338 | return; |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 339 | shelf_->launcher()->SetVisible(true); |
| 340 | shelf_->status_area_widget()->Show(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 341 | } |
| 342 | |
[email protected] | 16059276d | 2012-10-22 18:59:50 | [diff] [blame] | 343 | void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { |
| 344 | // TODO(oshima): remove if when launcher per display is enabled by |
| 345 | // default. |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 346 | if (shelf_.get()) |
| 347 | shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
[email protected] | 16059276d | 2012-10-22 18:59:50 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | void RootWindowController::UpdateAfterLoginStatusChange( |
| 351 | user::LoginStatus status) { |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 352 | if (shelf_.get() && shelf_->status_area_widget()) |
| 353 | shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status); |
[email protected] | 16059276d | 2012-10-22 18:59:50 | [diff] [blame] | 354 | } |
| 355 | |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 356 | void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { |
| 357 | if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 358 | switches::kAshAnimateFromBootSplashScreen) && |
| 359 | boot_splash_screen_.get()) { |
| 360 | // Make the splash screen fade out so it doesn't obscure the desktop |
| 361 | // wallpaper's brightness/grayscale animation. |
| 362 | boot_splash_screen_->StartHideAnimation( |
| 363 | base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); |
| 364 | } |
| 365 | } |
| 366 | |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 367 | void RootWindowController::HandleDesktopBackgroundVisible() { |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 368 | system_background_->SetColor(SK_ColorBLACK); |
| 369 | boot_splash_screen_.reset(); |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 370 | } |
| 371 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 372 | void RootWindowController::CloseChildWindows() { |
[email protected] | 79a87b7e | 2013-01-25 05:08:22 | [diff] [blame] | 373 | // panel_layout_manager_ needs to be shut down before windows are destroyed. |
| 374 | if (panel_layout_manager_) { |
| 375 | panel_layout_manager_->Shutdown(); |
| 376 | panel_layout_manager_ = NULL; |
| 377 | } |
| 378 | |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 379 | // TODO(harrym): Remove when Status Area Widget is a child view. |
| 380 | if (shelf_.get()) |
| 381 | shelf_->ShutdownStatusAreaWidget(); |
| 382 | |
| 383 | if (shelf_.get() && shelf_->shelf_layout_manager()) |
| 384 | shelf_->shelf_layout_manager()->set_workspace_controller(NULL); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 385 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 386 | // Close background widget first as it depends on tooltip. |
[email protected] | d86de6b2 | 2012-10-05 19:32:58 | [diff] [blame] | 387 | root_window_->SetProperty(kDesktopController, |
[email protected] | b4ddc7a | 2012-08-07 04:17:32 | [diff] [blame] | 388 | static_cast<DesktopBackgroundWidgetController*>(NULL)); |
[email protected] | d86de6b2 | 2012-10-05 19:32:58 | [diff] [blame] | 389 | root_window_->SetProperty(kAnimatingDesktopController, |
| 390 | static_cast<AnimatingDesktopController*>(NULL)); |
[email protected] | b4ddc7a | 2012-08-07 04:17:32 | [diff] [blame] | 391 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 392 | workspace_controller_.reset(); |
| 393 | aura::client::SetTooltipClient(root_window_.get(), NULL); |
| 394 | |
| 395 | while (!root_window_->children().empty()) { |
| 396 | aura::Window* child = root_window_->children()[0]; |
| 397 | delete child; |
| 398 | } |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 399 | |
| 400 | shelf_.reset(NULL); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 401 | } |
| 402 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 403 | void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
[email protected] | 8cfb672 | 2012-11-28 03:28:46 | [diff] [blame] | 404 | aura::Window* focused = aura::client::GetFocusClient(dst)->GetFocusedWindow(); |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 405 | aura::WindowTracker tracker; |
| 406 | if (focused) |
| 407 | tracker.Add(focused); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 408 | aura::client::ActivationClient* activation_client = |
| 409 | aura::client::GetActivationClient(dst); |
| 410 | aura::Window* active = activation_client->GetActiveWindow(); |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 411 | if (active && focused != active) |
| 412 | tracker.Add(active); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 413 | // Deactivate the window to close menu / bubble windows. |
| 414 | activation_client->DeactivateWindow(active); |
| 415 | // Release capture if any. |
| 416 | aura::client::GetCaptureClient(root_window_.get())-> |
| 417 | SetCapture(NULL); |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 418 | // Clear the focused window if any. This is necessary because a |
| 419 | // window may be deleted when losing focus (fullscreen flash for |
| 420 | // example). If the focused window is still alive after move, it'll |
| 421 | // be re-focused below. |
[email protected] | 550543e | 2013-01-11 22:43:44 | [diff] [blame] | 422 | aura::client::GetFocusClient(dst)->FocusWindow(NULL); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 423 | |
[email protected] | 8039e06c | 2013-01-17 23:34:50 | [diff] [blame] | 424 | // Forget the shelf early so that shelf don't update itself using wrong |
| 425 | // display info. |
| 426 | workspace_controller_->SetShelf(NULL); |
| 427 | |
[email protected] | 9505857 | 2012-08-20 14:57:29 | [diff] [blame] | 428 | ReparentAllWindows(root_window_.get(), dst); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 429 | |
| 430 | // Restore focused or active window if it's still alive. |
[email protected] | 1d03024 | 2012-06-28 18:34:08 | [diff] [blame] | 431 | if (focused && tracker.Contains(focused) && dst->Contains(focused)) { |
[email protected] | 550543e | 2013-01-11 22:43:44 | [diff] [blame] | 432 | aura::client::GetFocusClient(dst)->FocusWindow(focused); |
[email protected] | 1d03024 | 2012-06-28 18:34:08 | [diff] [blame] | 433 | } else if (active && tracker.Contains(active) && dst->Contains(active)) { |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 434 | activation_client->ActivateWindow(active); |
| 435 | } |
| 436 | } |
| 437 | |
[email protected] | 5817504 | 2013-04-01 19:27:13 | [diff] [blame] | 438 | void RootWindowController::SetTouchObserverHUD(TouchObserverHUD* hud) { |
| 439 | if (touch_observer_hud_.get()) |
| 440 | root_window_->RemovePreTargetHandler(touch_observer_hud_.get()); |
| 441 | if (hud) |
| 442 | root_window_->AddPreTargetHandler(hud); |
| 443 | touch_observer_hud_.reset(hud); |
| 444 | } |
| 445 | |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 446 | ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
| 447 | return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; |
| 448 | } |
| 449 | |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 450 | SystemTray* RootWindowController::GetSystemTray() { |
| 451 | // We assume in throughout the code that this will not return NULL. If code |
| 452 | // triggers this for valid reasons, it should test status_area_widget first. |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 453 | CHECK(shelf_.get() && shelf_->status_area_widget()); |
| 454 | return shelf_->status_area_widget()->system_tray(); |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 455 | } |
| 456 | |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 457 | void RootWindowController::ShowContextMenu( |
| 458 | const gfx::Point& location_in_screen) { |
| 459 | aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? |
| 460 | root_window() : Shell::GetPrimaryRootWindow(); |
| 461 | DCHECK(Shell::GetInstance()->delegate()); |
| 462 | scoped_ptr<ui::MenuModel> menu_model( |
| 463 | Shell::GetInstance()->delegate()->CreateContextMenu(target)); |
[email protected] | 8e837ec | 2013-01-31 01:48:33 | [diff] [blame] | 464 | if (!menu_model.get()) |
| 465 | return; |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 466 | |
[email protected] | 6175fc4 | 2013-04-05 05:58:58 | [diff] [blame^] | 467 | internal::DesktopBackgroundWidgetController* background = |
| 468 | root_window_->GetProperty(kDesktopController); |
| 469 | // Background controller may not be set yet if user clicked on status are |
| 470 | // before initial animation completion. See crbug.com/222218 |
| 471 | if (!background) |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 472 | return; |
| 473 | |
[email protected] | 6175fc4 | 2013-04-05 05:58:58 | [diff] [blame^] | 474 | views::MenuRunner menu_runner(menu_model.get()); |
| 475 | if (menu_runner.RunMenuAt(background->widget(), |
| 476 | NULL, gfx::Rect(location_in_screen, gfx::Size()), |
| 477 | views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == |
| 478 | views::MenuRunner::MENU_DELETED) { |
| 479 | return; |
| 480 | } |
| 481 | |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 482 | Shell::GetInstance()->UpdateShelfVisibility(); |
| 483 | } |
| 484 | |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 485 | void RootWindowController::UpdateShelfVisibility() { |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 486 | shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 487 | } |
| 488 | |
[email protected] | 2ee2f5d | 2013-01-10 23:37:16 | [diff] [blame] | 489 | bool RootWindowController::IsImmersiveMode() const { |
| 490 | aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); |
| 491 | for (size_t i = 0; i < container->children().size(); ++i) { |
| 492 | aura::Window* child = container->children()[i]; |
| 493 | if (child->IsVisible() && child->GetProperty(kImmersiveModeKey)) |
| 494 | return true; |
| 495 | } |
| 496 | return false; |
| 497 | } |
| 498 | |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 499 | //////////////////////////////////////////////////////////////////////////////// |
| 500 | // RootWindowController, private: |
| 501 | |
| 502 | void RootWindowController::CreateContainersInRootWindow( |
| 503 | aura::RootWindow* root_window) { |
| 504 | // These containers are just used by PowerButtonController to animate groups |
| 505 | // of containers simultaneously without messing up the current transformations |
| 506 | // on those containers. These are direct children of the root window; all of |
| 507 | // the other containers are their children. |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 508 | |
| 509 | // The desktop background container is not part of the lock animation, so it |
| 510 | // is not included in those animate groups. |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 511 | // When screen is locked desktop background is moved to lock screen background |
| 512 | // container (moved back on unlock). We want to make sure that there's an |
| 513 | // opaque layer occluding the non-lock-screen layers. |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 514 | aura::Window* desktop_background_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 515 | kShellWindowId_DesktopBackgroundContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 516 | "DesktopBackgroundContainer", |
| 517 | root_window); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 518 | views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 519 | desktop_background_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 520 | |
| 521 | aura::Window* non_lock_screen_containers = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 522 | kShellWindowId_NonLockScreenContainersContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 523 | "NonLockScreenContainersContainer", |
| 524 | root_window); |
| 525 | |
| 526 | aura::Window* lock_background_containers = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 527 | kShellWindowId_LockScreenBackgroundContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 528 | "LockScreenBackgroundContainer", |
| 529 | root_window); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 530 | views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 531 | lock_background_containers); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 532 | |
| 533 | aura::Window* lock_screen_containers = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 534 | kShellWindowId_LockScreenContainersContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 535 | "LockScreenContainersContainer", |
| 536 | root_window); |
| 537 | aura::Window* lock_screen_related_containers = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 538 | kShellWindowId_LockScreenRelatedContainersContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 539 | "LockScreenRelatedContainersContainer", |
| 540 | root_window); |
| 541 | |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 542 | CreateContainer(kShellWindowId_UnparentedControlContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 543 | "UnparentedControlContainer", |
| 544 | non_lock_screen_containers); |
| 545 | |
| 546 | aura::Window* default_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 547 | kShellWindowId_DefaultContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 548 | "DefaultContainer", |
| 549 | non_lock_screen_containers); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 550 | views::corewm::SetChildWindowVisibilityChangesAnimated(default_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 551 | SetUsesScreenCoordinates(default_container); |
| 552 | |
| 553 | aura::Window* always_on_top_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 554 | kShellWindowId_AlwaysOnTopContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 555 | "AlwaysOnTopContainer", |
| 556 | non_lock_screen_containers); |
| 557 | always_on_top_container_handler_.reset( |
| 558 | new ToplevelWindowEventHandler(always_on_top_container)); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 559 | views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 560 | always_on_top_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 561 | SetUsesScreenCoordinates(always_on_top_container); |
| 562 | |
| 563 | aura::Window* panel_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 564 | kShellWindowId_PanelContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 565 | "PanelContainer", |
| 566 | non_lock_screen_containers); |
| 567 | SetUsesScreenCoordinates(panel_container); |
| 568 | |
| 569 | aura::Window* launcher_container = |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 570 | CreateContainer(kShellWindowId_ShelfContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 571 | "LauncherContainer", |
| 572 | non_lock_screen_containers); |
| 573 | SetUsesScreenCoordinates(launcher_container); |
| 574 | |
[email protected] | dc851a4e5 | 2012-10-03 00:05:55 | [diff] [blame] | 575 | aura::Window* app_list_container = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 576 | CreateContainer(kShellWindowId_AppListContainer, |
[email protected] | dc851a4e5 | 2012-10-03 00:05:55 | [diff] [blame] | 577 | "AppListContainer", |
| 578 | non_lock_screen_containers); |
| 579 | SetUsesScreenCoordinates(app_list_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 580 | |
| 581 | aura::Window* modal_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 582 | kShellWindowId_SystemModalContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 583 | "SystemModalContainer", |
| 584 | non_lock_screen_containers); |
| 585 | modal_container_handler_.reset( |
| 586 | new ToplevelWindowEventHandler(modal_container)); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 587 | modal_container->SetLayoutManager( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 588 | new SystemModalContainerLayoutManager(modal_container)); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 589 | views::corewm::SetChildWindowVisibilityChangesAnimated(modal_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 590 | SetUsesScreenCoordinates(modal_container); |
| 591 | |
| 592 | aura::Window* input_method_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 593 | kShellWindowId_InputMethodContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 594 | "InputMethodContainer", |
| 595 | non_lock_screen_containers); |
| 596 | SetUsesScreenCoordinates(input_method_container); |
| 597 | |
| 598 | // TODO(beng): Figure out if we can make this use |
| 599 | // SystemModalContainerEventFilter instead of stops_event_propagation. |
| 600 | aura::Window* lock_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 601 | kShellWindowId_LockScreenContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 602 | "LockScreenContainer", |
| 603 | lock_screen_containers); |
| 604 | lock_container->SetLayoutManager( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 605 | new BaseLayoutManager(root_window)); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 606 | SetUsesScreenCoordinates(lock_container); |
| 607 | // TODO(beng): stopsevents |
| 608 | |
| 609 | aura::Window* lock_modal_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 610 | kShellWindowId_LockSystemModalContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 611 | "LockSystemModalContainer", |
| 612 | lock_screen_containers); |
| 613 | lock_modal_container_handler_.reset( |
| 614 | new ToplevelWindowEventHandler(lock_modal_container)); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 615 | lock_modal_container->SetLayoutManager( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 616 | new SystemModalContainerLayoutManager(lock_modal_container)); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 617 | views::corewm::SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 618 | SetUsesScreenCoordinates(lock_modal_container); |
| 619 | |
| 620 | aura::Window* status_container = |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 621 | CreateContainer(kShellWindowId_StatusContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 622 | "StatusContainer", |
| 623 | lock_screen_related_containers); |
| 624 | SetUsesScreenCoordinates(status_container); |
| 625 | |
| 626 | aura::Window* settings_bubble_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 627 | kShellWindowId_SettingBubbleContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 628 | "SettingBubbleContainer", |
| 629 | lock_screen_related_containers); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 630 | views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 631 | settings_bubble_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 632 | SetUsesScreenCoordinates(settings_bubble_container); |
| 633 | |
| 634 | aura::Window* menu_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 635 | kShellWindowId_MenuContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 636 | "MenuContainer", |
| 637 | lock_screen_related_containers); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 638 | views::corewm::SetChildWindowVisibilityChangesAnimated(menu_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 639 | SetUsesScreenCoordinates(menu_container); |
| 640 | |
| 641 | aura::Window* drag_drop_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 642 | kShellWindowId_DragImageAndTooltipContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 643 | "DragImageAndTooltipContainer", |
| 644 | lock_screen_related_containers); |
[email protected] | b5756e2 | 2012-11-30 01:32:02 | [diff] [blame] | 645 | views::corewm::SetChildWindowVisibilityChangesAnimated(drag_drop_container); |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 646 | SetUsesScreenCoordinates(drag_drop_container); |
| 647 | |
| 648 | aura::Window* overlay_container = CreateContainer( |
[email protected] | c0ce80e | 2012-10-05 23:28:27 | [diff] [blame] | 649 | kShellWindowId_OverlayContainer, |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 650 | "OverlayContainer", |
| 651 | lock_screen_related_containers); |
| 652 | SetUsesScreenCoordinates(overlay_container); |
[email protected] | a07615f | 2012-10-24 08:23:08 | [diff] [blame] | 653 | |
| 654 | CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
| 655 | "PowerButtonAnimationContainer", root_window) ; |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 656 | } |
| 657 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 658 | } // namespace internal |
| 659 | } // namespace ash |