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

Side by Side Diff: chrome/browser/chromeos/login/login_performer.cc

Issue 4980005: Allow sync with 2-factor StrongAuth accounts in ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Linux compile fix. 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/chromeos/login/login_performer.h" 5 #include "chrome/browser/chromeos/login/login_performer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/browser_thread.h" 10 #include "chrome/browser/browser_thread.h"
11 #include "chrome/browser/chromeos/boot_times_loader.h" 11 #include "chrome/browser/chromeos/boot_times_loader.h"
12 #include "chrome/browser/chromeos/login/login_utils.h" 12 #include "chrome/browser/chromeos/login/login_utils.h"
13 #include "chrome/browser/chromeos/user_cros_settings_provider.h" 13 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
14 #include "chrome/browser/profile.h" 14 #include "chrome/browser/profile.h"
15 #include "chrome/browser/profile_manager.h" 15 #include "chrome/browser/profile_manager.h"
16 16
17 namespace chromeos { 17 namespace chromeos {
18 18
19 namespace { 19 namespace {
20 } // namespace 20 } // namespace
21 21
22 LoginPerformer::LoginPerformer(Delegate* delegate) 22 LoginPerformer::LoginPerformer(Delegate* delegate)
23 : last_login_failure_(LoginFailure::None()), 23 : last_login_failure_(LoginFailure::None()),
24 delegate_(delegate) {} 24 delegate_(delegate) {}
25 25
26 //////////////////////////////////////////////////////////////////////////////// 26 ////////////////////////////////////////////////////////////////////////////////
27 // LoginPerformer, LoginStatusConsumer implementation: 27 // LoginPerformer, LoginStatusConsumer implementation:
28 28
29 void LoginPerformer::SetLoginFailure(const LoginFailure& failure) {
30 last_login_failure_ = failure;
31 }
32
29 void LoginPerformer::OnLoginFailure(const LoginFailure& failure) { 33 void LoginPerformer::OnLoginFailure(const LoginFailure& failure) {
30 last_login_failure_ = failure; 34 last_login_failure_ = failure;
31 if (delegate_) { 35 if (delegate_) {
32 captcha_.clear(); 36 captcha_.clear();
33 captcha_token_.clear(); 37 captcha_token_.clear();
34 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && 38 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED &&
35 failure.error().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) { 39 failure.error().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) {
36 captcha_token_ = failure.error().captcha().token; 40 captcha_token_ = failure.error().captcha().token;
37 } 41 }
38 delegate_->OnLoginFailure(failure); 42 delegate_->OnLoginFailure(failure);
39 } else { 43 } else {
40 // TODO(nkostylev): Provide blocking UI using ScreenLocker. 44 // TODO(nkostylev): Provide blocking UI using ScreenLocker.
41 } 45 }
42 } 46 }
43 47
44 void LoginPerformer::OnLoginSuccess( 48 void LoginPerformer::OnLoginSuccess(
45 const std::string& username, 49 const std::string& username,
46 const std::string& password, 50 const std::string& password,
47 const GaiaAuthConsumer::ClientLoginResult& credentials, 51 const GaiaAuthConsumer::ClientLoginResult& credentials,
48 bool pending_requests) { 52 bool pending_requests) {
49 if (delegate_) { 53 if (delegate_) {
54 if (last_login_failure_.reason() != LoginFailure::NONE)
55 delegate_->SetLoginFailure(last_login_failure_);
50 delegate_->OnLoginSuccess(username, 56 delegate_->OnLoginSuccess(username,
51 password, 57 password,
52 credentials, 58 credentials,
53 pending_requests); 59 pending_requests);
54 if (!pending_requests) 60 if (!pending_requests)
55 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 61 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
56 } else { 62 } else {
57 DCHECK(!pending_requests); 63 DCHECK(!pending_requests);
Nikita (slow) 2010/11/17 12:07:45 In R10 we're moving to the case when offline auth
stevenjb 2010/11/17 23:48:41 The refactoring based on chris's feedback eliminat
58 // Online login has succeeded. Delete our instance. 64 // Online login has succeeded. Delete our instance.
59 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 65 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
60 } 66 }
61 } 67 }
62 68
63 void LoginPerformer::OnOffTheRecordLoginSuccess() { 69 void LoginPerformer::OnOffTheRecordLoginSuccess() {
64 if (delegate_) 70 if (delegate_)
65 delegate_->OnOffTheRecordLoginSuccess(); 71 delegate_->OnOffTheRecordLoginSuccess();
66 else 72 else
67 NOTREACHED(); 73 NOTREACHED();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 &Authenticator::AuthenticateToLogin, 156 &Authenticator::AuthenticateToLogin,
151 profile, 157 profile,
152 username_, 158 username_,
153 password_, 159 password_,
154 captcha_token_, 160 captcha_token_,
155 captcha_)); 161 captcha_));
156 password_.clear(); 162 password_.clear();
157 } 163 }
158 164
159 } // namespace chromeos 165 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698