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

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

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

Powered by Google App Engine
This is Rietveld 408576698