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/aura/aura_layout_manager_adapter.h" | 10 #include "ash/aura/aura_layout_manager_adapter.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "ash/common/wm/container_finder.h" | 31 #include "ash/common/wm/container_finder.h" |
32 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 32 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
33 #include "ash/common/wm/fullscreen_window_finder.h" | 33 #include "ash/common/wm/fullscreen_window_finder.h" |
34 #include "ash/common/wm/panels/panel_layout_manager.h" | 34 #include "ash/common/wm/panels/panel_layout_manager.h" |
35 #include "ash/common/wm/root_window_layout_manager.h" | 35 #include "ash/common/wm/root_window_layout_manager.h" |
36 #include "ash/common/wm/switchable_windows.h" | 36 #include "ash/common/wm/switchable_windows.h" |
37 #include "ash/common/wm/window_state.h" | 37 #include "ash/common/wm/window_state.h" |
38 #include "ash/common/wm/workspace/workspace_layout_manager.h" | 38 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
39 #include "ash/common/wm_shell.h" | 39 #include "ash/common/wm_shell.h" |
40 #include "ash/common/wm_window.h" | 40 #include "ash/common/wm_window.h" |
41 #include "ash/desktop_background/desktop_background_widget_controller.h" | |
42 #include "ash/display/display_manager.h" | 41 #include "ash/display/display_manager.h" |
43 #include "ash/high_contrast/high_contrast_controller.h" | 42 #include "ash/high_contrast/high_contrast_controller.h" |
44 #include "ash/host/ash_window_tree_host.h" | 43 #include "ash/host/ash_window_tree_host.h" |
45 #include "ash/root_window_settings.h" | 44 #include "ash/root_window_settings.h" |
46 #include "ash/shelf/shelf_window_targeter.h" | 45 #include "ash/shelf/shelf_window_targeter.h" |
47 #include "ash/shell.h" | 46 #include "ash/shell.h" |
48 #include "ash/touch/touch_hud_debug.h" | 47 #include "ash/touch/touch_hud_debug.h" |
49 #include "ash/touch/touch_hud_projection.h" | 48 #include "ash/touch/touch_hud_projection.h" |
50 #include "ash/touch/touch_observer_hud.h" | 49 #include "ash/touch/touch_observer_hud.h" |
| 50 #include "ash/wallpaper/wallpaper_widget_controller.h" |
51 #include "ash/wm/lock_layout_manager.h" | 51 #include "ash/wm/lock_layout_manager.h" |
52 #include "ash/wm/panels/attached_panel_window_targeter.h" | 52 #include "ash/wm/panels/attached_panel_window_targeter.h" |
53 #include "ash/wm/panels/panel_window_event_handler.h" | 53 #include "ash/wm/panels/panel_window_event_handler.h" |
54 #include "ash/wm/stacking_controller.h" | 54 #include "ash/wm/stacking_controller.h" |
55 #include "ash/wm/system_background_controller.h" | |
56 #include "ash/wm/system_modal_container_layout_manager.h" | 55 #include "ash/wm/system_modal_container_layout_manager.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 "ash/wm/workspace_controller.h" | 60 #include "ash/wm/workspace_controller.h" |
61 #include "base/command_line.h" | 61 #include "base/command_line.h" |
62 #include "base/macros.h" | 62 #include "base/macros.h" |
63 #include "base/memory/ptr_util.h" | 63 #include "base/memory/ptr_util.h" |
64 #include "base/time/time.h" | 64 #include "base/time/time.h" |
65 #include "ui/aura/client/aura_constants.h" | 65 #include "ui/aura/client/aura_constants.h" |
66 #include "ui/aura/client/screen_position_client.h" | 66 #include "ui/aura/client/screen_position_client.h" |
(...skipping 25 matching lines...) Expand all Loading... |
92 #include "ui/chromeos/touch_exploration_controller.h" | 92 #include "ui/chromeos/touch_exploration_controller.h" |
93 #endif | 93 #endif |
94 | 94 |
95 namespace ash { | 95 namespace ash { |
96 namespace { | 96 namespace { |
97 | 97 |
98 #if defined(OS_CHROMEOS) | 98 #if defined(OS_CHROMEOS) |
99 // Duration for the animation that hides the boot splash screen, in | 99 // Duration for the animation that hides the boot splash screen, in |
100 // milliseconds. This should be short enough in relation to | 100 // milliseconds. This should be short enough in relation to |
101 // wm/window_animation.cc's brightness/grayscale fade animation that the login | 101 // wm/window_animation.cc's brightness/grayscale fade animation that the login |
102 // background image animation isn't hidden by the splash screen animation. | 102 // wallpaper image animation isn't hidden by the splash screen animation. |
103 const int kBootSplashScreenHideDurationMs = 500; | 103 const int kBootSplashScreenHideDurationMs = 500; |
104 #endif | 104 #endif |
105 | 105 |
106 float ToRelativeValue(int value, int src, int dst) { | 106 float ToRelativeValue(int value, int src, int dst) { |
107 return static_cast<float>(value) / static_cast<float>(src) * dst; | 107 return static_cast<float>(value) / static_cast<float>(src) * dst; |
108 } | 108 } |
109 | 109 |
110 void MoveOriginRelativeToSize(const gfx::Size& src_size, | 110 void MoveOriginRelativeToSize(const gfx::Size& src_size, |
111 const gfx::Size& dst_size, | 111 const gfx::Size& dst_size, |
112 gfx::Rect* bounds_in_out) { | 112 gfx::Rect* bounds_in_out) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 kShellWindowId_DockedContainer, | 156 kShellWindowId_DockedContainer, |
157 kShellWindowId_PanelContainer, | 157 kShellWindowId_PanelContainer, |
158 kShellWindowId_AlwaysOnTopContainer, | 158 kShellWindowId_AlwaysOnTopContainer, |
159 kShellWindowId_SystemModalContainer, | 159 kShellWindowId_SystemModalContainer, |
160 kShellWindowId_LockSystemModalContainer, | 160 kShellWindowId_LockSystemModalContainer, |
161 kShellWindowId_UnparentedControlContainer, | 161 kShellWindowId_UnparentedControlContainer, |
162 kShellWindowId_OverlayContainer, | 162 kShellWindowId_OverlayContainer, |
163 }; | 163 }; |
164 const int kExtraContainerIdsToMoveInUnifiedMode[] = { | 164 const int kExtraContainerIdsToMoveInUnifiedMode[] = { |
165 kShellWindowId_LockScreenContainer, | 165 kShellWindowId_LockScreenContainer, |
166 kShellWindowId_LockScreenBackgroundContainer, | 166 kShellWindowId_LockScreenWallpaperContainer, |
167 }; | 167 }; |
168 std::vector<int> container_ids( | 168 std::vector<int> container_ids( |
169 kContainerIdsToMove, | 169 kContainerIdsToMove, |
170 kContainerIdsToMove + arraysize(kContainerIdsToMove)); | 170 kContainerIdsToMove + arraysize(kContainerIdsToMove)); |
171 // Check the default_multi_display_mode because this is also necessary | 171 // Check the default_multi_display_mode because this is also necessary |
172 // in trasition between mirror <-> unified mode. | 172 // in trasition between mirror <-> unified mode. |
173 if (Shell::GetInstance() | 173 if (Shell::GetInstance() |
174 ->display_manager() | 174 ->display_manager() |
175 ->current_default_multi_display_mode() == DisplayManager::UNIFIED) { | 175 ->current_default_multi_display_mode() == DisplayManager::UNIFIED) { |
176 for (int id : kExtraContainerIdsToMoveInUnifiedMode) | 176 for (int id : kExtraContainerIdsToMoveInUnifiedMode) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 324 } |
325 | 325 |
326 aura::Window* RootWindowController::GetRootWindow() { | 326 aura::Window* RootWindowController::GetRootWindow() { |
327 return GetHost()->window(); | 327 return GetHost()->window(); |
328 } | 328 } |
329 | 329 |
330 const aura::Window* RootWindowController::GetRootWindow() const { | 330 const aura::Window* RootWindowController::GetRootWindow() const { |
331 return GetHost()->window(); | 331 return GetHost()->window(); |
332 } | 332 } |
333 | 333 |
334 void RootWindowController::SetWallpaperController( | 334 void RootWindowController::SetWallpaperWidgetController( |
335 DesktopBackgroundWidgetController* controller) { | 335 WallpaperWidgetController* controller) { |
336 wallpaper_controller_.reset(controller); | 336 wallpaper_widget_controller_.reset(controller); |
337 } | 337 } |
338 | 338 |
339 void RootWindowController::SetAnimatingWallpaperController( | 339 void RootWindowController::SetAnimatingWallpaperWidgetController( |
340 AnimatingDesktopController* controller) { | 340 AnimatingWallpaperWidgetController* controller) { |
341 if (animating_wallpaper_controller_.get()) | 341 if (animating_wallpaper_widget_controller_.get()) |
342 animating_wallpaper_controller_->StopAnimating(); | 342 animating_wallpaper_widget_controller_->StopAnimating(); |
343 animating_wallpaper_controller_.reset(controller); | 343 animating_wallpaper_widget_controller_.reset(controller); |
344 } | 344 } |
345 | 345 |
346 void RootWindowController::Shutdown() { | 346 void RootWindowController::Shutdown() { |
347 WmShell::Get()->RemoveShellObserver(this); | 347 WmShell::Get()->RemoveShellObserver(this); |
348 | 348 |
349 #if defined(OS_CHROMEOS) | 349 #if defined(OS_CHROMEOS) |
350 if (touch_exploration_manager_) { | 350 if (touch_exploration_manager_) { |
351 touch_exploration_manager_.reset(); | 351 touch_exploration_manager_.reset(); |
352 } | 352 } |
353 #endif | 353 #endif |
354 | 354 |
355 if (animating_wallpaper_controller_.get()) | 355 if (animating_wallpaper_widget_controller_.get()) |
356 animating_wallpaper_controller_->StopAnimating(); | 356 animating_wallpaper_widget_controller_->StopAnimating(); |
357 wallpaper_controller_.reset(); | 357 wallpaper_widget_controller_.reset(); |
358 animating_wallpaper_controller_.reset(); | 358 animating_wallpaper_widget_controller_.reset(); |
359 aura::Window* root_window = GetRootWindow(); | 359 aura::Window* root_window = GetRootWindow(); |
360 WmWindow* root_shutting_down = WmWindowAura::Get(root_window); | 360 WmWindow* root_shutting_down = WmWindowAura::Get(root_window); |
361 WmShell* shell = WmShell::Get(); | 361 WmShell* shell = WmShell::Get(); |
362 // Change the target root window before closing child windows. If any child | 362 // Change the target root window before closing child windows. If any child |
363 // being removed triggers a relayout of the shelf it will try to build a | 363 // being removed triggers a relayout of the shelf it will try to build a |
364 // window list adding windows from the target root window's containers which | 364 // window list adding windows from the target root window's containers which |
365 // may have already gone away. | 365 // may have already gone away. |
366 if (shell->GetRootWindowForNewWindows() == root_shutting_down) { | 366 if (shell->GetRootWindowForNewWindows() == root_shutting_down) { |
367 // The root window for new windows is being destroyed. Switch to the primary | 367 // The root window for new windows is being destroyed. Switch to the primary |
368 // root window if possible. | 368 // root window if possible. |
369 WmWindow* primary_root = shell->GetPrimaryRootWindow(); | 369 WmWindow* primary_root = shell->GetPrimaryRootWindow(); |
370 shell->set_root_window_for_new_windows( | 370 shell->set_root_window_for_new_windows( |
371 primary_root == root_shutting_down ? nullptr : primary_root); | 371 primary_root == root_shutting_down ? nullptr : primary_root); |
372 } | 372 } |
373 | 373 |
374 CloseChildWindows(); | 374 CloseChildWindows(); |
375 GetRootWindowSettings(root_window)->controller = NULL; | 375 GetRootWindowSettings(root_window)->controller = NULL; |
376 workspace_controller_.reset(); | 376 workspace_controller_.reset(); |
377 // Forget with the display ID so that display lookup | 377 // Forget with the display ID so that display lookup |
378 // ends up with invalid display. | 378 // ends up with invalid display. |
379 GetRootWindowSettings(root_window)->display_id = | 379 GetRootWindowSettings(root_window)->display_id = |
380 display::Display::kInvalidDisplayID; | 380 display::Display::kInvalidDisplayID; |
381 ash_host_->PrepareForShutdown(); | 381 ash_host_->PrepareForShutdown(); |
382 | 382 |
383 system_background_.reset(); | 383 system_wallpaper_.reset(); |
384 aura::client::SetScreenPositionClient(root_window, NULL); | 384 aura::client::SetScreenPositionClient(root_window, NULL); |
385 } | 385 } |
386 | 386 |
387 bool RootWindowController::CanWindowReceiveEvents(aura::Window* window) { | 387 bool RootWindowController::CanWindowReceiveEvents(aura::Window* window) { |
388 if (GetRootWindow() != window->GetRootWindow()) | 388 if (GetRootWindow() != window->GetRootWindow()) |
389 return false; | 389 return false; |
390 | 390 |
391 // Always allow events to fall through to the virtual keyboard even if | 391 // Always allow events to fall through to the virtual keyboard even if |
392 // displaying a system modal dialog. | 392 // displaying a system modal dialog. |
393 if (IsVirtualKeyboardWindow(window)) | 393 if (IsVirtualKeyboardWindow(window)) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 return shelf_.get(); | 500 return shelf_.get(); |
501 } | 501 } |
502 | 502 |
503 void RootWindowController::UpdateAfterLoginStatusChange(LoginStatus status) { | 503 void RootWindowController::UpdateAfterLoginStatusChange(LoginStatus status) { |
504 if (status != LoginStatus::NOT_LOGGED_IN) | 504 if (status != LoginStatus::NOT_LOGGED_IN) |
505 mouse_event_target_.reset(); | 505 mouse_event_target_.reset(); |
506 if (shelf_widget_->status_area_widget()) | 506 if (shelf_widget_->status_area_widget()) |
507 shelf_widget_->status_area_widget()->UpdateAfterLoginStatusChange(status); | 507 shelf_widget_->status_area_widget()->UpdateAfterLoginStatusChange(status); |
508 } | 508 } |
509 | 509 |
510 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { | 510 void RootWindowController::HandleInitialWallpaperAnimationStarted() { |
511 #if defined(OS_CHROMEOS) | 511 #if defined(OS_CHROMEOS) |
512 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 512 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
513 switches::kAshAnimateFromBootSplashScreen) && | 513 switches::kAshAnimateFromBootSplashScreen) && |
514 boot_splash_screen_.get()) { | 514 boot_splash_screen_.get()) { |
515 // Make the splash screen fade out so it doesn't obscure the desktop | 515 // Make the splash screen fade out so it doesn't obscure the wallpaper's |
516 // wallpaper's brightness/grayscale animation. | 516 // brightness/grayscale animation. |
517 boot_splash_screen_->StartHideAnimation( | 517 boot_splash_screen_->StartHideAnimation( |
518 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); | 518 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); |
519 } | 519 } |
520 #endif | 520 #endif |
521 } | 521 } |
522 | 522 |
523 void RootWindowController::OnWallpaperAnimationFinished(views::Widget* widget) { | 523 void RootWindowController::OnWallpaperAnimationFinished(views::Widget* widget) { |
524 // Make sure the wallpaper is visible. | 524 // Make sure the wallpaper is visible. |
525 system_background_->SetColor(SK_ColorBLACK); | 525 system_wallpaper_->SetColor(SK_ColorBLACK); |
526 #if defined(OS_CHROMEOS) | 526 #if defined(OS_CHROMEOS) |
527 boot_splash_screen_.reset(); | 527 boot_splash_screen_.reset(); |
528 #endif | 528 #endif |
529 | 529 |
530 WmShell::Get()->wallpaper_delegate()->OnWallpaperAnimationFinished(); | 530 WmShell::Get()->wallpaper_delegate()->OnWallpaperAnimationFinished(); |
531 // Only removes old component when wallpaper animation finished. If we | 531 // Only removes old component when wallpaper animation finished. If we |
532 // remove the old one before the new wallpaper is done fading in there will | 532 // remove the old one before the new wallpaper is done fading in there will |
533 // be a white flash during the animation. | 533 // be a white flash during the animation. |
534 if (animating_wallpaper_controller()) { | 534 if (animating_wallpaper_widget_controller()) { |
535 DesktopBackgroundWidgetController* controller = | 535 WallpaperWidgetController* controller = |
536 animating_wallpaper_controller()->GetController(true); | 536 animating_wallpaper_widget_controller()->GetController(true); |
537 // |desktop_widget_| should be the same animating widget we try to move | |
538 // to |kDesktopController|. Otherwise, we may close |desktop_widget_| | |
539 // before move it to |kDesktopController|. | |
540 DCHECK_EQ(controller->widget(), widget); | 537 DCHECK_EQ(controller->widget(), widget); |
541 // Release the old controller and close its background widget. | 538 // Release the old controller and close its wallpaper widget. |
542 SetWallpaperController(controller); | 539 SetWallpaperWidgetController(controller); |
543 } | 540 } |
544 } | 541 } |
545 | 542 |
546 void RootWindowController::CloseChildWindows() { | 543 void RootWindowController::CloseChildWindows() { |
547 mouse_event_target_.reset(); | 544 mouse_event_target_.reset(); |
548 | 545 |
549 // Remove observer as deactivating keyboard causes |docked_layout_manager_| | 546 // Remove observer as deactivating keyboard causes |docked_layout_manager_| |
550 // to fire notifications. | 547 // to fire notifications. |
551 if (docked_layout_manager_ && shelf_widget_ && | 548 if (docked_layout_manager_ && shelf_widget_ && |
552 shelf_widget_->shelf_layout_manager()) | 549 shelf_widget_->shelf_layout_manager()) |
(...skipping 13 matching lines...) Expand all Loading... |
566 if (docked_layout_manager_) { | 563 if (docked_layout_manager_) { |
567 docked_layout_manager_->Shutdown(); | 564 docked_layout_manager_->Shutdown(); |
568 docked_layout_manager_ = NULL; | 565 docked_layout_manager_ = NULL; |
569 } | 566 } |
570 aura::Window* root_window = GetRootWindow(); | 567 aura::Window* root_window = GetRootWindow(); |
571 aura::client::SetDragDropClient(root_window, NULL); | 568 aura::client::SetDragDropClient(root_window, NULL); |
572 | 569 |
573 if (shelf_widget_) | 570 if (shelf_widget_) |
574 shelf_widget_->Shutdown(); | 571 shelf_widget_->Shutdown(); |
575 | 572 |
576 // Close background widget first as it depends on tooltip. | 573 // Close wallpaper widget first as it depends on tooltip. |
577 wallpaper_controller_.reset(); | 574 wallpaper_widget_controller_.reset(); |
578 animating_wallpaper_controller_.reset(); | 575 animating_wallpaper_widget_controller_.reset(); |
579 | 576 |
580 workspace_controller_.reset(); | 577 workspace_controller_.reset(); |
581 aura::client::SetTooltipClient(root_window, NULL); | 578 aura::client::SetTooltipClient(root_window, NULL); |
582 | 579 |
583 // Explicitly destroy top level windows. We do this as during part of | 580 // Explicitly destroy top level windows. We do this as during part of |
584 // destruction such windows may query the RootWindow for state. | 581 // destruction such windows may query the RootWindow for state. |
585 aura::WindowTracker non_toplevel_windows; | 582 aura::WindowTracker non_toplevel_windows; |
586 non_toplevel_windows.Add(root_window); | 583 non_toplevel_windows.Add(root_window); |
587 while (!non_toplevel_windows.windows().empty()) { | 584 while (!non_toplevel_windows.windows().empty()) { |
588 const aura::Window* non_toplevel_window = | 585 const aura::Window* non_toplevel_window = |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 ShellDelegate* delegate = WmShell::Get()->delegate(); | 638 ShellDelegate* delegate = WmShell::Get()->delegate(); |
642 DCHECK(delegate); | 639 DCHECK(delegate); |
643 menu_model_.reset(delegate->CreateContextMenu(wm_shelf_aura_.get(), nullptr)); | 640 menu_model_.reset(delegate->CreateContextMenu(wm_shelf_aura_.get(), nullptr)); |
644 if (!menu_model_) | 641 if (!menu_model_) |
645 return; | 642 return; |
646 | 643 |
647 menu_model_adapter_.reset(new views::MenuModelAdapter( | 644 menu_model_adapter_.reset(new views::MenuModelAdapter( |
648 menu_model_.get(), | 645 menu_model_.get(), |
649 base::Bind(&RootWindowController::OnMenuClosed, base::Unretained(this)))); | 646 base::Bind(&RootWindowController::OnMenuClosed, base::Unretained(this)))); |
650 | 647 |
651 // Background controller may not be set yet if user clicked on status are | 648 // Wallpaper controller may not be set yet if user clicked on status are |
652 // before initial animation completion. See crbug.com/222218 | 649 // before initial animation completion. See crbug.com/222218 |
653 if (!wallpaper_controller_.get()) | 650 if (!wallpaper_widget_controller_.get()) |
654 return; | 651 return; |
655 | 652 |
656 menu_runner_.reset(new views::MenuRunner( | 653 menu_runner_.reset(new views::MenuRunner( |
657 menu_model_adapter_->CreateMenu(), | 654 menu_model_adapter_->CreateMenu(), |
658 views::MenuRunner::CONTEXT_MENU | views::MenuRunner::ASYNC)); | 655 views::MenuRunner::CONTEXT_MENU | views::MenuRunner::ASYNC)); |
659 ignore_result( | 656 ignore_result( |
660 menu_runner_->RunMenuAt(wallpaper_controller_->widget(), NULL, | 657 menu_runner_->RunMenuAt(wallpaper_widget_controller_->widget(), nullptr, |
661 gfx::Rect(location_in_screen, gfx::Size()), | 658 gfx::Rect(location_in_screen, gfx::Size()), |
662 views::MENU_ANCHOR_TOPLEFT, source_type)); | 659 views::MENU_ANCHOR_TOPLEFT, source_type)); |
663 } | 660 } |
664 | 661 |
665 void RootWindowController::UpdateShelfVisibility() { | 662 void RootWindowController::UpdateShelfVisibility() { |
666 shelf_widget_->shelf_layout_manager()->UpdateVisibilityState(); | 663 shelf_widget_->shelf_layout_manager()->UpdateVisibilityState(); |
667 } | 664 } |
668 | 665 |
669 aura::Window* RootWindowController::GetWindowForFullscreenMode() { | 666 aura::Window* RootWindowController::GetWindowForFullscreenMode() { |
670 return WmWindowAura::GetAuraWindow( | 667 return WmWindowAura::GetAuraWindow( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 } | 749 } |
753 | 750 |
754 void RootWindowController::Init(RootWindowType root_window_type, | 751 void RootWindowController::Init(RootWindowType root_window_type, |
755 bool first_run_after_boot) { | 752 bool first_run_after_boot) { |
756 aura::Window* root_window = GetRootWindow(); | 753 aura::Window* root_window = GetRootWindow(); |
757 Shell* shell = Shell::GetInstance(); | 754 Shell* shell = Shell::GetInstance(); |
758 shell->InitRootWindow(root_window); | 755 shell->InitRootWindow(root_window); |
759 | 756 |
760 root_window_controller_common_->CreateContainers(); | 757 root_window_controller_common_->CreateContainers(); |
761 | 758 |
762 CreateSystemBackground(first_run_after_boot); | 759 CreateSystemWallpaper(first_run_after_boot); |
763 | 760 |
764 InitLayoutManagers(); | 761 InitLayoutManagers(); |
765 InitTouchHuds(); | 762 InitTouchHuds(); |
766 | 763 |
767 if (Shell::GetPrimaryRootWindowController() | 764 if (Shell::GetPrimaryRootWindowController() |
768 ->GetSystemModalLayoutManager(NULL) | 765 ->GetSystemModalLayoutManager(NULL) |
769 ->has_modal_background()) { | 766 ->has_modal_background()) { |
770 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); | 767 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); |
771 } | 768 } |
772 | 769 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 wm_status_container, wm_shelf_aura_.get())); | 838 wm_status_container, wm_shelf_aura_.get())); |
842 | 839 |
843 if (!WmShell::Get() | 840 if (!WmShell::Get() |
844 ->GetSessionStateDelegate() | 841 ->GetSessionStateDelegate() |
845 ->IsActiveUserSessionStarted()) { | 842 ->IsActiveUserSessionStarted()) { |
846 // This window exists only to be a event target on login screen. | 843 // This window exists only to be a event target on login screen. |
847 // It does not have to handle events, nor be visible. | 844 // It does not have to handle events, nor be visible. |
848 mouse_event_target_.reset(new aura::Window(new EmptyWindowDelegate)); | 845 mouse_event_target_.reset(new aura::Window(new EmptyWindowDelegate)); |
849 mouse_event_target_->Init(ui::LAYER_NOT_DRAWN); | 846 mouse_event_target_->Init(ui::LAYER_NOT_DRAWN); |
850 | 847 |
851 aura::Window* lock_background_container = | 848 aura::Window* lock_wallpaper_container = |
852 GetContainer(kShellWindowId_LockScreenBackgroundContainer); | 849 GetContainer(kShellWindowId_LockScreenWallpaperContainer); |
853 lock_background_container->AddChild(mouse_event_target_.get()); | 850 lock_wallpaper_container->AddChild(mouse_event_target_.get()); |
854 mouse_event_target_->Show(); | 851 mouse_event_target_->Show(); |
855 } | 852 } |
856 | 853 |
857 // Create Docked windows layout manager | 854 // Create Docked windows layout manager |
858 WmWindow* docked_container = | 855 WmWindow* docked_container = |
859 WmWindowAura::Get(GetContainer(kShellWindowId_DockedContainer)); | 856 WmWindowAura::Get(GetContainer(kShellWindowId_DockedContainer)); |
860 docked_layout_manager_ = new DockedWindowLayoutManager(docked_container); | 857 docked_layout_manager_ = new DockedWindowLayoutManager(docked_container); |
861 docked_container->SetLayoutManager(base::WrapUnique(docked_layout_manager_)); | 858 docked_container->SetLayoutManager(base::WrapUnique(docked_layout_manager_)); |
862 | 859 |
863 // Installs SnapLayoutManager to containers who set the | 860 // Installs SnapLayoutManager to containers who set the |
(...skipping 21 matching lines...) Expand all Loading... |
885 } | 882 } |
886 | 883 |
887 void RootWindowController::InitTouchHuds() { | 884 void RootWindowController::InitTouchHuds() { |
888 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 885 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
889 if (command_line->HasSwitch(switches::kAshTouchHud)) | 886 if (command_line->HasSwitch(switches::kAshTouchHud)) |
890 set_touch_hud_debug(new TouchHudDebug(GetRootWindow())); | 887 set_touch_hud_debug(new TouchHudDebug(GetRootWindow())); |
891 if (Shell::GetInstance()->is_touch_hud_projection_enabled()) | 888 if (Shell::GetInstance()->is_touch_hud_projection_enabled()) |
892 EnableTouchHudProjection(); | 889 EnableTouchHudProjection(); |
893 } | 890 } |
894 | 891 |
895 void RootWindowController::CreateSystemBackground( | 892 void RootWindowController::CreateSystemWallpaper(bool is_first_run_after_boot) { |
896 bool is_first_run_after_boot) { | |
897 SkColor color = SK_ColorBLACK; | 893 SkColor color = SK_ColorBLACK; |
898 #if defined(OS_CHROMEOS) | 894 #if defined(OS_CHROMEOS) |
899 if (is_first_run_after_boot) | 895 if (is_first_run_after_boot) |
900 color = kChromeOsBootColor; | 896 color = kChromeOsBootColor; |
901 #endif | 897 #endif |
902 system_background_.reset( | 898 system_wallpaper_.reset( |
903 new SystemBackgroundController(GetRootWindow(), color)); | 899 new SystemWallpaperController(GetRootWindow(), color)); |
904 | 900 |
905 #if defined(OS_CHROMEOS) | 901 #if defined(OS_CHROMEOS) |
906 // Make a copy of the system's boot splash screen so we can composite it | 902 // Make a copy of the system's boot splash screen so we can composite it |
907 // onscreen until the desktop background is ready. | 903 // onscreen until the wallpaper is ready. |
908 if (is_first_run_after_boot && | 904 if (is_first_run_after_boot && |
909 (base::CommandLine::ForCurrentProcess()->HasSwitch( | 905 (base::CommandLine::ForCurrentProcess()->HasSwitch( |
910 switches::kAshCopyHostBackgroundAtBoot) || | 906 switches::kAshCopyHostBackgroundAtBoot) || |
911 base::CommandLine::ForCurrentProcess()->HasSwitch( | 907 base::CommandLine::ForCurrentProcess()->HasSwitch( |
912 switches::kAshAnimateFromBootSplashScreen))) | 908 switches::kAshAnimateFromBootSplashScreen))) |
913 boot_splash_screen_.reset(new BootSplashScreen(GetHost())); | 909 boot_splash_screen_.reset(new BootSplashScreen(GetHost())); |
914 #endif | 910 #endif |
915 } | 911 } |
916 | 912 |
917 void RootWindowController::EnableTouchHudProjection() { | 913 void RootWindowController::EnableTouchHudProjection() { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 aura::Window* primary_root_window = Shell::GetInstance() | 953 aura::Window* primary_root_window = Shell::GetInstance() |
958 ->window_tree_host_manager() | 954 ->window_tree_host_manager() |
959 ->GetPrimaryRootWindow(); | 955 ->GetPrimaryRootWindow(); |
960 return GetRootWindowSettings(primary_root_window)->controller; | 956 return GetRootWindowSettings(primary_root_window)->controller; |
961 } | 957 } |
962 | 958 |
963 return GetRootWindowSettings(root_window)->controller; | 959 return GetRootWindowSettings(root_window)->controller; |
964 } | 960 } |
965 | 961 |
966 } // namespace ash | 962 } // namespace ash |
OLD | NEW |