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

Unified Diff: components/signin/core/browser/mutable_profile_oauth2_token_service.cc

Issue 617183003: Make sure GetAuthenticatedAccountId() returns a canonicalized id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 6 years, 2 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: 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 a9e4442911008541480af2cf26eaabcb3ca43aa2..fc28a0a686d0e6c8d1e667e364d420eb86bbce03 100644
--- a/components/signin/core/browser/mutable_profile_oauth2_token_service.cc
+++ b/components/signin/core/browser/mutable_profile_oauth2_token_service.cc
@@ -9,6 +9,7 @@
#include "components/signin/core/browser/webdata/token_web_data.h"
#include "components/webdata/common/web_data_service_base.h"
#include "google_apis/gaia/gaia_auth_fetcher.h"
+#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "google_apis/gaia/oauth2_access_token_fetcher_impl.h"
@@ -243,10 +244,16 @@ void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory(
} else {
DCHECK(!refresh_token.empty());
std::string account_id = RemoveAccountIdPrefix(prefixed_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 (account_id.find('@') != std::string::npos)
+ account_id = gaia::CanonicalizeDomain(account_id);
+
refresh_tokens()[account_id].reset(
new AccountInfo(this, account_id, refresh_token));
FireRefreshTokenAvailable(account_id);
- // TODO(fgorski): Notify diagnostic observers.
}
}

Powered by Google App Engine
This is Rietveld 408576698