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

Unified 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: Cleanup old filenames from chrome_browser.gypi Created 8 years, 10 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_sync_starter.cc
===================================================================
--- chrome/browser/ui/sync/one_click_signin_sync_starter.cc (revision 0)
+++ chrome/browser/ui/sync/one_click_signin_sync_starter.cc (revision 0)
@@ -0,0 +1,53 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/signin_manager.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
+
+OneClickSigninSyncStarter::OneClickSigninSyncStarter(
+ const std::string& email,
+ const std::string& password,
+ Profile* profile,
+ bool use_default_settings)
+ : profile_(profile),
+ signin_tracker_(profile, this),
+ use_default_settings_(use_default_settings) {
+ DCHECK(profile_);
+
+ SigninManager* manager = SigninManagerFactory::GetForProfile(profile_);
+ manager->StartSignInWithCredentials(email, password);
+}
+
+OneClickSigninSyncStarter::~OneClickSigninSyncStarter() {
+}
+
+void OneClickSigninSyncStarter::GaiaCredentialsValid() {
+}
+
+void OneClickSigninSyncStarter::SigninFailed() {
+ delete this;
+}
+
+void OneClickSigninSyncStarter::SigninSuccess() {
+ ProfileSyncService* profile_sync_service =
+ ProfileSyncServiceFactory::GetForProfile(profile_);
+
+ if (use_default_settings_) {
+ // Just kick off the sync machine, no need to configure it first.
+ profile_sync_service->SetSyncSetupCompleted();
+ profile_sync_service->UnsuppressAndStart();
+ } else {
+ // Give the user a chance to configure things.
+ profile_sync_service->ShowConfigure(false);
+ }
+
+ delete this;
+}
Property changes on: chrome\browser\ui\sync\one_click_signin_sync_starter.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_sync_starter.h ('k') | chrome/browser/ui/tab_contents/tab_contents_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698