Commit ae3b19fc authored by sail@chromium.org's avatar sail@chromium.org

Revert 221035 "Revert 219146 "[sync] Force re-auth during sync s..."

Restoring the change. Verified that this was not the cause of bug 278543.

> Revert 219146 "[sync] Force re-auth during sync setup if Oauth2 ..."
> 
> > [sync] Force re-auth during sync setup if Oauth2 token is unavailable
> > 
> > If an enterprise user disables sync via a dashboard clear, and goes on
> > to re-enable sync at a later time, set up can fail due to an expired or
> > missing Oauth2 token.
> > 
> > This patch updates SyncSetupHandler::OpenSyncSetup to first check if an
> > auth token is available for sync, and if not, force a re-auth.
> > 
> > R=atwilson
> > TBR=fgorski,rogerta
> > BUG=276650
> > TEST=Disable sync for an enterprise user, exit chrome, delete "Web
> > Data*" from the profile dir, restart chrome, and set up sync. Re-auth
> > must be forced in this case.
> > 
> > Review URL: https://chromiumcodereview.appspot.com/23005016
> 
> TBR=rsimha@chromium.org
> 
> Review URL: https://codereview.chromium.org/23759003

TBR=sail@chromium.org

Review URL: https://codereview.chromium.org/23458028

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221740 0039d316-1c4b-4281-b951-d872f2087c98
parent f46422ca
......@@ -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:
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment