Index: components/signin/core/browser/mutable_profile_oauth2_token_service.cc |
diff --git a/components/signin/core/browser/mutable_profile_oauth2_token_service.cc b/components/signin/core/browser/mutable_profile_oauth2_token_service.cc |
index b3a19f8730aa5b4c91ac4826eb356839d261c07d..849c7731fc76e784ab7c90948b1c661b353c4f30 100644 |
--- a/components/signin/core/browser/mutable_profile_oauth2_token_service.cc |
+++ b/components/signin/core/browser/mutable_profile_oauth2_token_service.cc |
@@ -112,13 +112,6 @@ MutableProfileOAuth2TokenService::AccountInfo::GetAccountId() const { |
return account_id_; |
} |
-std::string |
-MutableProfileOAuth2TokenService::AccountInfo::GetUsername() const { |
- // TODO(rogerta): when |account_id| becomes the obfuscated gaia id, this |
- // will need to be changed. |
- return account_id_; |
-} |
- |
GoogleServiceAuthError |
MutableProfileOAuth2TokenService::AccountInfo::GetAuthStatus() const { |
return last_auth_error_; |
@@ -208,7 +201,16 @@ void MutableProfileOAuth2TokenService::LoadCredentials( |
CancelAllRequests(); |
refresh_tokens().clear(); |
- loading_primary_account_id_ = primary_account_id; |
+ |
+ // If the account_id is an email address, then canonicalize it. This |
+ // is to support legacy account_ids, and will not be needed after |
+ // switching to gaia-ids. |
+ if (primary_account_id.find('@') != std::string::npos) { |
+ loading_primary_account_id_ = gaia::CanonicalizeEmail(primary_account_id); |
+ } else { |
+ loading_primary_account_id_ = primary_account_id; |
+ } |
+ |
scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase(); |
if (token_web_data.get()) |
web_data_service_request_ = token_web_data->GetAllTokens(this); |