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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_sync_starter.cc

Issue 10534075: [sync] Make SetSetupInProgress kick sync engine when needed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove call to SetSyncSetupCompleted, and change kick-mechanism Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/signin/signin_manager.h" 9 #include "chrome/browser/signin/signin_manager.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
(...skipping 17 matching lines...) Expand all
28 int action = start_mode_ == SYNC_WITH_DEFAULT_SETTINGS ? 28 int action = start_mode_ == SYNC_WITH_DEFAULT_SETTINGS ?
29 one_click_signin::HISTOGRAM_WITH_DEFAULTS : 29 one_click_signin::HISTOGRAM_WITH_DEFAULTS :
30 one_click_signin::HISTOGRAM_WITH_ADVANCED; 30 one_click_signin::HISTOGRAM_WITH_ADVANCED;
31 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", action, 31 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", action,
32 one_click_signin::HISTOGRAM_MAX); 32 one_click_signin::HISTOGRAM_MAX);
33 33
34 ProfileSyncService* profile_sync_service = 34 ProfileSyncService* profile_sync_service =
35 ProfileSyncServiceFactory::GetForProfile(profile_); 35 ProfileSyncServiceFactory::GetForProfile(profile_);
36 // Let the sync service know that setup is in progress so it doesn't start 36 // Let the sync service know that setup is in progress so it doesn't start
37 // syncing until the user has finished any configuration. 37 // syncing until the user has finished any configuration.
38 profile_sync_service->set_setup_in_progress(true); 38 profile_sync_service->SetSetupInProgress(true);
39 SigninManager* manager = SigninManagerFactory::GetForProfile(profile_); 39 SigninManager* manager = SigninManagerFactory::GetForProfile(profile_);
40 manager->StartSignInWithCredentials(session_index, email, password); 40 manager->StartSignInWithCredentials(session_index, email, password);
41 } 41 }
42 42
43 OneClickSigninSyncStarter::~OneClickSigninSyncStarter() { 43 OneClickSigninSyncStarter::~OneClickSigninSyncStarter() {
44 } 44 }
45 45
46 void OneClickSigninSyncStarter::GaiaCredentialsValid() { 46 void OneClickSigninSyncStarter::GaiaCredentialsValid() {
47 } 47 }
48 48
49 void OneClickSigninSyncStarter::SigninFailed( 49 void OneClickSigninSyncStarter::SigninFailed(
50 const GoogleServiceAuthError& error) { 50 const GoogleServiceAuthError& error) {
51 ProfileSyncService* profile_sync_service = 51 ProfileSyncService* profile_sync_service =
52 ProfileSyncServiceFactory::GetForProfile(profile_); 52 ProfileSyncServiceFactory::GetForProfile(profile_);
53 profile_sync_service->set_setup_in_progress(false); 53 profile_sync_service->SetSetupInProgress(false);
54 delete this; 54 delete this;
55 } 55 }
56 56
57 void OneClickSigninSyncStarter::SigninSuccess() { 57 void OneClickSigninSyncStarter::SigninSuccess() {
58 ProfileSyncService* profile_sync_service = 58 ProfileSyncService* profile_sync_service =
59 ProfileSyncServiceFactory::GetForProfile(profile_); 59 ProfileSyncServiceFactory::GetForProfile(profile_);
60 60
61 if (start_mode_ == SYNC_WITH_DEFAULT_SETTINGS) { 61 if (start_mode_ == SYNC_WITH_DEFAULT_SETTINGS) {
62 // Just kick off the sync machine, no need to configure it first. 62 // Just kick off the sync machine, no need to configure it first.
63 profile_sync_service->SetSyncSetupCompleted(); 63 profile_sync_service->SetSyncSetupCompleted();
64 profile_sync_service->set_setup_in_progress(false); 64 profile_sync_service->SetSetupInProgress(false);
65 profile_sync_service->UnsuppressAndStart(); 65 profile_sync_service->UnsuppressAndStart();
66 } else { 66 } else {
67 // Give the user a chance to configure things. We don't clear the 67 // Give the user a chance to configure things. We don't clear the
68 // ProfileSyncService::setup_in_progress flag because we don't want sync 68 // ProfileSyncService::setup_in_progress flag because we don't want sync
69 // to start up until after the configure UI is displayed (the configure UI 69 // to start up until after the configure UI is displayed (the configure UI
70 // will clear the flag when the user is done setting up sync). 70 // will clear the flag when the user is done setting up sync).
71 LoginUIServiceFactory::GetForProfile(profile_)->ShowLoginUI(); 71 LoginUIServiceFactory::GetForProfile(profile_)->ShowLoginUI();
72 } 72 }
73 73
74 delete this; 74 delete this;
75 } 75 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_startup_unittest.cc ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698