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

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

Issue 9453035: Implement one click login. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressing review comments Created 8 years, 9 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
6
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/signin/signin_manager.h"
9 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/browser/sync/profile_sync_service.h"
11 #include "chrome/browser/sync/profile_sync_service_factory.h"
12 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
13 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
14
15 OneClickSigninSyncStarter::OneClickSigninSyncStarter(
16 const std::string& email,
17 const std::string& password,
18 Profile* profile,
19 bool use_default_settings)
20 : profile_(profile),
21 signin_tracker_(profile, this),
22 use_default_settings_(use_default_settings) {
23 DCHECK(profile_);
24
25 SigninManager* manager = SigninManagerFactory::GetForProfile(profile_);
26 manager->StartSignInWithCredentials(email, password);
27 }
28
29 OneClickSigninSyncStarter::~OneClickSigninSyncStarter() {
30 }
31
32 void OneClickSigninSyncStarter::GaiaCredentialsValid() {
33 }
34
35 void OneClickSigninSyncStarter::SigninFailed() {
36 delete this;
37 }
38
39 void OneClickSigninSyncStarter::SigninSuccess() {
40 ProfileSyncService* profile_sync_service =
41 ProfileSyncServiceFactory::GetForProfile(profile_);
42
43 if (use_default_settings_) {
44 // Just kick off the sync machine, no need to configure it first.
45 profile_sync_service->SetSyncSetupCompleted();
46 profile_sync_service->UnsuppressAndStart();
47 } else {
48 // Give the user a chance to configure things.
49 profile_sync_service->ShowConfigure(false);
50 }
51
52 delete this;
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698