Index: chrome/browser/ui/auto_login_prompter.cc |
diff --git a/chrome/browser/ui/auto_login_prompter.cc b/chrome/browser/ui/auto_login_prompter.cc |
index 9d9bff0c2c683bee7668e119e510d0f256dc0121..70311db135a30bb0a1e14e8b28d85fdb178282fd 100644 |
--- a/chrome/browser/ui/auto_login_prompter.cc |
+++ b/chrome/browser/ui/auto_login_prompter.cc |
@@ -31,16 +31,18 @@ namespace { |
bool FetchUsernameThroughSigninManager(Profile* profile, std::string* output) { |
// In an incognito window these services are not available. |
- ProfileOAuth2TokenService* token_service = |
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
- if (!token_service || !token_service->RefreshTokenIsAvailable()) |
- return false; |
- |
SigninManagerBase* signin_manager = |
SigninManagerFactory::GetInstance()->GetForProfile(profile); |
if (!signin_manager) |
return false; |
+ ProfileOAuth2TokenService* token_service = |
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
+ if (!token_service || !token_service->RefreshTokenIsAvailable( |
+ token_service->GetPrimaryAccountId())) { |
+ return false; |
+ } |
+ |
*output = signin_manager->GetAuthenticatedUsername(); |
return true; |
} |