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