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