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

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

Issue 10885011: Its possible for sync to be suppressed before the user attempts one-click (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/signin/signin_manager.h" 8 #include "chrome/browser/signin/signin_manager.h"
9 #include "chrome/browser/signin/signin_manager_factory.h" 9 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/browser/sync/profile_sync_service.h" 10 #include "chrome/browser/sync/profile_sync_service.h"
(...skipping 11 matching lines...) Expand all
22 : browser_(browser), 22 : browser_(browser),
23 signin_tracker_(browser_->profile(), this), 23 signin_tracker_(browser_->profile(), this),
24 start_mode_(start_mode) { 24 start_mode_(start_mode) {
25 DCHECK(browser_); 25 DCHECK(browser_);
26 26
27 ProfileSyncService* profile_sync_service = 27 ProfileSyncService* profile_sync_service =
28 ProfileSyncServiceFactory::GetForProfile(browser_->profile()); 28 ProfileSyncServiceFactory::GetForProfile(browser_->profile());
29 // Let the sync service know that setup is in progress so it doesn't start 29 // Let the sync service know that setup is in progress so it doesn't start
30 // syncing until the user has finished any configuration. 30 // syncing until the user has finished any configuration.
31 profile_sync_service->SetSetupInProgress(true); 31 profile_sync_service->SetSetupInProgress(true);
32 profile_sync_service->UnsuppressAndStart();
Roger Tawa OOO till Jul 10th 2012/08/28 17:21:55 Tim: should I call SyncPrefs::SetStartSuppressed()
tim (not reviewing) 2012/08/29 18:02:26 The difference is that UnsuppressAndStart will try
Roger Tawa OOO till Jul 10th 2012/08/29 18:58:43 Yes we do get here for the advanced case too. The
tim (not reviewing) 2012/08/29 23:48:58 Hm, maybe my new suggestion is a bad idea, we can'
32 SigninManager* manager = SigninManagerFactory::GetForProfile( 33 SigninManager* manager = SigninManagerFactory::GetForProfile(
33 browser_->profile()); 34 browser_->profile());
34 manager->StartSignInWithCredentials(session_index, email, password); 35 manager->StartSignInWithCredentials(session_index, email, password);
35 } 36 }
36 37
37 OneClickSigninSyncStarter::~OneClickSigninSyncStarter() { 38 OneClickSigninSyncStarter::~OneClickSigninSyncStarter() {
38 } 39 }
39 40
40 void OneClickSigninSyncStarter::GaiaCredentialsValid() { 41 void OneClickSigninSyncStarter::GaiaCredentialsValid() {
41 } 42 }
42 43
43 void OneClickSigninSyncStarter::SigninFailed( 44 void OneClickSigninSyncStarter::SigninFailed(
44 const GoogleServiceAuthError& error) { 45 const GoogleServiceAuthError& error) {
45 ProfileSyncService* profile_sync_service = 46 ProfileSyncService* profile_sync_service =
46 ProfileSyncServiceFactory::GetForProfile(browser_->profile()); 47 ProfileSyncServiceFactory::GetForProfile(browser_->profile());
47 profile_sync_service->SetSetupInProgress(false); 48 profile_sync_service->SetSetupInProgress(false);
48 delete this; 49 delete this;
Roger Tawa OOO till Jul 10th 2012/08/28 18:52:04 Is it important to reset the state here?
tim (not reviewing) 2012/08/29 18:02:26 Probably not essential at this point, since we kno
Roger Tawa OOO till Jul 10th 2012/08/29 18:58:43 OK
49 } 50 }
50 51
51 void OneClickSigninSyncStarter::SigninSuccess() { 52 void OneClickSigninSyncStarter::SigninSuccess() {
52 ProfileSyncService* profile_sync_service = 53 ProfileSyncService* profile_sync_service =
53 ProfileSyncServiceFactory::GetForProfile(browser_->profile()); 54 ProfileSyncServiceFactory::GetForProfile(browser_->profile());
54 55
55 if (start_mode_ == SYNC_WITH_DEFAULT_SETTINGS) { 56 if (start_mode_ == SYNC_WITH_DEFAULT_SETTINGS) {
56 // Just kick off the sync machine, no need to configure it first. 57 // Just kick off the sync machine, no need to configure it first.
57 profile_sync_service->SetSyncSetupCompleted(); 58 profile_sync_service->SetSyncSetupCompleted();
58 profile_sync_service->SetSetupInProgress(false); 59 profile_sync_service->SetSetupInProgress(false);
59 profile_sync_service->UnsuppressAndStart();
tim (not reviewing) 2012/08/29 23:48:58 Hm, I'm a little confused. SigninSuccess is suppo
60 } else { 60 } else {
61 // Give the user a chance to configure things. We don't clear the 61 // Give the user a chance to configure things. We don't clear the
62 // ProfileSyncService::setup_in_progress flag because we don't want sync 62 // ProfileSyncService::setup_in_progress flag because we don't want sync
63 // to start up until after the configure UI is displayed (the configure UI 63 // to start up until after the configure UI is displayed (the configure UI
64 // will clear the flag when the user is done setting up sync). 64 // will clear the flag when the user is done setting up sync).
65 LoginUIServiceFactory::GetForProfile(browser_->profile())->ShowLoginUI( 65 LoginUIServiceFactory::GetForProfile(browser_->profile())->ShowLoginUI(
66 browser_); 66 browser_);
67 } 67 }
68 68
69 delete this; 69 delete this;
70 } 70 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698