Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Side by Side Diff: chrome/browser/chromeos/login/ui/login_display_host_impl.cc

Issue 2891223002: cros: Move wallpaper after login screen is gone (Closed)
Patch Set: fix nits Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 5 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void DisableKeyboardOverscroll() { 284 void DisableKeyboardOverscroll() {
285 keyboard::SetKeyboardOverscrollOverride( 285 keyboard::SetKeyboardOverscrollOverride(
286 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED); 286 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED);
287 } 287 }
288 288
289 void ResetKeyboardOverscrollOverride() { 289 void ResetKeyboardOverscrollOverride() {
290 keyboard::SetKeyboardOverscrollOverride( 290 keyboard::SetKeyboardOverscrollOverride(
291 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE); 291 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE);
292 } 292 }
293 293
294 void ScheduleCompletionCallbacks(std::vector<base::OnceClosure>&& callbacks) {
295 for (auto& callback : callbacks) {
296 if (callback.is_null())
297 continue;
298
299 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
300 std::move(callback));
301 }
302 }
303
294 } // namespace 304 } // namespace
295 305
296 namespace chromeos { 306 namespace chromeos {
297 307
298 // static 308 // static
299 const int LoginDisplayHostImpl::kShowLoginWebUIid = 0x1111; 309 const int LoginDisplayHostImpl::kShowLoginWebUIid = 0x1111;
300 310
301 // A class to handle special menu key for keyboard driven OOBE. 311 // A class to handle special menu key for keyboard driven OOBE.
302 class LoginDisplayHostImpl::KeyboardDrivenOobeKeyHandler 312 class LoginDisplayHostImpl::KeyboardDrivenOobeKeyHandler
303 : public ui::EventHandler { 313 : public ui::EventHandler {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // MultiUserWindowManager instance might be null if no user is logged in - or 506 // MultiUserWindowManager instance might be null if no user is logged in - or
497 // in a unit test. 507 // in a unit test.
498 if (window_manager) 508 if (window_manager)
499 window_manager->RemoveObserver(this); 509 window_manager->RemoveObserver(this);
500 510
501 ResetKeyboardOverscrollOverride(); 511 ResetKeyboardOverscrollOverride();
502 512
503 views::FocusManager::set_arrow_key_traversal_enabled(false); 513 views::FocusManager::set_arrow_key_traversal_enabled(false);
504 ResetLoginWindowAndView(); 514 ResetLoginWindowAndView();
505 515
516 ScheduleCompletionCallbacks(std::move(completion_callbacks_));
517
506 keep_alive_.reset(); 518 keep_alive_.reset();
507 519
508 default_host_ = nullptr; 520 default_host_ = nullptr;
509 // TODO(tengs): This should be refactored. See crbug.com/314934. 521 // TODO(tengs): This should be refactored. See crbug.com/314934.
510 if (user_manager::UserManager::Get()->IsCurrentUserNew()) { 522 if (user_manager::UserManager::Get()->IsCurrentUserNew()) {
511 // DriveOptInController will delete itself when finished. 523 // DriveOptInController will delete itself when finished.
512 (new DriveFirstRunController( 524 (new DriveFirstRunController(
513 ProfileManager::GetActiveUserProfile()))->EnableOfflineMode(); 525 ProfileManager::GetActiveUserProfile()))->EnableOfflineMode();
514 } 526 }
515 } 527 }
(...skipping 13 matching lines...) Expand all
529 } 541 }
530 542
531 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const { 543 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const {
532 return login_view_; 544 return login_view_;
533 } 545 }
534 546
535 void LoginDisplayHostImpl::BeforeSessionStart() { 547 void LoginDisplayHostImpl::BeforeSessionStart() {
536 session_starting_ = true; 548 session_starting_ = true;
537 } 549 }
538 550
539 void LoginDisplayHostImpl::Finalize() { 551 void LoginDisplayHostImpl::Finalize(base::OnceClosure completion_callback) {
540 DVLOG(1) << "Finalizing LoginDisplayHost. User session starting"; 552 DVLOG(1) << "Finalizing LoginDisplayHost. User session starting";
541 553
554 completion_callbacks_.push_back(std::move(completion_callback));
555
542 switch (finalize_animation_type_) { 556 switch (finalize_animation_type_) {
543 case ANIMATION_NONE: 557 case ANIMATION_NONE:
544 ShutdownDisplayHost(false); 558 ShutdownDisplayHost(false);
545 break; 559 break;
546 case ANIMATION_WORKSPACE: 560 case ANIMATION_WORKSPACE:
547 if (ash::Shell::HasInstance()) 561 if (ash::Shell::HasInstance())
548 ScheduleWorkspaceAnimation(); 562 ScheduleWorkspaceAnimation();
549 563
550 ShutdownDisplayHost(false); 564 ShutdownDisplayHost(false);
551 break; 565 break;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 628
615 WizardController* LoginDisplayHostImpl::GetWizardController() { 629 WizardController* LoginDisplayHostImpl::GetWizardController() {
616 return wizard_controller_.get(); 630 return wizard_controller_.get();
617 } 631 }
618 632
619 AppLaunchController* LoginDisplayHostImpl::GetAppLaunchController() { 633 AppLaunchController* LoginDisplayHostImpl::GetAppLaunchController() {
620 return app_launch_controller_.get(); 634 return app_launch_controller_.get();
621 } 635 }
622 636
623 void LoginDisplayHostImpl::StartUserAdding( 637 void LoginDisplayHostImpl::StartUserAdding(
624 const base::Closure& completion_callback) { 638 base::OnceClosure completion_callback) {
625 DisableKeyboardOverscroll(); 639 DisableKeyboardOverscroll();
626 640
627 restore_path_ = RESTORE_ADD_USER_INTO_SESSION; 641 restore_path_ = RESTORE_ADD_USER_INTO_SESSION;
628 completion_callback_ = completion_callback; 642 completion_callbacks_.push_back(std::move(completion_callback));
629 // Animation is not supported in Mash 643 // Animation is not supported in Mash
630 if (!ash_util::IsRunningInMash()) 644 if (!ash_util::IsRunningInMash())
631 finalize_animation_type_ = ANIMATION_ADD_USER; 645 finalize_animation_type_ = ANIMATION_ADD_USER;
632 // Observe the user switch animation and defer the deletion of itself only 646 // Observe the user switch animation and defer the deletion of itself only
633 // after the animation is finished. 647 // after the animation is finished.
634 chrome::MultiUserWindowManager* window_manager = 648 chrome::MultiUserWindowManager* window_manager =
635 chrome::MultiUserWindowManager::GetInstance(); 649 chrome::MultiUserWindowManager::GetInstance();
636 // MultiUserWindowManager instance might be nullptr in a unit test. 650 // MultiUserWindowManager instance might be nullptr in a unit test.
637 if (window_manager) 651 if (window_manager)
638 window_manager->AddObserver(this); 652 window_manager->AddObserver(this);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 webui_login_display_, 684 webui_login_display_,
671 webui_login_display_); 685 webui_login_display_);
672 } 686 }
673 687
674 void LoginDisplayHostImpl::CancelUserAdding() { 688 void LoginDisplayHostImpl::CancelUserAdding() {
675 // ANIMATION_ADD_USER observes UserSwitchAnimatorChromeOS to shutdown the 689 // ANIMATION_ADD_USER observes UserSwitchAnimatorChromeOS to shutdown the
676 // login display host. However, the animation does not run when user adding is 690 // login display host. However, the animation does not run when user adding is
677 // canceled. Changing to ANIMATION_NONE so that Finalize() shuts down the host 691 // canceled. Changing to ANIMATION_NONE so that Finalize() shuts down the host
678 // immediately. 692 // immediately.
679 finalize_animation_type_ = ANIMATION_NONE; 693 finalize_animation_type_ = ANIMATION_NONE;
680 Finalize(); 694 Finalize(base::OnceClosure());
681 } 695 }
682 696
683 void LoginDisplayHostImpl::StartSignInScreen( 697 void LoginDisplayHostImpl::StartSignInScreen(
684 const LoginScreenContext& context) { 698 const LoginScreenContext& context) {
685 DisableKeyboardOverscroll(); 699 DisableKeyboardOverscroll();
686 700
687 startup_sound_honors_spoken_feedback_ = true; 701 startup_sound_honors_spoken_feedback_ = true;
688 TryToPlayStartupSound(); 702 TryToPlayStartupSound();
689 703
690 restore_path_ = RESTORE_SIGN_IN; 704 restore_path_ = RESTORE_SIGN_IN;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 1038
1025 void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) { 1039 void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) {
1026 if (shutting_down_) 1040 if (shutting_down_)
1027 return; 1041 return;
1028 1042
1029 shutting_down_ = true; 1043 shutting_down_ = true;
1030 registrar_.RemoveAll(); 1044 registrar_.RemoveAll();
1031 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 1045 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
1032 if (post_quit_task) 1046 if (post_quit_task)
1033 base::MessageLoop::current()->QuitWhenIdle(); 1047 base::MessageLoop::current()->QuitWhenIdle();
1034
1035 if (!completion_callback_.is_null()) {
1036 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
1037 completion_callback_);
1038 }
1039 } 1048 }
1040 1049
1041 void LoginDisplayHostImpl::ScheduleWorkspaceAnimation() { 1050 void LoginDisplayHostImpl::ScheduleWorkspaceAnimation() {
1042 if (ash_util::IsRunningInMash()) { 1051 if (ash_util::IsRunningInMash()) {
1043 NOTIMPLEMENTED(); 1052 NOTIMPLEMENTED();
1044 return; 1053 return;
1045 } 1054 }
1046 if (ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
1047 ash::kShellWindowId_WallpaperContainer)
1048 ->children()
1049 .empty()) {
1050 // If there is no wallpaper window, don't perform any animation on the
1051 // default and wallpaper layer because there is nothing behind it.
1052 return;
1053 }
1054 1055
1055 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 1056 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1056 switches::kDisableLoginAnimations)) 1057 switches::kDisableLoginAnimations)) {
1057 ash::Shell::Get()->DoInitialWorkspaceAnimation(); 1058 ash::Shell::Get()->DoInitialWorkspaceAnimation();
1059 }
1058 } 1060 }
1059 1061
1060 void LoginDisplayHostImpl::ScheduleFadeOutAnimation(int animation_speed_ms) { 1062 void LoginDisplayHostImpl::ScheduleFadeOutAnimation(int animation_speed_ms) {
1061 // login window might have been closed by OnBrowserCreated() at this moment. 1063 // login window might have been closed by OnBrowserCreated() at this moment.
1062 // This may happen when adding another user into the session, and a browser 1064 // This may happen when adding another user into the session, and a browser
1063 // is created before session start, which triggers the close of the login 1065 // is created before session start, which triggers the close of the login
1064 // window. In this case, we should shut down the display host directly. 1066 // window. In this case, we should shut down the display host directly.
1065 if (!login_window_) { 1067 if (!login_window_) {
1066 ShutdownDisplayHost(false); 1068 ShutdownDisplayHost(false);
1067 return; 1069 return;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 } 1117 }
1116 1118
1117 switch (restore_path_) { 1119 switch (restore_path_) {
1118 case RESTORE_WIZARD: 1120 case RESTORE_WIZARD:
1119 StartWizard(first_screen_); 1121 StartWizard(first_screen_);
1120 break; 1122 break;
1121 case RESTORE_SIGN_IN: 1123 case RESTORE_SIGN_IN:
1122 StartSignInScreen(LoginScreenContext()); 1124 StartSignInScreen(LoginScreenContext());
1123 break; 1125 break;
1124 case RESTORE_ADD_USER_INTO_SESSION: 1126 case RESTORE_ADD_USER_INTO_SESSION:
1125 StartUserAdding(completion_callback_); 1127 StartUserAdding(base::OnceClosure());
1126 break; 1128 break;
1127 default: 1129 default:
1128 NOTREACHED(); 1130 NOTREACHED();
1129 break; 1131 break;
1130 } 1132 }
1131 } 1133 }
1132 1134
1133 void LoginDisplayHostImpl::InitLoginWindowAndView() { 1135 void LoginDisplayHostImpl::InitLoginWindowAndView() {
1134 if (login_window_) 1136 if (login_window_)
1135 return; 1137 return;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 // Chrome locale. Otherwise it will be lost if Chrome restarts. 1397 // Chrome locale. Otherwise it will be lost if Chrome restarts.
1396 // Don't need to schedule pref save because setting initial local 1398 // Don't need to schedule pref save because setting initial local
1397 // will enforce preference saving. 1399 // will enforce preference saving.
1398 prefs->SetString(prefs::kApplicationLocale, locale); 1400 prefs->SetString(prefs::kApplicationLocale, locale);
1399 StartupUtils::SetInitialLocale(locale); 1401 StartupUtils::SetInitialLocale(locale);
1400 1402
1401 TriggerShowLoginWizardFinish(locale, std::move(data)); 1403 TriggerShowLoginWizardFinish(locale, std::move(data));
1402 } 1404 }
1403 1405
1404 } // namespace chromeos 1406 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/login_display_host_impl.h ('k') | chrome/browser/chromeos/login/ui/mock_login_display_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698