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/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 ParallelAuthenticator::ParallelAuthenticator(LoginStatusConsumer* consumer) | 181 ParallelAuthenticator::ParallelAuthenticator(LoginStatusConsumer* consumer) |
182 : Authenticator(consumer), | 182 : Authenticator(consumer), |
183 migrate_attempted_(false), | 183 migrate_attempted_(false), |
184 remove_attempted_(false), | 184 remove_attempted_(false), |
185 ephemeral_mount_attempted_(false), | 185 ephemeral_mount_attempted_(false), |
186 check_key_attempted_(false), | 186 check_key_attempted_(false), |
187 already_reported_success_(false), | 187 already_reported_success_(false), |
188 owner_is_verified_(false), | 188 owner_is_verified_(false), |
189 user_can_login_(false), | 189 user_can_login_(false), |
190 using_oauth_( | 190 using_oauth_(true) { |
191 !CommandLine::ForCurrentProcess()->HasSwitch( | |
192 switches::kSkipOAuthLogin)) { | |
193 } | 191 } |
194 | 192 |
195 void ParallelAuthenticator::AuthenticateToLogin( | 193 void ParallelAuthenticator::AuthenticateToLogin( |
196 Profile* profile, | 194 Profile* profile, |
197 const std::string& username, | 195 const std::string& username, |
198 const std::string& password, | 196 const std::string& password, |
199 const std::string& login_token, | 197 const std::string& login_token, |
200 const std::string& login_captcha) { | 198 const std::string& login_captcha) { |
201 std::string canonicalized = gaia::CanonicalizeEmail(username); | 199 std::string canonicalized = gaia::CanonicalizeEmail(username); |
202 authentication_profile_ = profile; | 200 authentication_profile_ = profile; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 LOG(WARNING) << "Login failed: " << error.GetErrorString(); | 378 LOG(WARNING) << "Login failed: " << error.GetErrorString(); |
381 if (consumer_) | 379 if (consumer_) |
382 consumer_->OnLoginFailure(error); | 380 consumer_->OnLoginFailure(error); |
383 } | 381 } |
384 | 382 |
385 void ParallelAuthenticator::RecordOAuthCheckFailure( | 383 void ParallelAuthenticator::RecordOAuthCheckFailure( |
386 const std::string& user_name) { | 384 const std::string& user_name) { |
387 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 385 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
388 DCHECK(using_oauth_); | 386 DCHECK(using_oauth_); |
389 // Mark this account's OAuth token state as invalid in the local state. | 387 // Mark this account's OAuth token state as invalid in the local state. |
390 UserManager::Get()->SaveUserOAuthStatus(user_name, | 388 UserManager::Get()->SaveUserOAuthStatus( |
391 User::OAUTH_TOKEN_STATUS_INVALID); | 389 user_name, |
| 390 CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceOAuth1) ? |
| 391 User::OAUTH1_TOKEN_STATUS_INVALID : |
| 392 User::OAUTH2_TOKEN_STATUS_INVALID); |
392 } | 393 } |
393 | 394 |
394 void ParallelAuthenticator::RecoverEncryptedData( | 395 void ParallelAuthenticator::RecoverEncryptedData( |
395 const std::string& old_password) { | 396 const std::string& old_password) { |
396 std::string old_hash = HashPassword(old_password); | 397 std::string old_hash = HashPassword(old_password); |
397 migrate_attempted_ = true; | 398 migrate_attempted_ = true; |
398 current_state_->ResetCryptohomeStatus(); | 399 current_state_->ResetCryptohomeStatus(); |
399 BrowserThread::PostTask( | 400 BrowserThread::PostTask( |
400 BrowserThread::UI, FROM_HERE, | 401 BrowserThread::UI, FROM_HERE, |
401 base::Bind(&Migrate, | 402 base::Bind(&Migrate, |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 Resolve(); | 823 Resolve(); |
823 } | 824 } |
824 | 825 |
825 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, | 826 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, |
826 bool check_result) { | 827 bool check_result) { |
827 owner_is_verified_ = owner_check_finished; | 828 owner_is_verified_ = owner_check_finished; |
828 user_can_login_ = check_result; | 829 user_can_login_ = check_result; |
829 } | 830 } |
830 | 831 |
831 } // namespace chromeos | 832 } // namespace chromeos |
OLD | NEW |