[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] | 8b3e3d8 | 2013-08-20 14:36:30 | [diff] [blame] | 7 | #include <queue> |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 8 | #include <vector> |
| 9 | |
jamescook | 01bf23e7 | 2017-01-09 19:58:15 | [diff] [blame^] | 10 | #include "ash/ash_touch_exploration_manager_chromeos.h" |
sky | 0702b27 | 2016-06-03 22:10:41 | [diff] [blame] | 11 | #include "ash/aura/aura_layout_manager_adapter.h" |
sky | d053905c | 2016-08-30 22:37:35 | [diff] [blame] | 12 | #include "ash/aura/wm_root_window_controller_aura.h" |
sky | 0702b27 | 2016-06-03 22:10:41 | [diff] [blame] | 13 | #include "ash/aura/wm_shelf_aura.h" |
| 14 | #include "ash/aura/wm_window_aura.h" |
jamescook | e044e1c | 2016-06-13 20:56:18 | [diff] [blame] | 15 | #include "ash/common/ash_constants.h" |
msw | d9b1b34 | 2016-06-17 20:19:57 | [diff] [blame] | 16 | #include "ash/common/ash_switches.h" |
jamescook | 26f3209 | 2016-06-17 04:26:52 | [diff] [blame] | 17 | #include "ash/common/focus_cycler.h" |
msw | b241605 | 2016-06-24 21:23:45 | [diff] [blame] | 18 | #include "ash/common/login_status.h" |
jamescook | 2b624c5a | 2016-06-08 01:34:02 | [diff] [blame] | 19 | #include "ash/common/session/session_state_delegate.h" |
jamescook | 361185a2 | 2016-08-13 00:12:09 | [diff] [blame] | 20 | #include "ash/common/shelf/shelf_delegate.h" |
msw | df64c66b | 2016-08-23 18:56:37 | [diff] [blame] | 21 | #include "ash/common/shelf/shelf_layout_manager.h" |
msw | df64c66b | 2016-08-23 18:56:37 | [diff] [blame] | 22 | #include "ash/common/shelf/shelf_widget.h" |
msw | 0414d412 | 2016-07-06 22:58:48 | [diff] [blame] | 23 | #include "ash/common/shell_delegate.h" |
msw | df64c66b | 2016-08-23 18:56:37 | [diff] [blame] | 24 | #include "ash/common/system/status_area_layout_manager.h" |
jamescook | 625f791 | 2016-07-14 01:00:52 | [diff] [blame] | 25 | #include "ash/common/system/status_area_widget.h" |
jamescook | 2a4d1eb | 2016-06-09 20:10:07 | [diff] [blame] | 26 | #include "ash/common/system/tray/system_tray_delegate.h" |
msw | 0e91d93 | 2016-08-25 22:34:09 | [diff] [blame] | 27 | #include "ash/common/wallpaper/wallpaper_delegate.h" |
msw | 3f439af | 2016-09-08 22:35:26 | [diff] [blame] | 28 | #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
sky | d606377 | 2016-06-01 17:52:21 | [diff] [blame] | 29 | #include "ash/common/wm/always_on_top_controller.h" |
| 30 | #include "ash/common/wm/container_finder.h" |
| 31 | #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 32 | #include "ash/common/wm/fullscreen_window_finder.h" |
| 33 | #include "ash/common/wm/panels/panel_layout_manager.h" |
sky | c096d9f | 2016-06-02 13:46:26 | [diff] [blame] | 34 | #include "ash/common/wm/root_window_layout_manager.h" |
sky | d606377 | 2016-06-01 17:52:21 | [diff] [blame] | 35 | #include "ash/common/wm/switchable_windows.h" |
sky | ea4ca94 | 2016-09-12 21:56:19 | [diff] [blame] | 36 | #include "ash/common/wm/system_modal_container_layout_manager.h" |
sky | d606377 | 2016-06-01 17:52:21 | [diff] [blame] | 37 | #include "ash/common/wm/window_state.h" |
sky | d606377 | 2016-06-01 17:52:21 | [diff] [blame] | 38 | #include "ash/common/wm/workspace/workspace_layout_manager.h" |
sky | f71e6c9 | 2016-08-30 18:49:19 | [diff] [blame] | 39 | #include "ash/common/wm/workspace_controller.h" |
sky | 0702b27 | 2016-06-03 22:10:41 | [diff] [blame] | 40 | #include "ash/common/wm_shell.h" |
| 41 | #include "ash/common/wm_window.h" |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 42 | #include "ash/high_contrast/high_contrast_controller.h" |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 43 | #include "ash/host/ash_window_tree_host.h" |
jamescook | d4649fa | 2016-09-30 17:50:09 | [diff] [blame] | 44 | #include "ash/public/cpp/shelf_types.h" |
jamescook | 8800b823 | 2016-10-19 12:46:27 | [diff] [blame] | 45 | #include "ash/public/cpp/shell_window_ids.h" |
[email protected] | f8e6aad | 2013-08-30 21:49:11 | [diff] [blame] | 46 | #include "ash/root_window_settings.h" |
jamescook | 752e8df | 2016-08-09 19:54:39 | [diff] [blame] | 47 | #include "ash/shelf/shelf_window_targeter.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 48 | #include "ash/shell.h" |
[email protected] | 2b8a9bb | 2013-07-01 22:43:40 | [diff] [blame] | 49 | #include "ash/touch/touch_hud_debug.h" |
| 50 | #include "ash/touch/touch_hud_projection.h" |
[email protected] | 80549c15 | 2013-07-02 01:42:47 | [diff] [blame] | 51 | #include "ash/touch/touch_observer_hud.h" |
jamescook | 01bf23e7 | 2017-01-09 19:58:15 | [diff] [blame^] | 52 | #include "ash/wm/boot_splash_screen_chromeos.h" |
[email protected] | b8642ec | 2014-04-17 05:20:39 | [diff] [blame] | 53 | #include "ash/wm/panels/attached_panel_window_targeter.h" |
[email protected] | 10065941 | 2013-06-21 22:59:55 | [diff] [blame] | 54 | #include "ash/wm/panels/panel_window_event_handler.h" |
[email protected] | 2a2caa0 | 2013-01-22 20:50:36 | [diff] [blame] | 55 | #include "ash/wm/stacking_controller.h" |
msw | 607227f8 | 2016-08-30 17:22:39 | [diff] [blame] | 56 | #include "ash/wm/system_wallpaper_controller.h" |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 57 | #include "ash/wm/window_properties.h" |
sky | 8d5646fe | 2016-04-15 17:03:46 | [diff] [blame] | 58 | #include "ash/wm/window_state_aura.h" |
[email protected] | 700849f | 2013-04-30 17:49:20 | [diff] [blame] | 59 | #include "ash/wm/window_util.h" |
[email protected] | e6e41d2f | 2012-10-29 19:22:19 | [diff] [blame] | 60 | #include "base/command_line.h" |
jonross | a90d898 | 2016-05-16 18:14:25 | [diff] [blame] | 61 | #include "base/macros.h" |
sky | 1e30f06 | 2016-04-14 21:19:16 | [diff] [blame] | 62 | #include "base/memory/ptr_util.h" |
[email protected] | 1e84c63 | 2013-06-27 23:12:21 | [diff] [blame] | 63 | #include "base/time/time.h" |
jamescook | 01bf23e7 | 2017-01-09 19:58:15 | [diff] [blame^] | 64 | #include "chromeos/chromeos_switches.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 65 | #include "ui/aura/client/aura_constants.h" |
sky | 92d41b24 | 2016-10-27 20:10:16 | [diff] [blame] | 66 | #include "ui/aura/client/drag_drop_client.h" |
[email protected] | 2374d181 | 2014-03-04 03:42:27 | [diff] [blame] | 67 | #include "ui/aura/client/screen_position_client.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 68 | #include "ui/aura/window.h" |
[email protected] | fcc51c95 | 2014-02-21 21:31:26 | [diff] [blame] | 69 | #include "ui/aura/window_event_dispatcher.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 70 | #include "ui/aura/window_observer.h" |
[email protected] | 8b3e3d8 | 2013-08-20 14:36:30 | [diff] [blame] | 71 | #include "ui/aura/window_tracker.h" |
jamescook | 01bf23e7 | 2017-01-09 19:58:15 | [diff] [blame^] | 72 | #include "ui/chromeos/touch_exploration_controller.h" |
kylechar | bc319224 | 2016-11-23 00:51:27 | [diff] [blame] | 73 | #include "ui/display/types/display_constants.h" |
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 74 | #include "ui/keyboard/keyboard_controller.h" |
| 75 | #include "ui/keyboard/keyboard_util.h" |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 76 | #include "ui/views/view_model.h" |
| 77 | #include "ui/views/view_model_utils.h" |
[email protected] | ee3ed1077 | 2014-03-11 22:02:01 | [diff] [blame] | 78 | #include "ui/wm/core/capture_controller.h" |
| 79 | #include "ui/wm/core/visibility_controller.h" |
| 80 | #include "ui/wm/core/window_util.h" |
[email protected] | af4552b2 | 2014-03-21 19:45:01 | [diff] [blame] | 81 | #include "ui/wm/public/tooltip_client.h" |
[email protected] | 5b251f1 | 2013-12-19 01:50:05 | [diff] [blame] | 82 | #include "ui/wm/public/window_types.h" |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 83 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 84 | namespace ash { |
| 85 | namespace { |
| 86 | |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 87 | // Duration for the animation that hides the boot splash screen, in |
| 88 | // milliseconds. This should be short enough in relation to |
| 89 | // wm/window_animation.cc's brightness/grayscale fade animation that the login |
msw | 607227f8 | 2016-08-30 17:22:39 | [diff] [blame] | 90 | // wallpaper image animation isn't hidden by the splash screen animation. |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 91 | const int kBootSplashScreenHideDurationMs = 500; |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 92 | |
oshima | 9a61ecf | 2016-06-18 10:43:05 | [diff] [blame] | 93 | bool IsWindowAboveContainer(aura::Window* window, |
| 94 | aura::Window* blocking_container) { |
| 95 | std::vector<aura::Window*> target_path; |
| 96 | std::vector<aura::Window*> blocking_path; |
| 97 | |
| 98 | while (window) { |
| 99 | target_path.push_back(window); |
| 100 | window = window->parent(); |
| 101 | } |
| 102 | |
| 103 | while (blocking_container) { |
| 104 | blocking_path.push_back(blocking_container); |
| 105 | blocking_container = blocking_container->parent(); |
| 106 | } |
| 107 | |
| 108 | // The root window is put at the end so that we compare windows at |
| 109 | // the same depth. |
| 110 | while (!blocking_path.empty()) { |
| 111 | if (target_path.empty()) |
| 112 | return false; |
| 113 | |
| 114 | aura::Window* target = target_path.back(); |
| 115 | target_path.pop_back(); |
| 116 | aura::Window* blocking = blocking_path.back(); |
| 117 | blocking_path.pop_back(); |
| 118 | |
| 119 | // Still on the same path, continue. |
| 120 | if (target == blocking) |
| 121 | continue; |
| 122 | |
| 123 | // This can happen only if unparented window is passed because |
| 124 | // first element must be the same root. |
| 125 | if (!target->parent() || !blocking->parent()) |
| 126 | return false; |
| 127 | |
| 128 | aura::Window* common_parent = target->parent(); |
| 129 | DCHECK_EQ(common_parent, blocking->parent()); |
| 130 | aura::Window::Windows windows = common_parent->children(); |
| 131 | auto blocking_iter = std::find(windows.begin(), windows.end(), blocking); |
| 132 | // If the target window is above blocking window, the window can handle |
| 133 | // events. |
| 134 | return std::find(blocking_iter, windows.end(), target) != windows.end(); |
| 135 | } |
| 136 | |
| 137 | return true; |
| 138 | } |
| 139 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 140 | } // namespace |
| 141 | |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 142 | void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { |
[email protected] | 2f262033 | 2014-02-28 10:07:38 | [diff] [blame] | 143 | RootWindowController* controller = new RootWindowController(host); |
jamescook | fda15900 | 2016-10-21 18:48:57 | [diff] [blame] | 144 | controller->Init(RootWindowController::PRIMARY); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 145 | } |
| 146 | |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 147 | void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { |
[email protected] | 2f262033 | 2014-02-28 10:07:38 | [diff] [blame] | 148 | RootWindowController* controller = new RootWindowController(host); |
jamescook | fda15900 | 2016-10-21 18:48:57 | [diff] [blame] | 149 | controller->Init(RootWindowController::SECONDARY); |
[email protected] | 608de6c | 2013-10-29 00:14:28 | [diff] [blame] | 150 | } |
| 151 | |
[email protected] | 88d7112 | 2012-10-18 07:11:01 | [diff] [blame] | 152 | // static |
[email protected] | ccff3d7 | 2013-02-06 04:26:28 | [diff] [blame] | 153 | RootWindowController* RootWindowController::ForWindow( |
| 154 | const aura::Window* window) { |
oshima | 9eea82da | 2014-09-13 01:11:07 | [diff] [blame] | 155 | CHECK(Shell::HasInstance()); |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 156 | return GetRootWindowController(window->GetRootWindow()); |
| 157 | } |
| 158 | |
| 159 | // static |
[email protected] | d17642d | 2013-09-12 23:44:38 | [diff] [blame] | 160 | RootWindowController* RootWindowController::ForTargetRootWindow() { |
oshima | 9eea82da | 2014-09-13 01:11:07 | [diff] [blame] | 161 | CHECK(Shell::HasInstance()); |
[email protected] | 093b8d64 | 2014-04-03 20:59:28 | [diff] [blame] | 162 | return GetRootWindowController(Shell::GetTargetRootWindow()); |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 163 | } |
| 164 | |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 165 | RootWindowController::~RootWindowController() { |
| 166 | Shutdown(); |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 167 | ash_host_.reset(); |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 168 | // The CaptureClient needs to be around for as long as the RootWindow is |
| 169 | // valid. |
| 170 | capture_client_.reset(); |
| 171 | } |
| 172 | |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 173 | aura::WindowTreeHost* RootWindowController::GetHost() { |
| 174 | return ash_host_->AsWindowTreeHost(); |
| 175 | } |
| 176 | |
| 177 | const aura::WindowTreeHost* RootWindowController::GetHost() const { |
| 178 | return ash_host_->AsWindowTreeHost(); |
| 179 | } |
| 180 | |
| 181 | aura::Window* RootWindowController::GetRootWindow() { |
| 182 | return GetHost()->window(); |
| 183 | } |
| 184 | |
| 185 | const aura::Window* RootWindowController::GetRootWindow() const { |
| 186 | return GetHost()->window(); |
| 187 | } |
| 188 | |
sky | f71e6c9 | 2016-08-30 18:49:19 | [diff] [blame] | 189 | WorkspaceController* RootWindowController::workspace_controller() { |
sky | d053905c | 2016-08-30 22:37:35 | [diff] [blame] | 190 | return wm_root_window_controller_->workspace_controller(); |
sky | f71e6c9 | 2016-08-30 18:49:19 | [diff] [blame] | 191 | } |
| 192 | |
[email protected] | 6675e1c | 2012-09-11 09:15:45 | [diff] [blame] | 193 | void RootWindowController::Shutdown() { |
sky | 88bd4be6 | 2016-06-09 17:34:41 | [diff] [blame] | 194 | WmShell::Get()->RemoveShellObserver(this); |
[email protected] | a825e831 | 2014-05-05 22:05:01 | [diff] [blame] | 195 | |
sky | 20686a4c5 | 2016-09-13 01:26:54 | [diff] [blame] | 196 | touch_exploration_manager_.reset(); |
[email protected] | d141b92 | 2013-07-09 08:13:17 | [diff] [blame] | 197 | |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 198 | wm_root_window_controller_->ResetRootForNewWindowsIfNecessary(); |
[email protected] | c98a492 | 2013-09-05 20:01:42 | [diff] [blame] | 199 | |
| 200 | CloseChildWindows(); |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 201 | aura::Window* root_window = GetRootWindow(); |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 202 | GetRootWindowSettings(root_window)->controller = NULL; |
[email protected] | 6675e1c | 2012-09-11 09:15:45 | [diff] [blame] | 203 | // Forget with the display ID so that display lookup |
| 204 | // ends up with invalid display. |
kylechar | bc319224 | 2016-11-23 00:51:27 | [diff] [blame] | 205 | GetRootWindowSettings(root_window)->display_id = display::kInvalidDisplayId; |
[email protected] | 8f5209c | 2014-05-22 20:36:11 | [diff] [blame] | 206 | ash_host_->PrepareForShutdown(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 207 | |
msw | 607227f8 | 2016-08-30 17:22:39 | [diff] [blame] | 208 | system_wallpaper_.reset(); |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 209 | aura::client::SetScreenPositionClient(root_window, NULL); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 210 | } |
| 211 | |
oshima | 9a61ecf | 2016-06-18 10:43:05 | [diff] [blame] | 212 | bool RootWindowController::CanWindowReceiveEvents(aura::Window* window) { |
| 213 | if (GetRootWindow() != window->GetRootWindow()) |
| 214 | return false; |
| 215 | |
| 216 | // Always allow events to fall through to the virtual keyboard even if |
| 217 | // displaying a system modal dialog. |
| 218 | if (IsVirtualKeyboardWindow(window)) |
| 219 | return true; |
| 220 | |
| 221 | aura::Window* blocking_container = nullptr; |
| 222 | |
| 223 | int modal_container_id = 0; |
msw | bc0a8b48 | 2016-06-30 02:21:14 | [diff] [blame] | 224 | if (WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked()) { |
oshima | 9a61ecf | 2016-06-18 10:43:05 | [diff] [blame] | 225 | blocking_container = |
| 226 | GetContainer(kShellWindowId_LockScreenContainersContainer); |
| 227 | modal_container_id = kShellWindowId_LockSystemModalContainer; |
| 228 | } else { |
| 229 | modal_container_id = kShellWindowId_SystemModalContainer; |
| 230 | } |
| 231 | aura::Window* modal_container = GetContainer(modal_container_id); |
| 232 | SystemModalContainerLayoutManager* modal_layout_manager = nullptr; |
| 233 | modal_layout_manager = static_cast<SystemModalContainerLayoutManager*>( |
sky | ea4ca94 | 2016-09-12 21:56:19 | [diff] [blame] | 234 | WmWindowAura::Get(modal_container)->GetLayoutManager()); |
oshima | 9a61ecf | 2016-06-18 10:43:05 | [diff] [blame] | 235 | |
sky | b733d418 | 2016-09-09 23:18:38 | [diff] [blame] | 236 | if (modal_layout_manager->has_window_dimmer()) |
oshima | 9a61ecf | 2016-06-18 10:43:05 | [diff] [blame] | 237 | blocking_container = modal_container; |
| 238 | else |
| 239 | modal_container = nullptr; // Don't check modal dialogs. |
| 240 | |
| 241 | // In normal session. |
| 242 | if (!blocking_container) |
| 243 | return true; |
| 244 | |
| 245 | if (!IsWindowAboveContainer(window, blocking_container)) |
| 246 | return false; |
| 247 | |
| 248 | // If the window is in the target modal container, only allow the top most |
| 249 | // one. |
| 250 | if (modal_container && modal_container->Contains(window)) |
sky | ea4ca94 | 2016-09-12 21:56:19 | [diff] [blame] | 251 | return modal_layout_manager->IsPartOfActiveModalWindow( |
| 252 | WmWindowAura::Get(window)); |
oshima | 9a61ecf | 2016-06-18 10:43:05 | [diff] [blame] | 253 | |
| 254 | return true; |
| 255 | } |
| 256 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 257 | aura::Window* RootWindowController::GetContainer(int container_id) { |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 258 | return GetRootWindow()->GetChildById(container_id); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 259 | } |
| 260 | |
[email protected] | d8a2495 | 2013-08-05 20:05:05 | [diff] [blame] | 261 | const aura::Window* RootWindowController::GetContainer(int container_id) const { |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 262 | return ash_host_->AsWindowTreeHost()->window()->GetChildById(container_id); |
[email protected] | d8a2495 | 2013-08-05 20:05:05 | [diff] [blame] | 263 | } |
| 264 | |
msw | 3f439af | 2016-09-08 22:35:26 | [diff] [blame] | 265 | void RootWindowController::OnInitialWallpaperAnimationStarted() { |
pgal.u-szeged | d84534d3 | 2014-10-29 12:34:30 | [diff] [blame] | 266 | if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 267 | switches::kAshAnimateFromBootSplashScreen) && |
| 268 | boot_splash_screen_.get()) { |
msw | 607227f8 | 2016-08-30 17:22:39 | [diff] [blame] | 269 | // Make the splash screen fade out so it doesn't obscure the wallpaper's |
| 270 | // brightness/grayscale animation. |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 271 | boot_splash_screen_->StartHideAnimation( |
| 272 | base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); |
| 273 | } |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 274 | } |
| 275 | |
[email protected] | 0bf6173 | 2013-07-02 04:35:10 | [diff] [blame] | 276 | void RootWindowController::OnWallpaperAnimationFinished(views::Widget* widget) { |
| 277 | // Make sure the wallpaper is visible. |
msw | 607227f8 | 2016-08-30 17:22:39 | [diff] [blame] | 278 | system_wallpaper_->SetColor(SK_ColorBLACK); |
[email protected] | bca9a7e | 2012-11-10 06:25:49 | [diff] [blame] | 279 | boot_splash_screen_.reset(); |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 280 | } |
| 281 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 282 | void RootWindowController::CloseChildWindows() { |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 283 | // Remove observer as deactivating keyboard causes |
| 284 | // docked_window_layout_manager() to fire notifications. |
| 285 | if (docked_window_layout_manager() && |
| 286 | wm_shelf_aura_->shelf_layout_manager()) { |
| 287 | docked_window_layout_manager()->RemoveObserver( |
jamescook | b551aba | 2016-09-01 01:00:16 | [diff] [blame] | 288 | wm_shelf_aura_->shelf_layout_manager()); |
| 289 | } |
[email protected] | 2a57beb5 | 2014-06-09 20:02:26 | [diff] [blame] | 290 | |
[email protected] | b6ba05d90 | 2013-10-04 21:38:45 | [diff] [blame] | 291 | // Deactivate keyboard container before closing child windows and shutting |
| 292 | // down associated layout managers. |
[email protected] | a0b3fb88 | 2014-04-07 19:26:03 | [diff] [blame] | 293 | DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); |
[email protected] | b6ba05d90 | 2013-10-04 21:38:45 | [diff] [blame] | 294 | |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 295 | wm_root_window_controller_->CloseChildWindows(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 296 | |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 297 | aura::client::SetDragDropClient(GetRootWindow(), nullptr); |
| 298 | aura::client::SetTooltipClient(GetRootWindow(), nullptr); |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 299 | } |
| 300 | |
[email protected] | bf9cdb36 | 2013-10-25 19:22:45 | [diff] [blame] | 301 | void RootWindowController::MoveWindowsTo(aura::Window* dst) { |
sky | 7aff7f8d | 2016-09-15 23:34:39 | [diff] [blame] | 302 | wm_root_window_controller_->MoveWindowsTo(WmWindowAura::Get(dst)); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 303 | } |
| 304 | |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 305 | ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
jamescook | b551aba | 2016-09-01 01:00:16 | [diff] [blame] | 306 | return wm_shelf_aura_->shelf_layout_manager(); |
| 307 | } |
| 308 | |
| 309 | StatusAreaWidget* RootWindowController::GetStatusAreaWidget() { |
| 310 | ShelfWidget* shelf_widget = wm_shelf_aura_->shelf_widget(); |
| 311 | return shelf_widget ? shelf_widget->status_area_widget() : nullptr; |
[email protected] | 478c6c3 | 2013-03-09 02:50:58 | [diff] [blame] | 312 | } |
| 313 | |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 314 | SystemTray* RootWindowController::GetSystemTray() { |
| 315 | // We assume in throughout the code that this will not return NULL. If code |
| 316 | // triggers this for valid reasons, it should test status_area_widget first. |
jamescook | b551aba | 2016-09-01 01:00:16 | [diff] [blame] | 317 | CHECK(wm_shelf_aura_->shelf_widget()->status_area_widget()); |
| 318 | return wm_shelf_aura_->shelf_widget()->status_area_widget()->system_tray(); |
[email protected] | a0afeb1 | 2012-12-10 22:57:09 | [diff] [blame] | 319 | } |
| 320 | |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 321 | void RootWindowController::UpdateShelfVisibility() { |
jamescook | b551aba | 2016-09-01 01:00:16 | [diff] [blame] | 322 | wm_shelf_aura_->UpdateVisibilityState(); |
[email protected] | e74aaf0a | 2012-10-12 18:42:28 | [diff] [blame] | 323 | } |
| 324 | |
varkha | d99fa94f | 2015-06-29 22:35:46 | [diff] [blame] | 325 | aura::Window* RootWindowController::GetWindowForFullscreenMode() { |
sky | 0702b27 | 2016-06-03 22:10:41 | [diff] [blame] | 326 | return WmWindowAura::GetAuraWindow( |
| 327 | wm::GetWindowForFullscreenMode(WmWindowAura::Get(GetRootWindow()))); |
[email protected] | 2ee2f5d | 2013-01-10 23:37:16 | [diff] [blame] | 328 | } |
| 329 | |
[email protected] | b6ba05d90 | 2013-10-04 21:38:45 | [diff] [blame] | 330 | void RootWindowController::ActivateKeyboard( |
| 331 | keyboard::KeyboardController* keyboard_controller) { |
| 332 | if (!keyboard::IsKeyboardEnabled() || |
| 333 | GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
| 334 | return; |
| 335 | } |
| 336 | DCHECK(keyboard_controller); |
jamescook | b551aba | 2016-09-01 01:00:16 | [diff] [blame] | 337 | keyboard_controller->AddObserver(wm_shelf_aura_->shelf_layout_manager()); |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 338 | keyboard_controller->AddObserver(panel_layout_manager()); |
| 339 | keyboard_controller->AddObserver(docked_window_layout_manager()); |
sky | f71e6c9 | 2016-08-30 18:49:19 | [diff] [blame] | 340 | keyboard_controller->AddObserver(workspace_controller()->layout_manager()); |
rsadam | 7bd510bb | 2014-12-09 20:10:56 | [diff] [blame] | 341 | keyboard_controller->AddObserver( |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 342 | wm_root_window_controller_->always_on_top_controller() |
| 343 | ->GetLayoutManager()); |
msw | 61e1667 | 2016-08-12 16:36:58 | [diff] [blame] | 344 | WmShell::Get()->NotifyVirtualKeyboardActivated(true); |
bshe | c387542 | 2014-09-29 13:21:30 | [diff] [blame] | 345 | aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
[email protected] | b2da9b60 | 2014-03-05 18:39:52 | [diff] [blame] | 346 | DCHECK(parent); |
jamescook | b8dcef52 | 2016-06-25 14:42:55 | [diff] [blame] | 347 | aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
[email protected] | b6ba05d90 | 2013-10-04 21:38:45 | [diff] [blame] | 348 | keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
| 349 | parent->AddChild(keyboard_container); |
[email protected] | b6ba05d90 | 2013-10-04 21:38:45 | [diff] [blame] | 350 | } |
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 351 | |
[email protected] | b6ba05d90 | 2013-10-04 21:38:45 | [diff] [blame] | 352 | void RootWindowController::DeactivateKeyboard( |
| 353 | keyboard::KeyboardController* keyboard_controller) { |
[email protected] | e1b299b | 2014-01-29 23:53:41 | [diff] [blame] | 354 | if (!keyboard_controller || |
| 355 | !keyboard_controller->keyboard_container_initialized()) { |
[email protected] | b6ba05d90 | 2013-10-04 21:38:45 | [diff] [blame] | 356 | return; |
[email protected] | e1b299b | 2014-01-29 23:53:41 | [diff] [blame] | 357 | } |
jamescook | b8dcef52 | 2016-06-25 14:42:55 | [diff] [blame] | 358 | aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 359 | if (keyboard_container->GetRootWindow() == GetRootWindow()) { |
bshe | c387542 | 2014-09-29 13:21:30 | [diff] [blame] | 360 | aura::Window* parent = |
| 361 | GetContainer(kShellWindowId_ImeWindowParentContainer); |
[email protected] | b2da9b60 | 2014-03-05 18:39:52 | [diff] [blame] | 362 | DCHECK(parent); |
| 363 | parent->RemoveChild(keyboard_container); |
bshe | 9858b4a | 2014-09-16 20:46:38 | [diff] [blame] | 364 | // Virtual keyboard may be deactivated while still showing, notify all |
| 365 | // observers that keyboard bounds changed to 0 before remove them. |
| 366 | keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); |
jamescook | b551aba | 2016-09-01 01:00:16 | [diff] [blame] | 367 | keyboard_controller->RemoveObserver(wm_shelf_aura_->shelf_layout_manager()); |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 368 | keyboard_controller->RemoveObserver(panel_layout_manager()); |
| 369 | keyboard_controller->RemoveObserver(docked_window_layout_manager()); |
bshe | 9858b4a | 2014-09-16 20:46:38 | [diff] [blame] | 370 | keyboard_controller->RemoveObserver( |
sky | f71e6c9 | 2016-08-30 18:49:19 | [diff] [blame] | 371 | workspace_controller()->layout_manager()); |
rsadam | 7bd510bb | 2014-12-09 20:10:56 | [diff] [blame] | 372 | keyboard_controller->RemoveObserver( |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 373 | wm_root_window_controller_->always_on_top_controller() |
| 374 | ->GetLayoutManager()); |
msw | 61e1667 | 2016-08-12 16:36:58 | [diff] [blame] | 375 | WmShell::Get()->NotifyVirtualKeyboardActivated(false); |
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 376 | } |
| 377 | } |
| 378 | |
[email protected] | 602022b | 2014-03-31 17:07:31 | [diff] [blame] | 379 | bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { |
bshe | c387542 | 2014-09-29 13:21:30 | [diff] [blame] | 380 | aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
[email protected] | 602022b | 2014-03-31 17:07:31 | [diff] [blame] | 381 | return parent ? parent->Contains(window) : false; |
| 382 | } |
| 383 | |
dmazzoni | ff86e347 | 2016-06-03 19:52:32 | [diff] [blame] | 384 | void RootWindowController::SetTouchAccessibilityAnchorPoint( |
| 385 | const gfx::Point& anchor_point) { |
dmazzoni | ff86e347 | 2016-06-03 19:52:32 | [diff] [blame] | 386 | if (touch_exploration_manager_) |
| 387 | touch_exploration_manager_->SetTouchAccessibilityAnchorPoint(anchor_point); |
dmazzoni | ff86e347 | 2016-06-03 19:52:32 | [diff] [blame] | 388 | } |
| 389 | |
[email protected] | a4cd6d3 | 2012-09-12 03:42:13 | [diff] [blame] | 390 | //////////////////////////////////////////////////////////////////////////////// |
| 391 | // RootWindowController, private: |
| 392 | |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 393 | RootWindowController::RootWindowController(AshWindowTreeHost* ash_host) |
| 394 | : ash_host_(ash_host), |
jamescook | be6ed82 | 2016-06-06 20:08:55 | [diff] [blame] | 395 | wm_shelf_aura_(new WmShelfAura), |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 396 | touch_hud_debug_(NULL), |
| 397 | touch_hud_projection_(NULL) { |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 398 | aura::Window* root_window = GetRootWindow(); |
| 399 | GetRootWindowSettings(root_window)->controller = this; |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 400 | |
sky | d053905c | 2016-08-30 22:37:35 | [diff] [blame] | 401 | // Has to happen after this is set as |controller| of RootWindowSettings. |
| 402 | wm_root_window_controller_ = WmRootWindowControllerAura::Get(root_window); |
| 403 | |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 404 | stacking_controller_.reset(new StackingController); |
sky | 28f20d6 | 2016-10-20 23:21:59 | [diff] [blame] | 405 | aura::client::SetWindowParentingClient(root_window, |
| 406 | stacking_controller_.get()); |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 407 | capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 408 | } |
| 409 | |
jamescook | fda15900 | 2016-10-21 18:48:57 | [diff] [blame] | 410 | void RootWindowController::Init(RootWindowType root_window_type) { |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 411 | aura::Window* root_window = GetRootWindow(); |
[email protected] | 51f43811 | 2013-11-18 19:32:50 | [diff] [blame] | 412 | Shell* shell = Shell::GetInstance(); |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 413 | shell->InitRootWindow(root_window); |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 414 | |
sky | d053905c | 2016-08-30 22:37:35 | [diff] [blame] | 415 | wm_root_window_controller_->CreateContainers(); |
[email protected] | 608de6c | 2013-10-29 00:14:28 | [diff] [blame] | 416 | |
jamescook | fda15900 | 2016-10-21 18:48:57 | [diff] [blame] | 417 | CreateSystemWallpaper(root_window_type); |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 418 | |
| 419 | InitLayoutManagers(); |
| 420 | InitTouchHuds(); |
| 421 | |
sky | ea4ca94 | 2016-09-12 21:56:19 | [diff] [blame] | 422 | if (WmShell::Get() |
| 423 | ->GetPrimaryRootWindowController() |
sky | b733d418 | 2016-09-09 23:18:38 | [diff] [blame] | 424 | ->GetSystemModalLayoutManager(nullptr) |
| 425 | ->has_window_dimmer()) { |
sky | ea4ca94 | 2016-09-12 21:56:19 | [diff] [blame] | 426 | wm_root_window_controller_->GetSystemModalLayoutManager(nullptr) |
| 427 | ->CreateModalBackground(); |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 428 | } |
| 429 | |
sky | 88bd4be6 | 2016-06-09 17:34:41 | [diff] [blame] | 430 | WmShell::Get()->AddShellObserver(this); |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 431 | |
sky | d053905c | 2016-08-30 22:37:35 | [diff] [blame] | 432 | wm_root_window_controller_->root_window_layout_manager()->OnWindowResized(); |
[email protected] | 608de6c | 2013-10-29 00:14:28 | [diff] [blame] | 433 | if (root_window_type == PRIMARY) { |
bshe | 9858b4a | 2014-09-16 20:46:38 | [diff] [blame] | 434 | shell->InitKeyboard(); |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 435 | } else { |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 436 | ash_host_->AsWindowTreeHost()->Show(); |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 437 | |
[email protected] | 864b5855 | 2013-12-19 04:19:38 | [diff] [blame] | 438 | // Create a shelf if a user is already logged in. |
msw | bc0a8b48 | 2016-06-30 02:21:14 | [diff] [blame] | 439 | if (WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers()) |
sky | d52346b | 2016-10-07 15:43:50 | [diff] [blame] | 440 | wm_root_window_controller_->CreateShelf(); |
[email protected] | 0e3e7cb | 2014-04-12 05:18:25 | [diff] [blame] | 441 | |
| 442 | // Notify shell observers about new root window. |
sky | 80556bc4 | 2016-06-07 22:46:13 | [diff] [blame] | 443 | shell->OnRootWindowAdded(WmWindowAura::Get(root_window)); |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 444 | } |
[email protected] | a825e831 | 2014-05-05 22:05:01 | [diff] [blame] | 445 | |
pgal.u-szeged | d84534d3 | 2014-10-29 12:34:30 | [diff] [blame] | 446 | if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
[email protected] | 2e0b235 | 2014-07-28 13:28:28 | [diff] [blame] | 447 | switches::kAshDisableTouchExplorationMode)) { |
[email protected] | 7d48759 | 2014-07-24 03:54:50 | [diff] [blame] | 448 | touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); |
[email protected] | a825e831 | 2014-05-05 22:05:01 | [diff] [blame] | 449 | } |
[email protected] | a273d33a | 2013-10-17 12:41:21 | [diff] [blame] | 450 | } |
| 451 | |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 452 | void RootWindowController::InitLayoutManagers() { |
jamescook | 752e8df | 2016-08-09 19:54:39 | [diff] [blame] | 453 | // Create the shelf and status area widgets. |
jamescook | b551aba | 2016-09-01 01:00:16 | [diff] [blame] | 454 | DCHECK(!wm_shelf_aura_->shelf_widget()); |
jamescook | 752e8df | 2016-08-09 19:54:39 | [diff] [blame] | 455 | aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); |
| 456 | aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); |
| 457 | WmWindow* wm_shelf_container = WmWindowAura::Get(shelf_container); |
| 458 | WmWindow* wm_status_container = WmWindowAura::Get(status_container); |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 459 | |
| 460 | wm_root_window_controller_->CreateLayoutManagers(); |
jamescook | b551aba | 2016-09-01 01:00:16 | [diff] [blame] | 461 | |
jamescook | 752e8df | 2016-08-09 19:54:39 | [diff] [blame] | 462 | // Make it easier to resize windows that partially overlap the shelf. Must |
| 463 | // occur after the ShelfLayoutManager is constructed by ShelfWidget. |
| 464 | shelf_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( |
| 465 | wm_shelf_container, wm_shelf_aura_.get())); |
| 466 | status_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( |
| 467 | wm_status_container, wm_shelf_aura_.get())); |
| 468 | |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 469 | panel_container_handler_ = base::MakeUnique<PanelWindowEventHandler>(); |
| 470 | GetContainer(kShellWindowId_PanelContainer) |
| 471 | ->AddPreTargetHandler(panel_container_handler_.get()); |
[email protected] | b8642ec | 2014-04-17 05:20:39 | [diff] [blame] | 472 | |
| 473 | // Install an AttachedPanelWindowTargeter on the panel container to make it |
| 474 | // easier to correctly target shelf buttons with touch. |
jamescook | b8dcef52 | 2016-06-25 14:42:55 | [diff] [blame] | 475 | gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize, |
[email protected] | b8642ec | 2014-04-17 05:20:39 | [diff] [blame] | 476 | -kResizeOutsideBoundsSize, |
| 477 | -kResizeOutsideBoundsSize); |
jamescook | b8dcef52 | 2016-06-25 14:42:55 | [diff] [blame] | 478 | gfx::Insets touch_extend = |
| 479 | mouse_extend.Scale(kResizeOutsideBoundsScaleForTouch); |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 480 | aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer); |
| 481 | panel_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( |
| 482 | new AttachedPanelWindowTargeter(panel_container, mouse_extend, |
| 483 | touch_extend, panel_layout_manager()))); |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | void RootWindowController::InitTouchHuds() { |
pgal.u-szeged | d84534d3 | 2014-10-29 12:34:30 | [diff] [blame] | 487 | base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 488 | if (command_line->HasSwitch(switches::kAshTouchHud)) |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 489 | set_touch_hud_debug(new TouchHudDebug(GetRootWindow())); |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 490 | if (Shell::GetInstance()->is_touch_hud_projection_enabled()) |
| 491 | EnableTouchHudProjection(); |
| 492 | } |
| 493 | |
jamescook | fda15900 | 2016-10-21 18:48:57 | [diff] [blame] | 494 | void RootWindowController::CreateSystemWallpaper( |
| 495 | RootWindowType root_window_type) { |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 496 | SkColor color = SK_ColorBLACK; |
jamescook | fda15900 | 2016-10-21 18:48:57 | [diff] [blame] | 497 | // The splash screen appears on the primary display at boot. If this is a |
| 498 | // secondary monitor (either connected at boot or connected later) or if the |
| 499 | // browser restarted for a second login then don't use the boot color. |
| 500 | const bool is_boot_splash_screen = |
| 501 | root_window_type == PRIMARY && |
| 502 | base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 503 | chromeos::switches::kFirstExecAfterBoot); |
| 504 | if (is_boot_splash_screen) |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 505 | color = kChromeOsBootColor; |
msw | 607227f8 | 2016-08-30 17:22:39 | [diff] [blame] | 506 | system_wallpaper_.reset( |
| 507 | new SystemWallpaperController(GetRootWindow(), color)); |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 508 | |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 509 | // Make a copy of the system's boot splash screen so we can composite it |
msw | 607227f8 | 2016-08-30 17:22:39 | [diff] [blame] | 510 | // onscreen until the wallpaper is ready. |
jamescook | fda15900 | 2016-10-21 18:48:57 | [diff] [blame] | 511 | if (is_boot_splash_screen && |
pgal.u-szeged | d84534d3 | 2014-10-29 12:34:30 | [diff] [blame] | 512 | (base::CommandLine::ForCurrentProcess()->HasSwitch( |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 513 | switches::kAshCopyHostBackgroundAtBoot) || |
pgal.u-szeged | d84534d3 | 2014-10-29 12:34:30 | [diff] [blame] | 514 | base::CommandLine::ForCurrentProcess()->HasSwitch( |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 515 | switches::kAshAnimateFromBootSplashScreen))) |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 516 | boot_splash_screen_.reset(new BootSplashScreen(GetHost())); |
[email protected] | 756bda1 | 2013-07-03 08:17:06 | [diff] [blame] | 517 | } |
| 518 | |
[email protected] | d141b92 | 2013-07-09 08:13:17 | [diff] [blame] | 519 | void RootWindowController::EnableTouchHudProjection() { |
| 520 | if (touch_hud_projection_) |
| 521 | return; |
[email protected] | f5c9dbc | 2014-04-11 08:13:45 | [diff] [blame] | 522 | set_touch_hud_projection(new TouchHudProjection(GetRootWindow())); |
[email protected] | d141b92 | 2013-07-09 08:13:17 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | void RootWindowController::DisableTouchHudProjection() { |
| 526 | if (!touch_hud_projection_) |
| 527 | return; |
| 528 | touch_hud_projection_->Remove(); |
| 529 | } |
| 530 | |
sky | 8d971a0a | 2016-09-21 23:37:57 | [diff] [blame] | 531 | DockedWindowLayoutManager* |
| 532 | RootWindowController::docked_window_layout_manager() { |
| 533 | return wm_root_window_controller_->docked_window_layout_manager(); |
| 534 | } |
| 535 | |
| 536 | PanelLayoutManager* RootWindowController::panel_layout_manager() { |
| 537 | return wm_root_window_controller_->panel_layout_manager(); |
| 538 | } |
| 539 | |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 540 | void RootWindowController::OnLoginStateChanged(LoginStatus status) { |
jamescook | b551aba | 2016-09-01 01:00:16 | [diff] [blame] | 541 | wm_shelf_aura_->UpdateVisibilityState(); |
[email protected] | d141b92 | 2013-07-09 08:13:17 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
| 545 | if (enabled) |
| 546 | EnableTouchHudProjection(); |
| 547 | else |
| 548 | DisableTouchHudProjection(); |
| 549 | } |
| 550 | |
jamescook | b8dcef52 | 2016-06-25 14:42:55 | [diff] [blame] | 551 | RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
msw | 15156bf | 2016-09-13 21:49:17 | [diff] [blame] | 552 | return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
[email protected] | 6b2d4a0b | 2013-09-06 06:29:54 | [diff] [blame] | 553 | } |
| 554 | |
[email protected] | d90b839 | 2012-06-13 09:34:56 | [diff] [blame] | 555 | } // namespace ash |