Index: chrome/browser/ui/sync/one_click_signin_helper.cc |
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc |
index 90b0f3be5c68e5db1139c945060b91b06fd2de50..e138f7c1cf068786c1750094cfaff76150fdf8fd 100644 |
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc |
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc |
@@ -99,14 +99,14 @@ struct StartSyncArgs { |
const std::string& session_index, |
const std::string& email, |
const std::string& password, |
- bool last_minute_source_change) |
+ bool force_same_tab_navigation) |
: profile(profile), |
browser(browser), |
auto_accept(auto_accept), |
session_index(session_index), |
email(email), |
password(password), |
- last_minute_source_change(last_minute_source_change) { |
+ force_same_tab_navigation(force_same_tab_navigation) { |
} |
Profile* profile; |
@@ -115,7 +115,7 @@ struct StartSyncArgs { |
std::string session_index; |
std::string email; |
std::string password; |
- bool last_minute_source_change; |
+ bool force_same_tab_navigation; |
}; |
// Start syncing with the given user information. |
@@ -130,20 +130,19 @@ void StartSync(const StartSyncArgs& args, |
// The starter deletes itself once its done. |
new OneClickSigninSyncStarter(args.profile, args.browser, args.session_index, |
args.email, args.password, start_mode, |
- /* force_same_tab_navigation */ |
- args.last_minute_source_change); |
+ args.force_same_tab_navigation); |
int action = one_click_signin::HISTOGRAM_MAX; |
switch (args.auto_accept) { |
case OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT: |
- action = one_click_signin::HISTOGRAM_AUTO_WITH_DEFAULTS; |
- break; |
- case OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED: |
action = |
start_mode == OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS ? |
one_click_signin::HISTOGRAM_AUTO_WITH_DEFAULTS : |
one_click_signin::HISTOGRAM_AUTO_WITH_ADVANCED; |
break; |
+ case OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED: |
+ action = one_click_signin::HISTOGRAM_AUTO_WITH_DEFAULTS; |
+ break; |
case OneClickSigninHelper::AUTO_ACCEPT_NONE: |
action = |
start_mode == OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS ? |
@@ -452,7 +451,7 @@ bool OneClickInfoBarDelegateImpl::Accept() { |
StartSyncArgs(profile, browser, |
OneClickSigninHelper::AUTO_ACCEPT_NONE, |
session_index_, email_, password_, |
- false /* last_minute_source_change */))); |
+ false /* force_same_tab_navigation */))); |
button_pressed_ = true; |
return true; |
} |
@@ -960,7 +959,7 @@ void OneClickSigninHelper::DidStopLoading( |
// comminucated back to chrome when Gaia redirects to the continue URL, and |
Andrew T Wilson (Slow)
2013/02/15 10:11:49
nit:comminucated->communicated
Roger Tawa OOO till Jul 10th
2013/02/15 15:19:44
Done.
|
// this is considered here a last minute change to the source. See a little |
// further below for when this variable is set to true. |
- bool last_minute_source_change = false; |
+ bool force_same_tab_navigation = false; |
if (SyncPromoUI::UseWebBasedSigninFlow()) { |
if (IsValidGaiaSigninRedirectOrResponseURL(url)) |
@@ -993,17 +992,20 @@ void OneClickSigninHelper::DidStopLoading( |
return; |
} |
- // In explicit sign ins, the user may have checked the box |
+ // In explicit sign ins, the user may have changed the box |
// "Let me choose what to sync". This is reflected as a change in the |
// source of the continue URL. Make one last check of the current URL |
- // to see if there is a valid source and its set to settings. If so, |
- // it overrides the current source. |
+ // to see if there is a valid source. If so, it overrides the |
+ // current source. |
+ // |
+ // If the source was changed to SOURCE_SETTINGS, we want |
+ // OneClickSigninSyncStarter to reuse the current tab to display the |
+ // advanced configuration. |
SyncPromoUI::Source source = |
SyncPromoUI::GetSourceForSyncPromoURL(url); |
- if (source == SyncPromoUI::SOURCE_SETTINGS && |
- source_ != SyncPromoUI::SOURCE_SETTINGS) { |
- source_ = SyncPromoUI::SOURCE_SETTINGS; |
- last_minute_source_change = true; |
+ if (source != source_) { |
+ source_ = source; |
+ force_same_tab_navigation = source_ == SyncPromoUI::SOURCE_SETTINGS; |
} |
} |
} |
@@ -1042,19 +1044,19 @@ void OneClickSigninHelper::DidStopLoading( |
base::Bind(&StartSync, |
StartSyncArgs(profile, browser, auto_accept_, |
session_index_, email_, password_, |
- false /* last_minute_source_change */))); |
+ false /* force_same_tab_navigation */))); |
break; |
case AUTO_ACCEPT_CONFIGURE: |
SigninManager::DisableOneClickSignIn(profile); |
StartSync( |
StartSyncArgs(profile, browser, auto_accept_, session_index_, email_, |
- password_, false /* last_minute_source_change */), |
+ password_, false /* force_same_tab_navigation */), |
OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); |
break; |
case AUTO_ACCEPT_EXPLICIT: { |
OneClickSigninSyncStarter::StartSyncMode start_mode = |
- source_ == SyncPromoUI::SOURCE_SETTINGS ? |
- OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST : |
+ source_ == SyncPromoUI::SOURCE_SETTINGS ? |
+ OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST : |
OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; |
// If the new email address is different from the email address that |
@@ -1070,19 +1072,19 @@ void OneClickSigninHelper::DidStopLoading( |
&StartExplicitSync, |
StartSyncArgs(profile, browser, auto_accept_, |
session_index_, email_, password_, |
- last_minute_source_change), |
+ force_same_tab_navigation), |
contents, |
start_mode)); |
} else { |
StartExplicitSync( |
StartSyncArgs(profile, browser, auto_accept_, session_index_, |
- email_, password_, last_minute_source_change), |
+ email_, password_, force_same_tab_navigation), |
contents, |
start_mode, |
IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_CANCEL_BUTTON); |
} |
- if (last_minute_source_change && |
+ if (source_ == SyncPromoUI::SOURCE_SETTINGS && |
SyncPromoUI::GetSourceForSyncPromoURL(continue_url_) == |
SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { |
redirect_url_ = continue_url_; |