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 8240c194c8c035ae8ff900f174d9ed407d7f253f..d96d17f1a1af02ff058d38364c573b9a471b30bd 100644 |
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc |
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc |
@@ -10,7 +10,7 @@ |
#include <vector> |
#include "base/bind.h" |
-#include "base/callback_forward.h" |
+#include "base/callback.h" |
#include "base/callback_helpers.h" |
#include "base/compiler_specific.h" |
#include "base/metrics/field_trial.h" |
@@ -245,6 +245,7 @@ void StartSync(const StartSyncArgs& args, |
void StartExplicitSync(const StartSyncArgs& args, |
content::WebContents* contents, |
OneClickSigninSyncStarter::StartSyncMode start_mode, |
+ base::Closure start_sync_callback, |
int button) { |
if (button == IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_OK_BUTTON) { |
contents->GetController().LoadURL( |
@@ -254,6 +255,7 @@ void StartExplicitSync(const StartSyncArgs& args, |
std::string(chrome::kSearchUsersSubPage)); |
} else { |
StartSync(args, start_mode); |
+ start_sync_callback.Run(); |
} |
} |
@@ -916,6 +918,12 @@ void OneClickSigninHelper::RedirectToNtpOrAppsPage() { |
contents->OpenURL(params); |
} |
+void OneClickSigninHelper::RedirectToNtpOrAppsPageIfNecessary() { |
+ if (source_ != SyncPromoUI::SOURCE_SETTINGS && |
+ source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) |
+ RedirectToNtpOrAppsPage(); |
Roger Tawa OOO till Jul 10th
2013/06/05 23:48:37
Add { and } for if statement.
fdoray
2013/06/10 15:44:13
Done.
|
+} |
+ |
void OneClickSigninHelper::RedirectToSignin() { |
VLOG(1) << "OneClickSigninHelper::RedirectToSignin"; |
@@ -1176,6 +1184,15 @@ void OneClickSigninHelper::DidStopLoading( |
LogHistogramValue(source_, one_click_signin::HISTOGRAM_ACCEPTED); |
LogHistogramValue(source_, one_click_signin::HISTOGRAM_WITH_DEFAULTS); |
} |
+ |
+ // Remove the blank page from the history of the current tab. It's not |
+ // necessary to do this if the sign in is from the Settings page / |
+ // Webstore because the current tab will be closed after sign in |
+ // completes. |
+ if (source_ != SyncPromoUI::SOURCE_SETTINGS && |
+ source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) |
+ RemoveCurrentHistoryItem(contents); |
+ |
OneClickSigninSyncStarter::StartSyncMode start_mode = |
source_ == SyncPromoUI::SOURCE_SETTINGS ? |
OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST : |
@@ -1201,13 +1218,22 @@ void OneClickSigninHelper::DidStopLoading( |
force_same_tab_navigation, |
false /* confirmation_required */, source_), |
contents, |
- start_mode)); |
+ start_mode, |
+ base::Bind( |
+ &OneClickSigninHelper::RedirectToNtpOrAppsPageIfNecessary, |
+ base::Unretained(this)))); |
} else { |
StartSync( |
StartSyncArgs(profile, browser, auto_accept_, session_index_, |
email_, password_, force_same_tab_navigation, |
untrusted_confirmation_required_, source_), |
start_mode); |
+ |
+ // If this explicit sign in is not from settings page/webstore, show |
+ // the NTP/Apps page after sign in completes. In the case of the |
+ // settings page, it will get closed by SyncSetupHandler. In the case |
+ // of webstore, it will redirect back to webstore. |
+ RedirectToNtpOrAppsPageIfNecessary(); |
} |
if (source_ == SyncPromoUI::SOURCE_SETTINGS && |
@@ -1219,16 +1245,6 @@ void OneClickSigninHelper::DidStopLoading( |
if (sync_service) |
sync_service->AddObserver(this); |
} |
- |
- // If this explicit sign in is not from settings page/webstore, show the |
- // NTP/Apps page after sign in completes. In the case of the settings |
- // page, it will get closed by SyncSetupHandler. In the case of webstore, |
- // it will redirect back to webstore. |
- if (source_ != SyncPromoUI::SOURCE_SETTINGS && |
- source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { |
- RemoveCurrentHistoryItem(contents); |
- RedirectToNtpOrAppsPage(); |
- } |
break; |
} |
case AUTO_ACCEPT_REJECTED_FOR_PROFILE: |