OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/auth/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/auth/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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 if (!is_safe_mode) { | 501 if (!is_safe_mode) { |
502 // Now we can continue with the login and report mount success. | 502 // Now we can continue with the login and report mount success. |
503 user_can_login_ = true; | 503 user_can_login_ = true; |
504 owner_is_verified_ = true; | 504 owner_is_verified_ = true; |
505 return true; | 505 return true; |
506 } | 506 } |
507 | 507 |
508 const std::string& user_id = current_state_->user_context.GetUserID(); | 508 const std::string& user_id = current_state_->user_context.GetUserID(); |
509 OwnerSettingsServiceFactory::GetInstance()->SetUsername(user_id); | 509 OwnerSettingsServiceFactory::GetInstance()->SetUsername(user_id); |
510 | 510 |
511 // This should trigger certificate loading, which is needed in order to | 511 // |IsOwnerForSafeModeAsync| expects logged in state to be |
512 // correctly determine if the current user is the owner. | 512 // LOGGED_IN_SAFE_MODE. |
513 if (LoginState::IsInitialized()) { | 513 if (LoginState::IsInitialized()) { |
514 LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_SAFE_MODE, | 514 LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_SAFE_MODE, |
515 LoginState::LOGGED_IN_USER_NONE); | 515 LoginState::LOGGED_IN_USER_NONE); |
516 } | 516 } |
517 | 517 |
518 OwnerSettingsService::IsPrivateKeyExistAsync( | 518 OwnerSettingsService::IsOwnerForSafeModeAsync( |
| 519 user_id, |
| 520 current_state_->user_context.GetUserIDHash(), |
519 base::Bind(&ParallelAuthenticator::OnOwnershipChecked, this)); | 521 base::Bind(&ParallelAuthenticator::OnOwnershipChecked, this)); |
520 return false; | 522 return false; |
521 } | 523 } |
522 | 524 |
523 void ParallelAuthenticator::OnOwnershipChecked(bool is_owner) { | 525 void ParallelAuthenticator::OnOwnershipChecked(bool is_owner) { |
524 // Now we can check if this user is the owner. | 526 // Now we can check if this user is the owner. |
525 user_can_login_ = is_owner; | 527 user_can_login_ = is_owner; |
526 owner_is_verified_ = true; | 528 owner_is_verified_ = true; |
527 Resolve(); | 529 Resolve(); |
528 } | 530 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 Resolve(); | 817 Resolve(); |
816 } | 818 } |
817 | 819 |
818 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, | 820 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, |
819 bool check_result) { | 821 bool check_result) { |
820 owner_is_verified_ = owner_check_finished; | 822 owner_is_verified_ = owner_check_finished; |
821 user_can_login_ = check_result; | 823 user_can_login_ = check_result; |
822 } | 824 } |
823 | 825 |
824 } // namespace chromeos | 826 } // namespace chromeos |
OLD | NEW |