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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/existing_user_controller.cc
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 17748e8f345a15718157c50b91aaab15b593b8b2..40e3b8386c317a89d954657e3b7776fa520f8e10 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -515,6 +515,13 @@ void ExistingUserController::SetDisplayEmail(const std::string& email) {
display_email_ = email;
}
+void ExistingUserController::SetDisplayAndGivenName(
+ const std::string& display_name,
+ const std::string& given_name) {
+ display_name_ = base::UTF8ToUTF16(display_name);
+ given_name_ = base::UTF8ToUTF16(given_name);
+}
+
void ExistingUserController::ShowWrongHWIDScreen() {
host_->StartWizard(OobeScreen::SCREEN_WRONG_HWID);
}
@@ -665,8 +672,7 @@ void ExistingUserController::OnAuthFailure(const AuthFailure& failure) {
if (auth_status_consumer_)
auth_status_consumer_->OnAuthFailure(failure);
- // Clear the recorded displayed email so it won't affect any future attempts.
- display_email_.clear();
+ ClearRecordedNames();
// TODO(ginkage): Fix this case once crbug.com/469990 is ready.
/*
@@ -724,8 +730,14 @@ void ExistingUserController::OnAuthSuccess(const UserContext& user_context) {
if (!display_email_.empty()) {
user_manager::UserManager::Get()->SaveUserDisplayEmail(
user_context.GetAccountId(), display_email_);
- display_email_.clear();
}
+ if (!display_name_.empty() || !given_name_.empty()) {
+ user_manager::UserManager::Get()->UpdateUserAccountData(
+ user_context.GetAccountId(),
+ user_manager::UserManager::UserAccountData(display_name_, given_name_,
+ std::string() /* locale */));
+ }
+ ClearRecordedNames();
}
void ExistingUserController::OnProfilePrepared(Profile* profile,
@@ -806,14 +818,14 @@ void ExistingUserController::WhiteListCheckFailed(const std::string& email) {
AuthFailure(AuthFailure::WHITELIST_CHECK_FAILED));
}
- display_email_.clear();
+ ClearRecordedNames();
}
void ExistingUserController::PolicyLoadFailed() {
ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, "");
PerformLoginFinishedActions(false /* don't start auto login timer */);
- display_email_.clear();
+ ClearRecordedNames();
}
void ExistingUserController::SetAuthFlowOffline(bool offline) {
@@ -857,7 +869,7 @@ void ExistingUserController::LoginAsGuest() {
// Disallowed. The UI should normally not show the guest session button.
LOG(ERROR) << "Guest login attempt when guest mode is disallowed.";
PerformLoginFinishedActions(true /* start auto login timer */);
- display_email_.clear();
+ ClearRecordedNames();
return;
}
@@ -1348,4 +1360,10 @@ void ExistingUserController::OnTokenHandleChecked(
login_display_->ShowUnrecoverableCrypthomeErrorDialog();
}
+void ExistingUserController::ClearRecordedNames() {
+ display_email_.clear();
+ display_name_.clear();
+ given_name_.clear();
+}
+
} // namespace chromeos
« 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