Index: chrome/browser/ui/webui/signin/inline_login_handler_impl.cc |
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc |
index aa419e4c3f6e1eaa15049066ec8ca5a4ea46f34b..c0d8a7820e3e3f5a7d6e835ae37bb01621a86720 100644 |
--- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc |
+++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc |
@@ -513,6 +513,7 @@ void InlineLoginHandlerImpl::DidCommitProvisionalLoadForFrame( |
// static |
bool InlineLoginHandlerImpl::CanOffer(Profile* profile, |
CanOfferFor can_offer_for, |
+ const std::string& gaia_id, |
const std::string& email, |
std::string* error_message) { |
if (error_message) |
@@ -568,9 +569,14 @@ bool InlineLoginHandlerImpl::CanOffer(Profile* profile, |
if (profile_manager) { |
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
+ // For backward compatibility, need to also check the UserName of the |
Evan Stade
2015/05/11 17:11:54
nit: s/UserName/username
Roger Tawa OOO till Jul 10th
2015/05/11 20:34:36
Done.
|
+ // profile, since the GaiaId may not have been set yet for the |
Evan Stade
2015/05/11 17:11:54
s/GaiaId/GAIA ID
Roger Tawa OOO till Jul 10th
2015/05/11 20:34:36
Done.
|
+ // profile cache info. It will get set once the profile is opened. |
+ std::string profile_gaia_id = cache.GetGAIAIdOfProfileAtIndex(i); |
std::string profile_email = |
base::UTF16ToUTF8(cache.GetUserNameOfProfileAtIndex(i)); |
- if (gaia::AreEmailsSame(email, profile_email)) { |
+ if (gaia_id == profile_gaia_id || |
+ gaia::AreEmailsSame(email, profile_email)) { |
if (error_message) { |
error_message->assign( |
l10n_util::GetStringUTF8(IDS_SYNC_USER_NAME_IN_USE_ERROR)); |
@@ -685,7 +691,7 @@ void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) { |
std::string error_msg; |
bool can_offer = CanOffer(Profile::FromWebUI(web_ui()), can_offer_for, |
- email, &error_msg); |
+ gaia_id, email, &error_msg); |
if (!can_offer) { |
HandleLoginError(error_msg); |
return; |