OLD | NEW |
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/chromeos/login/online_attempt.h" | 5 #include "chrome/browser/chromeos/login/online_attempt.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Since we don't allow HOSTED accounts to log in, we need to try | 79 // Since we don't allow HOSTED accounts to log in, we need to try |
80 // again, without allowing HOSTED accounts. | 80 // again, without allowing HOSTED accounts. |
81 // | 81 // |
82 // NOTE: we used to do this in the opposite order, so that we'd only | 82 // NOTE: we used to do this in the opposite order, so that we'd only |
83 // try the HOSTED pathway if GOOGLE-only failed. This breaks CAPTCHA | 83 // try the HOSTED pathway if GOOGLE-only failed. This breaks CAPTCHA |
84 // handling, though. | 84 // handling, though. |
85 attempt_->DisableHosted(); | 85 attempt_->DisableHosted(); |
86 TryClientLogin(); | 86 TryClientLogin(); |
87 return; | 87 return; |
88 } | 88 } |
89 TriggerResolve(LoginFailure::None()); | 89 TriggerResolve(LoginFailure::LoginFailureNone()); |
90 } | 90 } |
91 | 91 |
92 void OnlineAttempt::OnClientLoginFailure( | 92 void OnlineAttempt::OnClientLoginFailure( |
93 const GoogleServiceAuthError& error) { | 93 const GoogleServiceAuthError& error) { |
94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
95 | 95 |
96 weak_factory_.InvalidateWeakPtrs(); | 96 weak_factory_.InvalidateWeakPtrs(); |
97 | 97 |
98 if (error.state() == GoogleServiceAuthError::REQUEST_CANCELED) { | 98 if (error.state() == GoogleServiceAuthError::REQUEST_CANCELED) { |
99 if (try_again_) { | 99 if (try_again_) { |
(...skipping 14 matching lines...) Expand all Loading... |
114 // indicates that the account is HOSTED. | 114 // indicates that the account is HOSTED. |
115 LOG(WARNING) << "Rejecting valid HOSTED account."; | 115 LOG(WARNING) << "Rejecting valid HOSTED account."; |
116 TriggerResolve(LoginFailure::FromNetworkAuthFailure( | 116 TriggerResolve(LoginFailure::FromNetworkAuthFailure( |
117 GoogleServiceAuthError( | 117 GoogleServiceAuthError( |
118 GoogleServiceAuthError::HOSTED_NOT_ALLOWED))); | 118 GoogleServiceAuthError::HOSTED_NOT_ALLOWED))); |
119 return; | 119 return; |
120 } | 120 } |
121 | 121 |
122 if (error.state() == GoogleServiceAuthError::TWO_FACTOR) { | 122 if (error.state() == GoogleServiceAuthError::TWO_FACTOR) { |
123 LOG(WARNING) << "Two factor authenticated. Sync will not work."; | 123 LOG(WARNING) << "Two factor authenticated. Sync will not work."; |
124 TriggerResolve(LoginFailure::None()); | 124 TriggerResolve(LoginFailure::LoginFailureNone()); |
125 | 125 |
126 return; | 126 return; |
127 } | 127 } |
128 VLOG(2) << "ClientLogin attempt failed with " << error.state(); | 128 VLOG(2) << "ClientLogin attempt failed with " << error.state(); |
129 TriggerResolve(LoginFailure::FromNetworkAuthFailure(error)); | 129 TriggerResolve(LoginFailure::FromNetworkAuthFailure(error)); |
130 } | 130 } |
131 | 131 |
132 void OnlineAttempt::TryClientLogin() { | 132 void OnlineAttempt::TryClientLogin() { |
133 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 133 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
134 | 134 |
(...skipping 30 matching lines...) Expand all Loading... |
165 } | 165 } |
166 | 166 |
167 void OnlineAttempt::TriggerResolve( | 167 void OnlineAttempt::TriggerResolve( |
168 const LoginFailure& outcome) { | 168 const LoginFailure& outcome) { |
169 attempt_->RecordOnlineLoginStatus(outcome); | 169 attempt_->RecordOnlineLoginStatus(outcome); |
170 client_fetcher_.reset(NULL); | 170 client_fetcher_.reset(NULL); |
171 resolver_->Resolve(); | 171 resolver_->Resolve(); |
172 } | 172 } |
173 | 173 |
174 } // namespace chromeos | 174 } // namespace chromeos |
OLD | NEW |