Commit 0eec43ec authored by guohui@chromium.org's avatar guohui@chromium.org

Make sure sync setup completes when signing in from the avatar bubble with modal warnings

When signing in from the new avatar bubble, since the inline template has no "choose what to sync" link, thus Chrome shows an inline confirmation in the avatar bubble upon signin completes and blocks sync until the bubble is closed.

However, when some modal warnings show up before signin completes, they steal the focus thus the avatar bubble wont be able to show confirmation for sync settings and sync will be blocked infinitely.

A temporary workaround is to just start sync immediately if a modal warning is shown, since in all cases the dialog mentions that user data will be synced.

I will add a sync settings link to all modal dialogs later so that user could configure sync settings before sync starts.

BUG=435423005

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288122 0039d316-1c4b-4281-b951-d872f2087c98
parent 25648a07
......@@ -1187,6 +1187,16 @@ bool OneClickSigninHelper::HandleCrossAccountError(
profile, chrome::GetActiveDesktop());
content::WebContents* contents =
browser->tab_strip_model()->GetActiveWebContents();
// If the user signs in from the new avatar bubble, the confirm email dialog
// would dismiss the avatar bubble, thus it won't show any confirmation upon
// sign in completes. This confirmation dialog already mentions that user
// data would be synced, thus we just start sync immediately.
// TODO(guohui): add a sync settings link to allow user to configure sync
// settings before sync starts.
if (start_mode == OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST)
start_mode = OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS;
ConfirmEmailDialogDelegate::AskForConfirmation(
contents,
last_email,
......
......@@ -185,14 +185,41 @@ void OneClickSigninSyncStarter::SigninDialogDelegate::OnCancelSignin() {
void OneClickSigninSyncStarter::SigninDialogDelegate::OnContinueSignin() {
SetUserChoiceHistogram(SIGNIN_CHOICE_CONTINUE);
if (sync_starter_ != NULL)
if (sync_starter_ != NULL) {
// If the user signs in from the new avatar bubble, the enterprise
// confirmation dialog would dismiss the avatar bubble, thus it won't show
// any confirmation upon sign in completes. This cofirmation dialog already
// mentions that user data would be synced, thus we just start sync
// immediately.
// TODO(guohui): add a sync settings link to allow user to configure sync
// settings before sync starts.
if (sync_starter_->GetStartSyncMode() == CONFIRM_SYNC_SETTINGS_FIRST)
sync_starter_->SetStartSyncMode(SYNC_WITH_DEFAULT_SETTINGS);
sync_starter_->LoadPolicyWithCachedCredentials();
}
}
void OneClickSigninSyncStarter::SigninDialogDelegate::OnSigninWithNewProfile() {
SetUserChoiceHistogram(SIGNIN_CHOICE_NEW_PROFILE);
if (sync_starter_ != NULL)
if (sync_starter_ != NULL) {
// TODO(guohui): add a sync settings link to allow user to configure sync
// settings before sync starts.
if (sync_starter_->GetStartSyncMode() == CONFIRM_SYNC_SETTINGS_FIRST)
sync_starter_->SetStartSyncMode(SYNC_WITH_DEFAULT_SETTINGS);
sync_starter_->CreateNewSignedInProfile();
}
}
void OneClickSigninSyncStarter::SetStartSyncMode(StartSyncMode start_mode) {
start_mode_ = start_mode;
}
OneClickSigninSyncStarter::StartSyncMode
OneClickSigninSyncStarter::GetStartSyncMode() {
return start_mode_;
}
void OneClickSigninSyncStarter::OnRegisteredForPolicy(
......@@ -369,8 +396,17 @@ void OneClickSigninSyncStarter::UntrustedSigninConfirmed(
} else {
// If the user clicked the "Advanced" link in the confirmation dialog, then
// override the current start_mode_ to bring up the advanced sync settings.
// If the user signs in from the new avatar bubble, the untrusted dialog
// would dismiss the avatar bubble, thus it won't show any confirmation upon
// sign in completes. This dialog already has a settings link, thus we just
// start sync immediately .
if (response == CONFIGURE_SYNC_FIRST)
start_mode_ = response;
else if (start_mode_ == CONFIRM_SYNC_SETTINGS_FIRST)
start_mode_ = SYNC_WITH_DEFAULT_SETTINGS;
SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
signin->CompletePendingSignin();
}
......
......@@ -218,6 +218,11 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer,
// Loads the |continue_url_| in the current tab.
void LoadContinueUrl();
// Sets/gets the start sync mode. Called by SigninDialogDelegate to override
// the start sync mode if needed.
void SetStartSyncMode(StartSyncMode start_mode);
StartSyncMode GetStartSyncMode();
Profile* profile_;
Browser* browser_;
scoped_ptr<SigninTracker> signin_tracker_;
......
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