Commit a6b2d02a authored by rogerta@chromium.org's avatar rogerta@chromium.org

Better handling of a bad sync server URL. When choosing to configure before

enabling sync, now shows a spinner instead of a blank page.

BUG=244768

Review URL: https://chromiumcodereview.appspot.com/16335013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204091 0039d316-1c4b-4281-b951-d872f2087c98
parent 721ac99f
......@@ -102,6 +102,13 @@ void OneClickSigninSyncStarter::Initialize(Profile* profile, Browser* browser) {
}
void OneClickSigninSyncStarter::GaiaCredentialsValid() {
// TODO(rogerta): We could |delete this| right after calling ConfigureSync(),
// but this deletes the |signin_tracker_| member too. SigninTracker does
// handle being deleted from within the GaiaCredentialsValid() callback.
// So this object will live until either SigninSuccess() or SigninFailed()
// is called, which is fine.
if (start_mode_== CONFIGURE_SYNC_FIRST)
ConfigureSync();
}
void OneClickSigninSyncStarter::ConfirmSignin(const std::string& oauth_token) {
......@@ -313,7 +320,6 @@ void OneClickSigninSyncStarter::UntrustedSigninConfirmed(
}
}
void OneClickSigninSyncStarter::SigninFailed(
const GoogleServiceAuthError& error) {
FinishProfileSyncServiceSetup();
......@@ -336,31 +342,31 @@ void OneClickSigninSyncStarter::SigninFailed(
}
void OneClickSigninSyncStarter::SigninSuccess() {
ProfileSyncService* profile_sync_service = GetProfileSyncService();
switch (start_mode_) {
case SYNC_WITH_DEFAULT_SETTINGS:
if (profile_sync_service) {
// Just kick off the sync machine, no need to configure it first.
profile_sync_service->OnUserChoseDatatypes(true,
syncer::ModelTypeSet());
profile_sync_service->SetSyncSetupCompleted();
}
FinishProfileSyncServiceSetup();
if (confirmation_required_ == CONFIRM_AFTER_SIGNIN) {
string16 message;
if (!profile_sync_service) {
// Sync is disabled by policy.
message = l10n_util::GetStringUTF16(
IDS_ONE_CLICK_SIGNIN_BUBBLE_SYNC_DISABLED_MESSAGE);
}
DisplayFinalConfirmationBubble(message);
// TODO(rogerta): For the moment, the calls to ProfileSyncService require
// that the sync backend already be initialized. Therefore the default
// settings case needs to be handled in the SigninSuccess() callback.
// However, ProfileSyncService should be modified to not require an
// initialized backend, at which point this code could be moved to
// the GaiaCredentialsValid() callback. The ProfileSyncService changes are
// being tracked in crbug.com/246618.
if (start_mode_ == SYNC_WITH_DEFAULT_SETTINGS) {
ProfileSyncService* profile_sync_service = GetProfileSyncService();
if (profile_sync_service) {
// Just kick off the sync machine, no need to configure it first.
profile_sync_service->OnUserChoseDatatypes(true,
syncer::ModelTypeSet());
profile_sync_service->SetSyncSetupCompleted();
}
FinishProfileSyncServiceSetup();
if (confirmation_required_ == CONFIRM_AFTER_SIGNIN) {
string16 message;
if (!profile_sync_service) {
// Sync is disabled by policy.
message = l10n_util::GetStringUTF16(
IDS_ONE_CLICK_SIGNIN_BUBBLE_SYNC_DISABLED_MESSAGE);
}
break;
case CONFIGURE_SYNC_FIRST:
ConfigureSync();
break;
default:
NOTREACHED() << "Invalid start_mode=" << start_mode_;
DisplayFinalConfirmationBubble(message);
}
}
delete this;
}
......
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