Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3242)

Unified Diff: chrome/browser/ui/sync/one_click_signin_helper.cc

Issue 19567004: Convert SigninTracker to use OAuth2TokenService notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 67f0110efc4fb9e5e8e6533074e637a847ce09f7..9c361255a659eebedb8155aacd047b7b29ee44be 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc
@@ -584,6 +584,7 @@ OneClickSigninHelper::OneClickSigninHelper(content::WebContents* web_contents,
untrusted_navigations_since_signin_visit_(0),
untrusted_confirmation_required_(false),
do_not_clear_pending_email_(false),
+ do_not_start_sync_for_testing_(false),
weak_pointer_factory_(this) {
// May be NULL during testing.
if (password_manager) {
@@ -1037,6 +1038,10 @@ void OneClickSigninHelper::SetDoNotClearPendingEmailForTesting() {
do_not_clear_pending_email_ = true;
}
+void OneClickSigninHelper::set_do_not_start_sync_for_testing() {
+ do_not_start_sync_for_testing_ = true;
+}
+
void OneClickSigninHelper::NavigateToPendingEntry(
const GURL& url,
content::NavigationController::ReloadType reload_type) {
@@ -1212,13 +1217,15 @@ void OneClickSigninHelper::DidStopLoading(
SigninManager::DisableOneClickSignIn(profile);
// Start syncing with the default settings - prompt the user to sign in
// first.
- StartSync(
- StartSyncArgs(profile, browser, auto_accept_,
- session_index_, email_, password_,
- NULL /* don't force to show sync setup in same tab */,
- true /* confirmation_required */, source_,
- CreateSyncStarterCallback()),
- OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
+ if (!do_not_start_sync_for_testing_) {
+ StartSync(
+ StartSyncArgs(profile, browser, auto_accept_,
+ session_index_, email_, password_,
+ NULL /* don't force to show sync setup in same tab */,
+ true /* confirmation_required */, source_,
+ CreateSyncStarterCallback()),
+ OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
+ }
break;
case AUTO_ACCEPT_CONFIGURE:
LogOneClickHistogramValue(one_click_signin::HISTOGRAM_ACCEPTED);
@@ -1226,13 +1233,15 @@ void OneClickSigninHelper::DidStopLoading(
SigninManager::DisableOneClickSignIn(profile);
// Display the extra confirmation (even in the SAML case) in case this
// was an untrusted renderer.
- StartSync(
- StartSyncArgs(profile, browser, auto_accept_,
- session_index_, email_, password_,
- NULL /* don't force to show sync setup in same tab */,
- true /* confirmation_required */, source_,
- CreateSyncStarterCallback()),
- OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST);
+ if (!do_not_start_sync_for_testing_) {
+ StartSync(
+ StartSyncArgs(profile, browser, auto_accept_,
+ session_index_, email_, password_,
+ NULL /* don't force sync setup in same tab */,
+ true /* confirmation_required */, source_,
+ CreateSyncStarterCallback()),
+ OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST);
+ }
break;
case AUTO_ACCEPT_EXPLICIT: {
signin::Source original_source =
@@ -1287,12 +1296,14 @@ void OneClickSigninHelper::DidStopLoading(
contents,
start_mode));
} else {
- StartSync(
- StartSyncArgs(profile, browser, auto_accept_,
- session_index_, email_, password_, contents,
- untrusted_confirmation_required_, source_,
- CreateSyncStarterCallback()),
- start_mode);
+ if (!do_not_start_sync_for_testing_) {
+ StartSync(
+ StartSyncArgs(profile, browser, auto_accept_,
+ session_index_, email_, password_, contents,
+ untrusted_confirmation_required_, source_,
+ CreateSyncStarterCallback()),
+ 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
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_helper.h ('k') | chrome/browser/ui/sync/one_click_signin_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698