summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/signin/profile_oauth2_token_service.cc9
-rw-r--r--chrome/browser/ui/sync/one_click_signin_helper.cc9
2 files changed, 15 insertions, 3 deletions
diff --git a/chrome/browser/signin/profile_oauth2_token_service.cc b/chrome/browser/signin/profile_oauth2_token_service.cc
index fff505d..8722688 100644
--- a/chrome/browser/signin/profile_oauth2_token_service.cc
+++ b/chrome/browser/signin/profile_oauth2_token_service.cc
@@ -155,6 +155,15 @@ void ProfileOAuth2TokenService::Observe(
break;
}
case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED:
+ // During startup, if the user is signed in and the OAuth2 refresh token
+ // is empty, flag it as an error by badging the menu. Otherwise, if the
+ // user goes on to set up sync, they will have to make two attempts:
+ // One to surface the OAuth2 error, and a second one after signing in.
+ // See crbug.com/276650.
+ if (!GetAccountId(profile_).empty() && GetRefreshToken().empty()) {
+ UpdateAuthError(GoogleServiceAuthError(
+ GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
+ }
FireRefreshTokensLoaded();
break;
default:
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc
index e6b6adb..3586f20 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc
@@ -1251,11 +1251,14 @@ void OneClickSigninHelper::DidStopLoading(
// default settings.
// - If sign in was initiated from the settings page for first time sync
// set up, show the advanced sync settings dialog.
- // - If sign in was initiated from the settings page due to a re-auth,
- // simply navigate back to the settings page.
+ // - If sign in was initiated from the settings page due to a re-auth when
+ // sync was already setup, simply navigate back to the settings page.
+ ProfileSyncService* sync_service =
+ ProfileSyncServiceFactory::GetForProfile(profile);
OneClickSigninSyncStarter::StartSyncMode start_mode =
source_ == signin::SOURCE_SETTINGS ?
- SigninGlobalError::GetForProfile(profile)->HasMenuItem() ?
+ (SigninGlobalError::GetForProfile(profile)->HasMenuItem() &&
+ sync_service && sync_service->HasSyncSetupCompleted()) ?
OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE :
OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST :
OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS;