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

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 2685793004: Chromad: Wire up displayName and givenName (Closed)
Patch Set: Created 3 years, 10 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 (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 "chrome/browser/chromeos/login/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 if (login_performer_.get()) { 508 if (login_performer_.get()) {
509 VLOG(1) << "Create a new cryptohome and resync user data."; 509 VLOG(1) << "Create a new cryptohome and resync user data.";
510 login_performer_->ResyncEncryptedData(); 510 login_performer_->ResyncEncryptedData();
511 } 511 }
512 } 512 }
513 513
514 void ExistingUserController::SetDisplayEmail(const std::string& email) { 514 void ExistingUserController::SetDisplayEmail(const std::string& email) {
515 display_email_ = email; 515 display_email_ = email;
516 } 516 }
517 517
518 void ExistingUserController::SetDisplayName(const std::string& display_name) {
519 display_name_ = base::UTF8ToUTF16(display_name);
520 }
521
522 void ExistingUserController::SetGivenName(const std::string& given_name) {
523 given_name_ = base::UTF8ToUTF16(given_name);
524 }
525
518 void ExistingUserController::ShowWrongHWIDScreen() { 526 void ExistingUserController::ShowWrongHWIDScreen() {
519 host_->StartWizard(OobeScreen::SCREEN_WRONG_HWID); 527 host_->StartWizard(OobeScreen::SCREEN_WRONG_HWID);
520 } 528 }
521 529
522 void ExistingUserController::Signout() { 530 void ExistingUserController::Signout() {
523 NOTREACHED(); 531 NOTREACHED();
524 } 532 }
525 533
526 bool ExistingUserController::IsUserWhitelisted(const AccountId& account_id) { 534 bool ExistingUserController::IsUserWhitelisted(const AccountId& account_id) {
527 bool wildcard_match = false; 535 bool wildcard_match = false;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 StartAutoLoginTimer(); 666 StartAutoLoginTimer();
659 } 667 }
660 668
661 // Reset user flow to default, so that special flow will not affect next 669 // Reset user flow to default, so that special flow will not affect next
662 // attempt. 670 // attempt.
663 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_id_); 671 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_id_);
664 672
665 if (auth_status_consumer_) 673 if (auth_status_consumer_)
666 auth_status_consumer_->OnAuthFailure(failure); 674 auth_status_consumer_->OnAuthFailure(failure);
667 675
668 // Clear the recorded displayed email so it won't affect any future attempts. 676 ClearRecoredNames();
669 display_email_.clear();
670 677
671 // TODO(ginkage): Fix this case once crbug.com/469990 is ready. 678 // TODO(ginkage): Fix this case once crbug.com/469990 is ready.
672 /* 679 /*
673 if (failure.reason() == AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME) { 680 if (failure.reason() == AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME) {
674 RecordReauthReason(last_login_attempt_account_id_, 681 RecordReauthReason(last_login_attempt_account_id_,
675 ReauthReason::MISSING_CRYPTOHOME); 682 ReauthReason::MISSING_CRYPTOHOME);
676 } 683 }
677 */ 684 */
678 } 685 }
679 686
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 : UserSessionManager::PRIMARY_USER_SESSION; 724 : UserSessionManager::PRIMARY_USER_SESSION;
718 UserSessionManager::GetInstance()->StartSession( 725 UserSessionManager::GetInstance()->StartSession(
719 user_context, start_session_type, has_auth_cookies, 726 user_context, start_session_type, has_auth_cookies,
720 false, // Start session for user. 727 false, // Start session for user.
721 this); 728 this);
722 729
723 // Update user's displayed email. 730 // Update user's displayed email.
724 if (!display_email_.empty()) { 731 if (!display_email_.empty()) {
725 user_manager::UserManager::Get()->SaveUserDisplayEmail( 732 user_manager::UserManager::Get()->SaveUserDisplayEmail(
726 user_context.GetAccountId(), display_email_); 733 user_context.GetAccountId(), display_email_);
727 display_email_.clear();
728 } 734 }
735 if (!display_name_.empty() || !given_name_.empty()) {
736 user_manager::UserManager::Get()->UpdateUserAccountData(
737 user_context.GetAccountId(),
738 user_manager::UserManager::UserAccountData(display_name_, given_name_,
739 std::string() /* locale */));
740 }
741 ClearRecoredNames();
729 } 742 }
730 743
731 void ExistingUserController::OnProfilePrepared(Profile* profile, 744 void ExistingUserController::OnProfilePrepared(Profile* profile,
732 bool browser_launched) { 745 bool browser_launched) {
733 // Reenable clicking on other windows and status area. 746 // Reenable clicking on other windows and status area.
734 login_display_->SetUIEnabled(true); 747 login_display_->SetUIEnabled(true);
735 748
736 if (browser_launched) 749 if (browser_launched)
737 host_ = nullptr; 750 host_ = nullptr;
738 751
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 void ExistingUserController::WhiteListCheckFailed(const std::string& email) { 812 void ExistingUserController::WhiteListCheckFailed(const std::string& email) {
800 PerformLoginFinishedActions(true /* start auto login timer */); 813 PerformLoginFinishedActions(true /* start auto login timer */);
801 814
802 login_display_->ShowWhitelistCheckFailedError(); 815 login_display_->ShowWhitelistCheckFailedError();
803 816
804 if (auth_status_consumer_) { 817 if (auth_status_consumer_) {
805 auth_status_consumer_->OnAuthFailure( 818 auth_status_consumer_->OnAuthFailure(
806 AuthFailure(AuthFailure::WHITELIST_CHECK_FAILED)); 819 AuthFailure(AuthFailure::WHITELIST_CHECK_FAILED));
807 } 820 }
808 821
809 display_email_.clear(); 822 ClearRecoredNames();
810 } 823 }
811 824
812 void ExistingUserController::PolicyLoadFailed() { 825 void ExistingUserController::PolicyLoadFailed() {
813 ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, ""); 826 ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, "");
814 827
815 PerformLoginFinishedActions(false /* don't start auto login timer */); 828 PerformLoginFinishedActions(false /* don't start auto login timer */);
816 display_email_.clear(); 829 ClearRecoredNames();
817 } 830 }
818 831
819 void ExistingUserController::SetAuthFlowOffline(bool offline) { 832 void ExistingUserController::SetAuthFlowOffline(bool offline) {
820 auth_flow_offline_ = offline; 833 auth_flow_offline_ = offline;
821 } 834 }
822 835
823 //////////////////////////////////////////////////////////////////////////////// 836 ////////////////////////////////////////////////////////////////////////////////
824 // ExistingUserController, private: 837 // ExistingUserController, private:
825 838
826 void ExistingUserController::DeviceSettingsChanged() { 839 void ExistingUserController::DeviceSettingsChanged() {
(...skipping 23 matching lines...) Expand all
850 void ExistingUserController::LoginAsGuest() { 863 void ExistingUserController::LoginAsGuest() {
851 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_GUEST, 864 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_GUEST,
852 user_manager::GuestAccountId())); 865 user_manager::GuestAccountId()));
853 866
854 bool allow_guest; 867 bool allow_guest;
855 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); 868 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest);
856 if (!allow_guest) { 869 if (!allow_guest) {
857 // Disallowed. The UI should normally not show the guest session button. 870 // Disallowed. The UI should normally not show the guest session button.
858 LOG(ERROR) << "Guest login attempt when guest mode is disallowed."; 871 LOG(ERROR) << "Guest login attempt when guest mode is disallowed.";
859 PerformLoginFinishedActions(true /* start auto login timer */); 872 PerformLoginFinishedActions(true /* start auto login timer */);
860 display_email_.clear(); 873 ClearRecoredNames();
861 return; 874 return;
862 } 875 }
863 876
864 // Only one instance of LoginPerformer should exist at a time. 877 // Only one instance of LoginPerformer should exist at a time.
865 login_performer_.reset(nullptr); 878 login_performer_.reset(nullptr);
866 login_performer_.reset(new ChromeLoginPerformer(this)); 879 login_performer_.reset(new ChromeLoginPerformer(this));
867 login_performer_->LoginOffTheRecord(); 880 login_performer_->LoginOffTheRecord();
868 SendAccessibilityAlert( 881 SendAccessibilityAlert(
869 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_OFFRECORD)); 882 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_OFFRECORD));
870 } 883 }
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 return; 1354 return;
1342 } 1355 }
1343 1356
1344 // Otherwise, show the unrecoverable cryptohome error UI and ask user's 1357 // Otherwise, show the unrecoverable cryptohome error UI and ask user's
1345 // permission to collect a feedback. 1358 // permission to collect a feedback.
1346 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE); 1359 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE);
1347 VLOG(1) << "Show unrecoverable cryptohome error dialog."; 1360 VLOG(1) << "Show unrecoverable cryptohome error dialog.";
1348 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); 1361 login_display_->ShowUnrecoverableCrypthomeErrorDialog();
1349 } 1362 }
1350 1363
1364 void ExistingUserController::ClearRecoredNames() {
1365 display_email_.clear();
1366 display_name_.clear();
1367 given_name_.clear();
1368 }
1369
1351 } // namespace chromeos 1370 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698