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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #include "ui/wm/core/capture_controller.h" | 75 #include "ui/wm/core/capture_controller.h" |
76 #include "ui/wm/core/visibility_controller.h" | 76 #include "ui/wm/core/visibility_controller.h" |
77 #include "ui/wm/core/window_util.h" | 77 #include "ui/wm/core/window_util.h" |
78 #include "ui/wm/public/drag_drop_client.h" | 78 #include "ui/wm/public/drag_drop_client.h" |
79 #include "ui/wm/public/tooltip_client.h" | 79 #include "ui/wm/public/tooltip_client.h" |
80 #include "ui/wm/public/window_types.h" | 80 #include "ui/wm/public/window_types.h" |
81 | 81 |
82 #if defined(OS_CHROMEOS) | 82 #if defined(OS_CHROMEOS) |
83 #include "ash/ash_touch_exploration_manager_chromeos.h" | 83 #include "ash/ash_touch_exploration_manager_chromeos.h" |
84 #include "ash/wm/boot_splash_screen_chromeos.h" | 84 #include "ash/wm/boot_splash_screen_chromeos.h" |
| 85 #include "chromeos/chromeos_switches.h" |
85 #include "ui/chromeos/touch_exploration_controller.h" | 86 #include "ui/chromeos/touch_exploration_controller.h" |
86 #endif | 87 #endif |
87 | 88 |
88 namespace ash { | 89 namespace ash { |
89 namespace { | 90 namespace { |
90 | 91 |
91 #if defined(OS_CHROMEOS) | 92 #if defined(OS_CHROMEOS) |
92 // Duration for the animation that hides the boot splash screen, in | 93 // Duration for the animation that hides the boot splash screen, in |
93 // milliseconds. This should be short enough in relation to | 94 // milliseconds. This should be short enough in relation to |
94 // wm/window_animation.cc's brightness/grayscale fade animation that the login | 95 // wm/window_animation.cc's brightness/grayscale fade animation that the login |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return std::find(blocking_iter, windows.end(), target) != windows.end(); | 141 return std::find(blocking_iter, windows.end(), target) != windows.end(); |
141 } | 142 } |
142 | 143 |
143 return true; | 144 return true; |
144 } | 145 } |
145 | 146 |
146 } // namespace | 147 } // namespace |
147 | 148 |
148 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { | 149 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { |
149 RootWindowController* controller = new RootWindowController(host); | 150 RootWindowController* controller = new RootWindowController(host); |
150 controller->Init(RootWindowController::PRIMARY, | 151 controller->Init(RootWindowController::PRIMARY); |
151 WmShell::Get()->delegate()->IsFirstRunAfterBoot()); | |
152 } | 152 } |
153 | 153 |
154 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { | 154 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { |
155 RootWindowController* controller = new RootWindowController(host); | 155 RootWindowController* controller = new RootWindowController(host); |
156 controller->Init(RootWindowController::SECONDARY, false /* first run */); | 156 controller->Init(RootWindowController::SECONDARY); |
157 } | 157 } |
158 | 158 |
159 // static | 159 // static |
160 RootWindowController* RootWindowController::ForWindow( | 160 RootWindowController* RootWindowController::ForWindow( |
161 const aura::Window* window) { | 161 const aura::Window* window) { |
162 CHECK(Shell::HasInstance()); | 162 CHECK(Shell::HasInstance()); |
163 return GetRootWindowController(window->GetRootWindow()); | 163 return GetRootWindowController(window->GetRootWindow()); |
164 } | 164 } |
165 | 165 |
166 // static | 166 // static |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 416 |
417 // Has to happen after this is set as |controller| of RootWindowSettings. | 417 // Has to happen after this is set as |controller| of RootWindowSettings. |
418 wm_root_window_controller_ = WmRootWindowControllerAura::Get(root_window); | 418 wm_root_window_controller_ = WmRootWindowControllerAura::Get(root_window); |
419 | 419 |
420 stacking_controller_.reset(new StackingController); | 420 stacking_controller_.reset(new StackingController); |
421 aura::client::SetWindowParentingClient(root_window, | 421 aura::client::SetWindowParentingClient(root_window, |
422 stacking_controller_.get()); | 422 stacking_controller_.get()); |
423 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); | 423 capture_client_.reset(new ::wm::ScopedCaptureClient(root_window)); |
424 } | 424 } |
425 | 425 |
426 void RootWindowController::Init(RootWindowType root_window_type, | 426 void RootWindowController::Init(RootWindowType root_window_type) { |
427 bool first_run_after_boot) { | |
428 aura::Window* root_window = GetRootWindow(); | 427 aura::Window* root_window = GetRootWindow(); |
429 Shell* shell = Shell::GetInstance(); | 428 Shell* shell = Shell::GetInstance(); |
430 shell->InitRootWindow(root_window); | 429 shell->InitRootWindow(root_window); |
431 | 430 |
432 wm_root_window_controller_->CreateContainers(); | 431 wm_root_window_controller_->CreateContainers(); |
433 | 432 |
434 CreateSystemWallpaper(first_run_after_boot); | 433 CreateSystemWallpaper(root_window_type); |
435 | 434 |
436 InitLayoutManagers(); | 435 InitLayoutManagers(); |
437 InitTouchHuds(); | 436 InitTouchHuds(); |
438 | 437 |
439 if (WmShell::Get() | 438 if (WmShell::Get() |
440 ->GetPrimaryRootWindowController() | 439 ->GetPrimaryRootWindowController() |
441 ->GetSystemModalLayoutManager(nullptr) | 440 ->GetSystemModalLayoutManager(nullptr) |
442 ->has_window_dimmer()) { | 441 ->has_window_dimmer()) { |
443 wm_root_window_controller_->GetSystemModalLayoutManager(nullptr) | 442 wm_root_window_controller_->GetSystemModalLayoutManager(nullptr) |
444 ->CreateModalBackground(); | 443 ->CreateModalBackground(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 } | 502 } |
504 | 503 |
505 void RootWindowController::InitTouchHuds() { | 504 void RootWindowController::InitTouchHuds() { |
506 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 505 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
507 if (command_line->HasSwitch(switches::kAshTouchHud)) | 506 if (command_line->HasSwitch(switches::kAshTouchHud)) |
508 set_touch_hud_debug(new TouchHudDebug(GetRootWindow())); | 507 set_touch_hud_debug(new TouchHudDebug(GetRootWindow())); |
509 if (Shell::GetInstance()->is_touch_hud_projection_enabled()) | 508 if (Shell::GetInstance()->is_touch_hud_projection_enabled()) |
510 EnableTouchHudProjection(); | 509 EnableTouchHudProjection(); |
511 } | 510 } |
512 | 511 |
513 void RootWindowController::CreateSystemWallpaper(bool is_first_run_after_boot) { | 512 void RootWindowController::CreateSystemWallpaper( |
| 513 RootWindowType root_window_type) { |
514 SkColor color = SK_ColorBLACK; | 514 SkColor color = SK_ColorBLACK; |
515 #if defined(OS_CHROMEOS) | 515 #if defined(OS_CHROMEOS) |
516 if (is_first_run_after_boot) | 516 // The splash screen appears on the primary display at boot. If this is a |
| 517 // secondary monitor (either connected at boot or connected later) or if the |
| 518 // browser restarted for a second login then don't use the boot color. |
| 519 const bool is_boot_splash_screen = |
| 520 root_window_type == PRIMARY && |
| 521 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 522 chromeos::switches::kFirstExecAfterBoot); |
| 523 if (is_boot_splash_screen) |
517 color = kChromeOsBootColor; | 524 color = kChromeOsBootColor; |
518 #endif | 525 #endif |
519 system_wallpaper_.reset( | 526 system_wallpaper_.reset( |
520 new SystemWallpaperController(GetRootWindow(), color)); | 527 new SystemWallpaperController(GetRootWindow(), color)); |
521 | 528 |
522 #if defined(OS_CHROMEOS) | 529 #if defined(OS_CHROMEOS) |
523 // Make a copy of the system's boot splash screen so we can composite it | 530 // Make a copy of the system's boot splash screen so we can composite it |
524 // onscreen until the wallpaper is ready. | 531 // onscreen until the wallpaper is ready. |
525 if (is_first_run_after_boot && | 532 if (is_boot_splash_screen && |
526 (base::CommandLine::ForCurrentProcess()->HasSwitch( | 533 (base::CommandLine::ForCurrentProcess()->HasSwitch( |
527 switches::kAshCopyHostBackgroundAtBoot) || | 534 switches::kAshCopyHostBackgroundAtBoot) || |
528 base::CommandLine::ForCurrentProcess()->HasSwitch( | 535 base::CommandLine::ForCurrentProcess()->HasSwitch( |
529 switches::kAshAnimateFromBootSplashScreen))) | 536 switches::kAshAnimateFromBootSplashScreen))) |
530 boot_splash_screen_.reset(new BootSplashScreen(GetHost())); | 537 boot_splash_screen_.reset(new BootSplashScreen(GetHost())); |
531 #endif | 538 #endif |
532 } | 539 } |
533 | 540 |
534 void RootWindowController::EnableTouchHudProjection() { | 541 void RootWindowController::EnableTouchHudProjection() { |
535 if (touch_hud_projection_) | 542 if (touch_hud_projection_) |
(...skipping 25 matching lines...) Expand all Loading... |
561 EnableTouchHudProjection(); | 568 EnableTouchHudProjection(); |
562 else | 569 else |
563 DisableTouchHudProjection(); | 570 DisableTouchHudProjection(); |
564 } | 571 } |
565 | 572 |
566 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 573 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
567 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 574 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
568 } | 575 } |
569 | 576 |
570 } // namespace ash | 577 } // namespace ash |
OLD | NEW |