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

Side by Side Diff: chrome/browser/sync/signin_manager.cc

Issue 4980005: Allow sync with 2-factor StrongAuth accounts in ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactored 2-factor error passing Created 10 years, 1 month 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/sync/signin_manager.h" 5 #include "chrome/browser/sync/signin_manager.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/net/gaia/token_service.h" 8 #include "chrome/browser/net/gaia/token_service.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 void SigninManager::SetUsername(const std::string& username) { 42 void SigninManager::SetUsername(const std::string& username) {
43 username_ = username; 43 username_ = username;
44 } 44 }
45 45
46 // Users must always sign out before they sign in again. 46 // Users must always sign out before they sign in again.
47 void SigninManager::StartSignIn(const std::string& username, 47 void SigninManager::StartSignIn(const std::string& username,
48 const std::string& password, 48 const std::string& password,
49 const std::string& login_token, 49 const std::string& login_token,
50 const std::string& login_captcha) { 50 const std::string& login_captcha) {
51 DCHECK(username_.empty()); 51 DCHECK(username_.empty());
52 #if !defined(OS_CHROMEOS)
52 // The Sign out should clear the token service credentials. 53 // The Sign out should clear the token service credentials.
54 // Note: In CHROMEOS we might have valid credentials but still need to
55 // set up 2-factor authentication.
53 DCHECK(!profile_->GetTokenService()->AreCredentialsValid()); 56 DCHECK(!profile_->GetTokenService()->AreCredentialsValid());
54 57 #endif
55 username_.assign(username); 58 username_.assign(username);
56 password_.assign(password); 59 password_.assign(password);
57 60
58 client_login_.reset(new GaiaAuthFetcher(this, 61 client_login_.reset(new GaiaAuthFetcher(this,
59 GaiaConstants::kChromeSource, 62 GaiaConstants::kChromeSource,
60 profile_->GetRequestContext())); 63 profile_->GetRequestContext()));
61 client_login_->StartClientLogin(username, 64 client_login_->StartClientLogin(username,
62 password, 65 password,
63 "", 66 "",
64 login_token, 67 login_token,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bool invalid_gaia = error.state() == 152 bool invalid_gaia = error.state() ==
150 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS; 153 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS;
151 if (error.state() == GoogleServiceAuthError::TWO_FACTOR || 154 if (error.state() == GoogleServiceAuthError::TWO_FACTOR ||
152 (had_two_factor_error_ && invalid_gaia)) { 155 (had_two_factor_error_ && invalid_gaia)) {
153 had_two_factor_error_ = true; 156 had_two_factor_error_ = true;
154 return; 157 return;
155 } 158 }
156 159
157 SignOut(); 160 SignOut();
158 } 161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698