OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_touch_exploration_manager_chromeos.h" | 10 #include "ash/ash_touch_exploration_manager_chromeos.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ash/common/shell_delegate.h" | 22 #include "ash/common/shell_delegate.h" |
23 #include "ash/common/system/status_area_layout_manager.h" | 23 #include "ash/common/system/status_area_layout_manager.h" |
24 #include "ash/common/system/status_area_widget.h" | 24 #include "ash/common/system/status_area_widget.h" |
25 #include "ash/common/system/tray/system_tray_delegate.h" | 25 #include "ash/common/system/tray/system_tray_delegate.h" |
26 #include "ash/common/wallpaper/wallpaper_delegate.h" | 26 #include "ash/common/wallpaper/wallpaper_delegate.h" |
27 #include "ash/common/wallpaper/wallpaper_widget_controller.h" | 27 #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
28 #include "ash/common/wm/always_on_top_controller.h" | 28 #include "ash/common/wm/always_on_top_controller.h" |
29 #include "ash/common/wm/container_finder.h" | 29 #include "ash/common/wm/container_finder.h" |
30 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 30 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
31 #include "ash/common/wm/fullscreen_window_finder.h" | 31 #include "ash/common/wm/fullscreen_window_finder.h" |
| 32 #include "ash/common/wm/lock_layout_manager.h" |
32 #include "ash/common/wm/panels/panel_layout_manager.h" | 33 #include "ash/common/wm/panels/panel_layout_manager.h" |
33 #include "ash/common/wm/root_window_layout_manager.h" | 34 #include "ash/common/wm/root_window_layout_manager.h" |
34 #include "ash/common/wm/switchable_windows.h" | 35 #include "ash/common/wm/switchable_windows.h" |
35 #include "ash/common/wm/system_modal_container_layout_manager.h" | 36 #include "ash/common/wm/system_modal_container_layout_manager.h" |
36 #include "ash/common/wm/window_state.h" | 37 #include "ash/common/wm/window_state.h" |
37 #include "ash/common/wm/workspace/workspace_layout_manager.h" | 38 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
38 #include "ash/common/wm/workspace_controller.h" | 39 #include "ash/common/wm/workspace_controller.h" |
39 #include "ash/common/wm_root_window_controller.h" | |
40 #include "ash/common/wm_shell.h" | 40 #include "ash/common/wm_shell.h" |
41 #include "ash/common/wm_window.h" | 41 #include "ash/common/wm_window.h" |
42 #include "ash/high_contrast/high_contrast_controller.h" | 42 #include "ash/high_contrast/high_contrast_controller.h" |
43 #include "ash/host/ash_window_tree_host.h" | 43 #include "ash/host/ash_window_tree_host.h" |
44 #include "ash/public/cpp/shelf_types.h" | 44 #include "ash/public/cpp/shelf_types.h" |
45 #include "ash/public/cpp/shell_window_ids.h" | 45 #include "ash/public/cpp/shell_window_ids.h" |
46 #include "ash/root_window_settings.h" | 46 #include "ash/root_window_settings.h" |
47 #include "ash/shelf/shelf_window_targeter.h" | 47 #include "ash/shelf/shelf_window_targeter.h" |
48 #include "ash/shell.h" | 48 #include "ash/shell.h" |
49 #include "ash/touch/touch_hud_debug.h" | 49 #include "ash/touch/touch_hud_debug.h" |
50 #include "ash/touch/touch_hud_projection.h" | 50 #include "ash/touch/touch_hud_projection.h" |
51 #include "ash/touch/touch_observer_hud.h" | 51 #include "ash/touch/touch_observer_hud.h" |
52 #include "ash/wm/boot_splash_screen_chromeos.h" | 52 #include "ash/wm/boot_splash_screen_chromeos.h" |
53 #include "ash/wm/panels/attached_panel_window_targeter.h" | 53 #include "ash/wm/panels/attached_panel_window_targeter.h" |
54 #include "ash/wm/panels/panel_window_event_handler.h" | 54 #include "ash/wm/panels/panel_window_event_handler.h" |
55 #include "ash/wm/stacking_controller.h" | 55 #include "ash/wm/stacking_controller.h" |
56 #include "ash/wm/system_wallpaper_controller.h" | 56 #include "ash/wm/system_wallpaper_controller.h" |
57 #include "ash/wm/window_properties.h" | 57 #include "ash/wm/window_properties.h" |
58 #include "ash/wm/window_state_aura.h" | 58 #include "ash/wm/window_state_aura.h" |
59 #include "ash/wm/window_util.h" | 59 #include "ash/wm/window_util.h" |
60 #include "base/command_line.h" | 60 #include "base/command_line.h" |
61 #include "base/macros.h" | 61 #include "base/macros.h" |
62 #include "base/memory/ptr_util.h" | 62 #include "base/memory/ptr_util.h" |
63 #include "base/time/time.h" | 63 #include "base/time/time.h" |
64 #include "chromeos/chromeos_switches.h" | 64 #include "chromeos/chromeos_switches.h" |
65 #include "ui/aura/client/aura_constants.h" | 65 #include "ui/aura/client/aura_constants.h" |
66 #include "ui/aura/client/drag_drop_client.h" | 66 #include "ui/aura/client/drag_drop_client.h" |
67 #include "ui/aura/client/screen_position_client.h" | 67 #include "ui/aura/client/screen_position_client.h" |
| 68 #include "ui/aura/mus/window_mus.h" |
| 69 #include "ui/aura/mus/window_tree_client.h" |
68 #include "ui/aura/window.h" | 70 #include "ui/aura/window.h" |
69 #include "ui/aura/window_event_dispatcher.h" | 71 #include "ui/aura/window_event_dispatcher.h" |
70 #include "ui/aura/window_observer.h" | 72 #include "ui/aura/window_observer.h" |
71 #include "ui/aura/window_tracker.h" | 73 #include "ui/aura/window_tracker.h" |
| 74 #include "ui/base/models/menu_model.h" |
72 #include "ui/chromeos/touch_exploration_controller.h" | 75 #include "ui/chromeos/touch_exploration_controller.h" |
73 #include "ui/display/types/display_constants.h" | 76 #include "ui/display/types/display_constants.h" |
| 77 #include "ui/events/event_utils.h" |
74 #include "ui/keyboard/keyboard_controller.h" | 78 #include "ui/keyboard/keyboard_controller.h" |
75 #include "ui/keyboard/keyboard_util.h" | 79 #include "ui/keyboard/keyboard_util.h" |
| 80 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 81 #include "ui/views/controls/menu/menu_runner.h" |
76 #include "ui/views/view_model.h" | 82 #include "ui/views/view_model.h" |
77 #include "ui/views/view_model_utils.h" | 83 #include "ui/views/view_model_utils.h" |
78 #include "ui/wm/core/capture_controller.h" | 84 #include "ui/wm/core/capture_controller.h" |
| 85 #include "ui/wm/core/coordinate_conversion.h" |
79 #include "ui/wm/core/visibility_controller.h" | 86 #include "ui/wm/core/visibility_controller.h" |
80 #include "ui/wm/core/window_util.h" | 87 #include "ui/wm/core/window_util.h" |
81 #include "ui/wm/public/tooltip_client.h" | 88 #include "ui/wm/public/tooltip_client.h" |
82 #include "ui/wm/public/window_types.h" | 89 #include "ui/wm/public/window_types.h" |
83 | 90 |
84 namespace ash { | 91 namespace ash { |
85 namespace { | 92 namespace { |
86 | 93 |
87 // Duration for the animation that hides the boot splash screen, in | 94 // Duration for the animation that hides the boot splash screen, in |
88 // milliseconds. This should be short enough in relation to | 95 // milliseconds. This should be short enough in relation to |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 146 |
140 } // namespace | 147 } // namespace |
141 | 148 |
142 RootWindowController::~RootWindowController() { | 149 RootWindowController::~RootWindowController() { |
143 Shutdown(); | 150 Shutdown(); |
144 ash_host_.reset(); | 151 ash_host_.reset(); |
145 mus_window_tree_host_.reset(); | 152 mus_window_tree_host_.reset(); |
146 // The CaptureClient needs to be around for as long as the RootWindow is | 153 // The CaptureClient needs to be around for as long as the RootWindow is |
147 // valid. | 154 // valid. |
148 capture_client_.reset(); | 155 capture_client_.reset(); |
| 156 if (animating_wallpaper_widget_controller_.get()) |
| 157 animating_wallpaper_widget_controller_->StopAnimating(); |
149 } | 158 } |
150 | 159 |
151 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { | 160 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { |
152 RootWindowController* controller = new RootWindowController(host, nullptr); | 161 RootWindowController* controller = new RootWindowController(host, nullptr); |
153 controller->Init(RootWindowType::PRIMARY); | 162 controller->Init(RootWindowType::PRIMARY); |
154 } | 163 } |
155 | 164 |
156 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { | 165 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { |
157 RootWindowController* controller = new RootWindowController(host, nullptr); | 166 RootWindowController* controller = new RootWindowController(host, nullptr); |
158 controller->Init(RootWindowType::SECONDARY); | 167 controller->Init(RootWindowType::SECONDARY); |
(...skipping 23 matching lines...) Expand all Loading... |
182 } | 191 } |
183 | 192 |
184 aura::Window* RootWindowController::GetRootWindow() { | 193 aura::Window* RootWindowController::GetRootWindow() { |
185 return GetHost()->window(); | 194 return GetHost()->window(); |
186 } | 195 } |
187 | 196 |
188 const aura::Window* RootWindowController::GetRootWindow() const { | 197 const aura::Window* RootWindowController::GetRootWindow() const { |
189 return GetHost()->window(); | 198 return GetHost()->window(); |
190 } | 199 } |
191 | 200 |
192 WorkspaceController* RootWindowController::workspace_controller() { | |
193 return wm_root_window_controller_->workspace_controller(); | |
194 } | |
195 | |
196 void RootWindowController::Shutdown() { | 201 void RootWindowController::Shutdown() { |
197 WmShell::Get()->RemoveShellObserver(this); | 202 WmShell::Get()->RemoveShellObserver(this); |
198 | 203 |
199 touch_exploration_manager_.reset(); | 204 touch_exploration_manager_.reset(); |
200 | 205 |
201 wm_root_window_controller_->ResetRootForNewWindowsIfNecessary(); | 206 ResetRootForNewWindowsIfNecessary(); |
202 | 207 |
203 CloseChildWindows(); | 208 CloseChildWindows(); |
204 aura::Window* root_window = GetRootWindow(); | 209 aura::Window* root_window = GetRootWindow(); |
205 GetRootWindowSettings(root_window)->controller = NULL; | 210 GetRootWindowSettings(root_window)->controller = NULL; |
206 // Forget with the display ID so that display lookup | 211 // Forget with the display ID so that display lookup |
207 // ends up with invalid display. | 212 // ends up with invalid display. |
208 GetRootWindowSettings(root_window)->display_id = display::kInvalidDisplayId; | 213 GetRootWindowSettings(root_window)->display_id = display::kInvalidDisplayId; |
209 if (ash_host_) | 214 if (ash_host_) |
210 ash_host_->PrepareForShutdown(); | 215 ash_host_->PrepareForShutdown(); |
211 | 216 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // brightness/grayscale animation. | 279 // brightness/grayscale animation. |
275 boot_splash_screen_->StartHideAnimation( | 280 boot_splash_screen_->StartHideAnimation( |
276 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); | 281 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); |
277 } | 282 } |
278 } | 283 } |
279 | 284 |
280 void RootWindowController::OnWallpaperAnimationFinished(views::Widget* widget) { | 285 void RootWindowController::OnWallpaperAnimationFinished(views::Widget* widget) { |
281 // Make sure the wallpaper is visible. | 286 // Make sure the wallpaper is visible. |
282 system_wallpaper_->SetColor(SK_ColorBLACK); | 287 system_wallpaper_->SetColor(SK_ColorBLACK); |
283 boot_splash_screen_.reset(); | 288 boot_splash_screen_.reset(); |
| 289 WmShell::Get()->wallpaper_delegate()->OnWallpaperAnimationFinished(); |
| 290 // Only removes old component when wallpaper animation finished. If we |
| 291 // remove the old one before the new wallpaper is done fading in there will |
| 292 // be a white flash during the animation. |
| 293 if (animating_wallpaper_widget_controller()) { |
| 294 WallpaperWidgetController* controller = |
| 295 animating_wallpaper_widget_controller()->GetController(true); |
| 296 DCHECK_EQ(controller->widget(), widget); |
| 297 // Release the old controller and close its wallpaper widget. |
| 298 SetWallpaperWidgetController(controller); |
| 299 } |
284 } | 300 } |
285 | 301 |
286 void RootWindowController::CloseChildWindows() { | 302 void RootWindowController::CloseChildWindows() { |
287 // Remove observer as deactivating keyboard causes | 303 // Remove observer as deactivating keyboard causes |
288 // docked_window_layout_manager() to fire notifications. | 304 // docked_window_layout_manager() to fire notifications. |
289 if (docked_window_layout_manager() && wm_shelf_->shelf_layout_manager()) { | 305 if (docked_window_layout_manager() && wm_shelf_->shelf_layout_manager()) { |
290 docked_window_layout_manager()->RemoveObserver( | 306 docked_window_layout_manager()->RemoveObserver( |
291 wm_shelf_->shelf_layout_manager()); | 307 wm_shelf_->shelf_layout_manager()); |
292 } | 308 } |
293 | 309 |
294 // Deactivate keyboard container before closing child windows and shutting | 310 // Deactivate keyboard container before closing child windows and shutting |
295 // down associated layout managers. | 311 // down associated layout managers. |
296 DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); | 312 DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); |
297 | 313 |
298 wm_root_window_controller_->CloseChildWindows(); | 314 CloseChildWindowsImpl(); |
299 | 315 |
300 aura::client::SetDragDropClient(GetRootWindow(), nullptr); | 316 aura::client::SetDragDropClient(GetRootWindow(), nullptr); |
301 aura::client::SetTooltipClient(GetRootWindow(), nullptr); | 317 aura::client::SetTooltipClient(GetRootWindow(), nullptr); |
302 } | 318 } |
303 | 319 |
304 void RootWindowController::MoveWindowsTo(aura::Window* dst) { | |
305 wm_root_window_controller_->MoveWindowsTo(WmWindowAura::Get(dst)); | |
306 } | |
307 | |
308 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { | 320 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
309 return wm_shelf_->shelf_layout_manager(); | 321 return wm_shelf_->shelf_layout_manager(); |
310 } | 322 } |
311 | 323 |
312 StatusAreaWidget* RootWindowController::GetStatusAreaWidget() { | 324 StatusAreaWidget* RootWindowController::GetStatusAreaWidget() { |
313 ShelfWidget* shelf_widget = wm_shelf_->shelf_widget(); | 325 ShelfWidget* shelf_widget = wm_shelf_->shelf_widget(); |
314 return shelf_widget ? shelf_widget->status_area_widget() : nullptr; | 326 return shelf_widget ? shelf_widget->status_area_widget() : nullptr; |
315 } | 327 } |
316 | 328 |
317 SystemTray* RootWindowController::GetSystemTray() { | 329 SystemTray* RootWindowController::GetSystemTray() { |
(...skipping 17 matching lines...) Expand all Loading... |
335 if (!keyboard::IsKeyboardEnabled() || | 347 if (!keyboard::IsKeyboardEnabled() || |
336 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 348 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
337 return; | 349 return; |
338 } | 350 } |
339 DCHECK(keyboard_controller); | 351 DCHECK(keyboard_controller); |
340 keyboard_controller->AddObserver(wm_shelf_->shelf_layout_manager()); | 352 keyboard_controller->AddObserver(wm_shelf_->shelf_layout_manager()); |
341 keyboard_controller->AddObserver(panel_layout_manager()); | 353 keyboard_controller->AddObserver(panel_layout_manager()); |
342 keyboard_controller->AddObserver(docked_window_layout_manager()); | 354 keyboard_controller->AddObserver(docked_window_layout_manager()); |
343 keyboard_controller->AddObserver(workspace_controller()->layout_manager()); | 355 keyboard_controller->AddObserver(workspace_controller()->layout_manager()); |
344 keyboard_controller->AddObserver( | 356 keyboard_controller->AddObserver( |
345 wm_root_window_controller_->always_on_top_controller() | 357 always_on_top_controller_->GetLayoutManager()); |
346 ->GetLayoutManager()); | |
347 WmShell::Get()->NotifyVirtualKeyboardActivated(true); | 358 WmShell::Get()->NotifyVirtualKeyboardActivated(true); |
348 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 359 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
349 DCHECK(parent); | 360 DCHECK(parent); |
350 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); | 361 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
351 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 362 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
352 parent->AddChild(keyboard_container); | 363 parent->AddChild(keyboard_container); |
353 } | 364 } |
354 | 365 |
355 void RootWindowController::DeactivateKeyboard( | 366 void RootWindowController::DeactivateKeyboard( |
356 keyboard::KeyboardController* keyboard_controller) { | 367 keyboard::KeyboardController* keyboard_controller) { |
357 if (!keyboard_controller || | 368 if (!keyboard_controller || |
358 !keyboard_controller->keyboard_container_initialized()) { | 369 !keyboard_controller->keyboard_container_initialized()) { |
359 return; | 370 return; |
360 } | 371 } |
361 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); | 372 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
362 if (keyboard_container->GetRootWindow() == GetRootWindow()) { | 373 if (keyboard_container->GetRootWindow() == GetRootWindow()) { |
363 aura::Window* parent = | 374 aura::Window* parent = |
364 GetContainer(kShellWindowId_ImeWindowParentContainer); | 375 GetContainer(kShellWindowId_ImeWindowParentContainer); |
365 DCHECK(parent); | 376 DCHECK(parent); |
366 parent->RemoveChild(keyboard_container); | 377 parent->RemoveChild(keyboard_container); |
367 // Virtual keyboard may be deactivated while still showing, notify all | 378 // Virtual keyboard may be deactivated while still showing, notify all |
368 // observers that keyboard bounds changed to 0 before remove them. | 379 // observers that keyboard bounds changed to 0 before remove them. |
369 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); | 380 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); |
370 keyboard_controller->RemoveObserver(wm_shelf_->shelf_layout_manager()); | 381 keyboard_controller->RemoveObserver(wm_shelf_->shelf_layout_manager()); |
371 keyboard_controller->RemoveObserver(panel_layout_manager()); | 382 keyboard_controller->RemoveObserver(panel_layout_manager()); |
372 keyboard_controller->RemoveObserver(docked_window_layout_manager()); | 383 keyboard_controller->RemoveObserver(docked_window_layout_manager()); |
373 keyboard_controller->RemoveObserver( | 384 keyboard_controller->RemoveObserver( |
374 workspace_controller()->layout_manager()); | 385 workspace_controller()->layout_manager()); |
375 keyboard_controller->RemoveObserver( | 386 keyboard_controller->RemoveObserver( |
376 wm_root_window_controller_->always_on_top_controller() | 387 always_on_top_controller_->GetLayoutManager()); |
377 ->GetLayoutManager()); | |
378 WmShell::Get()->NotifyVirtualKeyboardActivated(false); | 388 WmShell::Get()->NotifyVirtualKeyboardActivated(false); |
379 } | 389 } |
380 } | 390 } |
381 | 391 |
382 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { | 392 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { |
383 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 393 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
384 return parent ? parent->Contains(window) : false; | 394 return parent ? parent->Contains(window) : false; |
385 } | 395 } |
386 | 396 |
387 void RootWindowController::SetTouchAccessibilityAnchorPoint( | 397 void RootWindowController::SetTouchAccessibilityAnchorPoint( |
(...skipping 12 matching lines...) Expand all Loading... |
400 mus_window_tree_host_(window_tree_host), | 410 mus_window_tree_host_(window_tree_host), |
401 window_tree_host_(ash_host ? ash_host->AsWindowTreeHost() | 411 window_tree_host_(ash_host ? ash_host->AsWindowTreeHost() |
402 : window_tree_host), | 412 : window_tree_host), |
403 wm_shelf_(base::MakeUnique<WmShelf>()), | 413 wm_shelf_(base::MakeUnique<WmShelf>()), |
404 touch_hud_debug_(NULL), | 414 touch_hud_debug_(NULL), |
405 touch_hud_projection_(NULL) { | 415 touch_hud_projection_(NULL) { |
406 DCHECK((ash_host && !window_tree_host) || (!ash_host && window_tree_host)); | 416 DCHECK((ash_host && !window_tree_host) || (!ash_host && window_tree_host)); |
407 aura::Window* root_window = GetRootWindow(); | 417 aura::Window* root_window = GetRootWindow(); |
408 GetRootWindowSettings(root_window)->controller = this; | 418 GetRootWindowSettings(root_window)->controller = this; |
409 | 419 |
410 // Has to happen after this is set as |controller| of RootWindowSettings. | |
411 wm_root_window_controller_ = base::MakeUnique<WmRootWindowController>( | |
412 this, WmWindowAura::Get(root_window)); | |
413 | |
414 stacking_controller_.reset(new StackingController); | 420 stacking_controller_.reset(new StackingController); |
415 aura::client::SetWindowParentingClient(root_window, | 421 aura::client::SetWindowParentingClient(root_window, |
416 stacking_controller_.get()); | 422 stacking_controller_.get()); |
417 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); | 423 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); |
418 } | 424 } |
419 | 425 |
420 void RootWindowController::Init(RootWindowType root_window_type) { | 426 void RootWindowController::Init(RootWindowType root_window_type) { |
421 aura::Window* root_window = GetRootWindow(); | 427 aura::Window* root_window = GetRootWindow(); |
422 WmShell* wm_shell = WmShell::Get(); | 428 WmShell* wm_shell = WmShell::Get(); |
423 Shell* shell = nullptr; | 429 Shell* shell = nullptr; |
424 if (!wm_shell->IsRunningInMash()) { | 430 if (!wm_shell->IsRunningInMash()) { |
425 shell = Shell::GetInstance(); | 431 shell = Shell::GetInstance(); |
426 shell->InitRootWindow(root_window); | 432 shell->InitRootWindow(root_window); |
427 } | 433 } |
428 | 434 |
429 wm_root_window_controller_->CreateContainers(); | 435 CreateContainers(); |
430 | 436 |
431 CreateSystemWallpaper(root_window_type); | 437 CreateSystemWallpaper(root_window_type); |
432 | 438 |
433 InitLayoutManagers(); | 439 InitLayoutManagers(); |
434 InitTouchHuds(); | 440 InitTouchHuds(); |
435 | 441 |
436 if (wm_shell->GetPrimaryRootWindowController() | 442 if (wm_shell->GetPrimaryRootWindowController() |
437 ->GetSystemModalLayoutManager(nullptr) | 443 ->GetSystemModalLayoutManager(nullptr) |
438 ->has_window_dimmer()) { | 444 ->has_window_dimmer()) { |
439 wm_root_window_controller_->GetSystemModalLayoutManager(nullptr) | 445 GetSystemModalLayoutManager(nullptr)->CreateModalBackground(); |
440 ->CreateModalBackground(); | |
441 } | 446 } |
442 | 447 |
443 wm_shell->AddShellObserver(this); | 448 wm_shell->AddShellObserver(this); |
444 | 449 |
445 wm_root_window_controller_->root_window_layout_manager()->OnWindowResized(); | 450 root_window_layout_manager_->OnWindowResized(); |
446 if (root_window_type == RootWindowType::PRIMARY) { | 451 if (root_window_type == RootWindowType::PRIMARY) { |
447 if (!wm_shell->IsRunningInMash()) | 452 if (!wm_shell->IsRunningInMash()) |
448 shell->InitKeyboard(); | 453 shell->InitKeyboard(); |
449 } else { | 454 } else { |
450 window_tree_host_->Show(); | 455 window_tree_host_->Show(); |
451 | 456 |
452 // Create a shelf if a user is already logged in. | 457 // Create a shelf if a user is already logged in. |
453 if (wm_shell->GetSessionStateDelegate()->NumberOfLoggedInUsers()) | 458 if (wm_shell->GetSessionStateDelegate()->NumberOfLoggedInUsers()) |
454 wm_root_window_controller_->CreateShelf(); | 459 CreateShelf(); |
455 | 460 |
456 // Notify shell observers about new root window. | 461 // Notify shell observers about new root window. |
457 if (!wm_shell->IsRunningInMash()) | 462 if (!wm_shell->IsRunningInMash()) |
458 shell->OnRootWindowAdded(WmWindowAura::Get(root_window)); | 463 shell->OnRootWindowAdded(WmWindowAura::Get(root_window)); |
459 } | 464 } |
460 | 465 |
461 // TODO: AshTouchExplorationManager doesn't work with mus. | 466 // TODO: AshTouchExplorationManager doesn't work with mus. |
462 // http://crbug.com/679782 | 467 // http://crbug.com/679782 |
463 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 468 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
464 switches::kAshDisableTouchExplorationMode) && | 469 switches::kAshDisableTouchExplorationMode) && |
465 !wm_shell->IsRunningInMash()) { | 470 !wm_shell->IsRunningInMash()) { |
466 touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); | 471 touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); |
467 } | 472 } |
468 } | 473 } |
469 | 474 |
470 void RootWindowController::InitLayoutManagers() { | 475 void RootWindowController::InitLayoutManagers() { |
471 // Create the shelf and status area widgets. | 476 // Create the shelf and status area widgets. |
472 DCHECK(!wm_shelf_->shelf_widget()); | 477 DCHECK(!wm_shelf_->shelf_widget()); |
473 aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); | 478 aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); |
474 aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); | 479 aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); |
475 WmWindow* wm_shelf_container = WmWindowAura::Get(shelf_container); | 480 WmWindow* wm_shelf_container = WmWindowAura::Get(shelf_container); |
476 WmWindow* wm_status_container = WmWindowAura::Get(status_container); | 481 WmWindow* wm_status_container = WmWindowAura::Get(status_container); |
477 | 482 |
478 wm_root_window_controller_->CreateLayoutManagers(); | 483 CreateLayoutManagers(); |
479 | 484 |
480 // Make it easier to resize windows that partially overlap the shelf. Must | 485 // Make it easier to resize windows that partially overlap the shelf. Must |
481 // occur after the ShelfLayoutManager is constructed by ShelfWidget. | 486 // occur after the ShelfLayoutManager is constructed by ShelfWidget. |
482 shelf_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( | 487 shelf_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( |
483 wm_shelf_container, wm_shelf_.get())); | 488 wm_shelf_container, wm_shelf_.get())); |
484 status_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( | 489 status_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( |
485 wm_status_container, wm_shelf_.get())); | 490 wm_status_container, wm_shelf_.get())); |
486 | 491 |
487 panel_container_handler_ = base::MakeUnique<PanelWindowEventHandler>(); | 492 panel_container_handler_ = base::MakeUnique<PanelWindowEventHandler>(); |
488 GetContainer(kShellWindowId_PanelContainer) | 493 GetContainer(kShellWindowId_PanelContainer) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 return; | 547 return; |
543 set_touch_hud_projection(new TouchHudProjection(GetRootWindow())); | 548 set_touch_hud_projection(new TouchHudProjection(GetRootWindow())); |
544 } | 549 } |
545 | 550 |
546 void RootWindowController::DisableTouchHudProjection() { | 551 void RootWindowController::DisableTouchHudProjection() { |
547 if (!touch_hud_projection_) | 552 if (!touch_hud_projection_) |
548 return; | 553 return; |
549 touch_hud_projection_->Remove(); | 554 touch_hud_projection_->Remove(); |
550 } | 555 } |
551 | 556 |
552 DockedWindowLayoutManager* | |
553 RootWindowController::docked_window_layout_manager() { | |
554 return wm_root_window_controller_->docked_window_layout_manager(); | |
555 } | |
556 | |
557 PanelLayoutManager* RootWindowController::panel_layout_manager() { | |
558 return wm_root_window_controller_->panel_layout_manager(); | |
559 } | |
560 | |
561 void RootWindowController::OnLoginStateChanged(LoginStatus status) { | 557 void RootWindowController::OnLoginStateChanged(LoginStatus status) { |
562 wm_shelf_->UpdateVisibilityState(); | 558 wm_shelf_->UpdateVisibilityState(); |
563 } | 559 } |
564 | 560 |
565 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { | 561 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
566 if (enabled) | 562 if (enabled) |
567 EnableTouchHudProjection(); | 563 EnableTouchHudProjection(); |
568 else | 564 else |
569 DisableTouchHudProjection(); | 565 DisableTouchHudProjection(); |
570 } | 566 } |
571 | 567 |
572 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 568 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
573 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 569 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
574 } | 570 } |
575 | 571 |
576 } // namespace ash | 572 } // namespace ash |
OLD | NEW |