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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 owner_is_verified_(false), | 174 owner_is_verified_(false), |
175 user_can_login_(false), | 175 user_can_login_(false), |
176 using_oauth_( | 176 using_oauth_( |
177 !CommandLine::ForCurrentProcess()->HasSwitch( | 177 !CommandLine::ForCurrentProcess()->HasSwitch( |
178 switches::kSkipOAuthLogin)) { | 178 switches::kSkipOAuthLogin)) { |
179 // If not already owned, this is a no-op. If it is, this loads the owner's | 179 // If not already owned, this is a no-op. If it is, this loads the owner's |
180 // public key off of disk. | 180 // public key off of disk. |
181 OwnershipService::GetSharedInstance()->StartLoadOwnerKeyAttempt(); | 181 OwnershipService::GetSharedInstance()->StartLoadOwnerKeyAttempt(); |
182 } | 182 } |
183 | 183 |
184 ParallelAuthenticator::~ParallelAuthenticator() {} | |
185 | |
186 void ParallelAuthenticator::AuthenticateToLogin( | 184 void ParallelAuthenticator::AuthenticateToLogin( |
187 Profile* profile, | 185 Profile* profile, |
188 const std::string& username, | 186 const std::string& username, |
189 const std::string& password, | 187 const std::string& password, |
190 const std::string& login_token, | 188 const std::string& login_token, |
191 const std::string& login_captcha) { | 189 const std::string& login_captcha) { |
192 std::string canonicalized = gaia::CanonicalizeEmail(username); | 190 std::string canonicalized = gaia::CanonicalizeEmail(username); |
193 authentication_profile_ = profile; | 191 authentication_profile_ = profile; |
194 current_state_.reset( | 192 current_state_.reset( |
195 new AuthAttemptState( | 193 new AuthAttemptState( |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 this, | 607 this, |
610 LoginFailure(LoginFailure::OWNER_REQUIRED))); | 608 LoginFailure(LoginFailure::OWNER_REQUIRED))); |
611 break; | 609 break; |
612 } | 610 } |
613 default: | 611 default: |
614 NOTREACHED(); | 612 NOTREACHED(); |
615 break; | 613 break; |
616 } | 614 } |
617 } | 615 } |
618 | 616 |
| 617 ParallelAuthenticator::~ParallelAuthenticator() {} |
| 618 |
619 ParallelAuthenticator::AuthState ParallelAuthenticator::ResolveState() { | 619 ParallelAuthenticator::AuthState ParallelAuthenticator::ResolveState() { |
620 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 620 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
621 // If we haven't mounted the user's home dir yet, we can't be done. | 621 // If we haven't mounted the user's home dir yet, we can't be done. |
622 // We never get past here if a cryptohome op is still pending. | 622 // We never get past here if a cryptohome op is still pending. |
623 // This is an important invariant. | 623 // This is an important invariant. |
624 if (!current_state_->cryptohome_complete()) | 624 if (!current_state_->cryptohome_complete()) |
625 return CONTINUE; | 625 return CONTINUE; |
626 | 626 |
627 AuthState state = (reauth_state_.get() ? ResolveReauthState() : CONTINUE); | 627 AuthState state = (reauth_state_.get() ? ResolveReauthState() : CONTINUE); |
628 if (state != CONTINUE) | 628 if (state != CONTINUE) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 } | 778 } |
779 | 779 |
780 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, | 780 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, |
781 bool check_result) { | 781 bool check_result) { |
782 base::AutoLock for_this_block(owner_verified_lock_); | 782 base::AutoLock for_this_block(owner_verified_lock_); |
783 owner_is_verified_ = owner_check_finished; | 783 owner_is_verified_ = owner_check_finished; |
784 user_can_login_ = check_result; | 784 user_can_login_ = check_result; |
785 } | 785 } |
786 | 786 |
787 } // namespace chromeos | 787 } // namespace chromeos |
OLD | NEW |