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

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

Issue 2832053003: cros: WallpaperController reparent based on session state (Closed)
Patch Set: rebase Created 3 years, 8 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"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_port.h" 12 #include "ash/shell_port.h"
13 #include "ash/system/tray/system_tray.h" 13 #include "ash/system/tray/system_tray.h"
14 #include "ash/wallpaper/wallpaper_controller.h"
15 #include "ash/wallpaper/wallpaper_delegate.h" 14 #include "ash/wallpaper/wallpaper_delegate.h"
16 #include "base/bind.h" 15 #include "base/bind.h"
17 #include "base/command_line.h" 16 #include "base/command_line.h"
18 #include "base/location.h" 17 #include "base/location.h"
19 #include "base/logging.h" 18 #include "base/logging.h"
20 #include "base/macros.h" 19 #include "base/macros.h"
21 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
22 #include "base/strings/string_split.h" 21 #include "base/strings/string_split.h"
23 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
24 #include "base/threading/thread_restrictions.h" 23 #include "base/threading/thread_restrictions.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 529
531 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const { 530 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const {
532 return login_view_; 531 return login_view_;
533 } 532 }
534 533
535 void LoginDisplayHostImpl::BeforeSessionStart() { 534 void LoginDisplayHostImpl::BeforeSessionStart() {
536 session_starting_ = true; 535 session_starting_ = true;
537 } 536 }
538 537
539 void LoginDisplayHostImpl::Finalize() { 538 void LoginDisplayHostImpl::Finalize() {
540 DVLOG(1) << "Session starting"; 539 DVLOG(1) << "Finalizing LoginDisplayHost. User session starting";
541 // When adding another user into the session, we defer the wallpaper's
542 // animation in order to prevent the flashing of the previous user's windows.
543 // See crbug.com/541864.
544 if (ash::ShellPort::HasInstance() &&
545 finalize_animation_type_ != ANIMATION_ADD_USER) {
546 ash::Shell::Get()->wallpaper_controller()->MoveToUnlockedContainer();
xiyuan 2017/04/21 15:30:58 For non-user-adding (login, kiosk launch etc), Log
547 }
548 540
549 switch (finalize_animation_type_) { 541 switch (finalize_animation_type_) {
550 case ANIMATION_NONE: 542 case ANIMATION_NONE:
551 ShutdownDisplayHost(false); 543 ShutdownDisplayHost(false);
552 break; 544 break;
553 case ANIMATION_WORKSPACE: 545 case ANIMATION_WORKSPACE:
554 if (ash::Shell::HasInstance()) 546 if (ash::Shell::HasInstance())
555 ScheduleWorkspaceAnimation(); 547 ScheduleWorkspaceAnimation();
556 548
557 ShutdownDisplayHost(false); 549 ShutdownDisplayHost(false);
558 break; 550 break;
559 case ANIMATION_FADE_OUT: 551 case ANIMATION_FADE_OUT:
560 // Display host is deleted once animation is completed 552 // Display host is deleted once animation is completed
561 // since sign in screen widget has to stay alive. 553 // since sign in screen widget has to stay alive.
562 ScheduleFadeOutAnimation(kDefaultFadeTimeMs); 554 ScheduleFadeOutAnimation(kDefaultFadeTimeMs);
563 break; 555 break;
564 case ANIMATION_ADD_USER: 556 case ANIMATION_ADD_USER:
565 // Defer the deletion of LoginDisplayHost instance until the user adding 557 // Defer the deletion of LoginDisplayHost instance until the user adding
566 // animation (which is done by UserSwitchAnimatorChromeOS) is finished. 558 // animation (which is done by UserSwitchAnimatorChromeOS) is finished.
567 // This is to guarantee OnUserSwitchAnimationFinished() is called before 559 // This is to guarantee OnUserSwitchAnimationFinished() is called before
568 // LoginDisplayHost deletes itself. 560 // LoginDisplayHost deletes itself.
561 // See crbug.com/541864.
569 break; 562 break;
570 default: 563 default:
571 break; 564 break;
572 } 565 }
573 } 566 }
574 567
575 void LoginDisplayHostImpl::OpenProxySettings() { 568 void LoginDisplayHostImpl::OpenProxySettings() {
576 if (login_view_) 569 if (login_view_)
577 login_view_->OpenProxySettings(); 570 login_view_->OpenProxySettings();
578 } 571 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 LoadURL(GURL(kUserAddingURL)); 641 LoadURL(GURL(kUserAddingURL));
649 // We should emit this signal only at login screen (after reboot or sign out). 642 // We should emit this signal only at login screen (after reboot or sign out).
650 login_view_->set_should_emit_login_prompt_visible(false); 643 login_view_->set_should_emit_login_prompt_visible(false);
651 644
652 if (!ash_util::IsRunningInMash()) { 645 if (!ash_util::IsRunningInMash()) {
653 // Lock container can be transparent after lock screen animation. 646 // Lock container can be transparent after lock screen animation.
654 aura::Window* lock_container = ash::Shell::GetContainer( 647 aura::Window* lock_container = ash::Shell::GetContainer(
655 ash::Shell::GetPrimaryRootWindow(), 648 ash::Shell::GetPrimaryRootWindow(),
656 ash::kShellWindowId_LockScreenContainersContainer); 649 ash::kShellWindowId_LockScreenContainersContainer);
657 lock_container->layer()->SetOpacity(1.0); 650 lock_container->layer()->SetOpacity(1.0);
658
659 ash::Shell::Get()->wallpaper_controller()->MoveToLockedContainer();
xiyuan 2017/04/21 15:30:58 Not necessary now. This is called from UserAddingS
660 } else { 651 } else {
661 NOTIMPLEMENTED(); 652 NOTIMPLEMENTED();
662 } 653 }
663 654
664 existing_user_controller_.reset(); // Only one controller in a time. 655 existing_user_controller_.reset(); // Only one controller in a time.
665 existing_user_controller_.reset(new chromeos::ExistingUserController(this)); 656 existing_user_controller_.reset(new chromeos::ExistingUserController(this));
666 657
667 if (!signin_screen_controller_.get()) { 658 if (!signin_screen_controller_.get()) {
668 signin_screen_controller_.reset(new SignInScreenController( 659 signin_screen_controller_.reset(new SignInScreenController(
669 GetOobeUI(), webui_login_display_->delegate())); 660 GetOobeUI(), webui_login_display_->delegate()));
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 // example) are ignored. 895 // example) are ignored.
905 OnBrowserCreated(); 896 OnBrowserCreated();
906 registrar_.Remove(this, 897 registrar_.Remove(this,
907 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, 898 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
908 content::NotificationService::AllSources()); 899 content::NotificationService::AllSources());
909 registrar_.Remove(this, 900 registrar_.Remove(this,
910 chrome::NOTIFICATION_BROWSER_OPENED, 901 chrome::NOTIFICATION_BROWSER_OPENED,
911 content::NotificationService::AllSources()); 902 content::NotificationService::AllSources());
912 } else if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED && 903 } else if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED &&
913 user_manager::UserManager::Get()->IsCurrentUserNew()) { 904 user_manager::UserManager::Get()->IsCurrentUserNew()) {
914 if (!ash_util::IsRunningInMash()) {
915 // For new user, move wallpaper to lock container so that windows created
916 // during the user image picker step are below it.
917 ash::Shell::Get()->wallpaper_controller()->MoveToLockedContainer();
xiyuan 2017/04/21 15:30:58 User image picker etc is under session state LOGGE
918 } else {
919 NOTIMPLEMENTED();
920 }
921 registrar_.Remove(this, 905 registrar_.Remove(this,
922 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 906 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
923 content::NotificationService::AllSources()); 907 content::NotificationService::AllSources());
924 } else if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) { 908 } else if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) {
925 VLOG(1) << "Login WebUI >> wp animation done"; 909 VLOG(1) << "Login WebUI >> wp animation done";
926 is_wallpaper_loaded_ = true; 910 is_wallpaper_loaded_ = true;
927 if (!ash_util::IsRunningInMash()) { 911 if (!ash_util::IsRunningInMash()) {
928 ash::Shell::Get() 912 ash::Shell::Get()
929 ->wallpaper_delegate() 913 ->wallpaper_delegate()
930 ->OnWallpaperBootAnimationFinished(); 914 ->OnWallpaperBootAnimationFinished();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) { 1019 void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) {
1036 if (shutting_down_) 1020 if (shutting_down_)
1037 return; 1021 return;
1038 1022
1039 shutting_down_ = true; 1023 shutting_down_ = true;
1040 registrar_.RemoveAll(); 1024 registrar_.RemoveAll();
1041 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 1025 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
1042 if (post_quit_task) 1026 if (post_quit_task)
1043 base::MessageLoop::current()->QuitWhenIdle(); 1027 base::MessageLoop::current()->QuitWhenIdle();
1044 1028
1045 if (!completion_callback_.is_null()) 1029 if (!completion_callback_.is_null()) {
1046 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 1030 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
1047 completion_callback_); 1031 completion_callback_);
1048
1049 if (ash::Shell::HasInstance() &&
1050 finalize_animation_type_ == ANIMATION_ADD_USER) {
1051 if (!ash_util::IsRunningInMash()) {
1052 ash::Shell::Get()->wallpaper_controller()->MoveToUnlockedContainer();
xiyuan 2017/04/21 15:30:58 This is for user adding screen and should happen w
1053 } else {
1054 NOTIMPLEMENTED();
1055 }
1056 } 1032 }
1057 } 1033 }
1058 1034
1059 void LoginDisplayHostImpl::ScheduleWorkspaceAnimation() { 1035 void LoginDisplayHostImpl::ScheduleWorkspaceAnimation() {
1060 if (ash_util::IsRunningInMash()) { 1036 if (ash_util::IsRunningInMash()) {
1061 NOTIMPLEMENTED(); 1037 NOTIMPLEMENTED();
1062 return; 1038 return;
1063 } 1039 }
1064 if (ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), 1040 if (ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
1065 ash::kShellWindowId_WallpaperContainer) 1041 ash::kShellWindowId_WallpaperContainer)
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 // Chrome locale. Otherwise it will be lost if Chrome restarts. 1389 // Chrome locale. Otherwise it will be lost if Chrome restarts.
1414 // Don't need to schedule pref save because setting initial local 1390 // Don't need to schedule pref save because setting initial local
1415 // will enforce preference saving. 1391 // will enforce preference saving.
1416 prefs->SetString(prefs::kApplicationLocale, locale); 1392 prefs->SetString(prefs::kApplicationLocale, locale);
1417 StartupUtils::SetInitialLocale(locale); 1393 StartupUtils::SetInitialLocale(locale);
1418 1394
1419 TriggerShowLoginWizardFinish(locale, std::move(data)); 1395 TriggerShowLoginWizardFinish(locale, std::move(data));
1420 } 1396 }
1421 1397
1422 } // namespace chromeos 1398 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698