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" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/chromeos/boot_times_loader.h" | 14 #include "chrome/browser/chromeos/boot_times_loader.h" |
15 #include "chrome/browser/chromeos/login/auth/authentication_notification_details
.h" | 15 #include "chrome/browser/chromeos/login/auth/authentication_notification_details
.h" |
16 #include "chrome/browser/chromeos/login/auth/login_status_consumer.h" | 16 #include "chrome/browser/chromeos/login/auth/login_status_consumer.h" |
17 #include "chrome/browser/chromeos/login/auth/user_context.h" | 17 #include "chrome/browser/chromeos/login/auth/user_context.h" |
18 #include "chrome/browser/chromeos/login/users/user.h" | 18 #include "chrome/browser/chromeos/login/users/user.h" |
19 #include "chrome/browser/chromeos/login/users/user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 20 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h" |
20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
22 #include "chromeos/cryptohome/async_method_caller.h" | 23 #include "chromeos/cryptohome/async_method_caller.h" |
23 #include "chromeos/cryptohome/system_salt_getter.h" | 24 #include "chromeos/cryptohome/system_salt_getter.h" |
24 #include "chromeos/dbus/cryptohome_client.h" | 25 #include "chromeos/dbus/cryptohome_client.h" |
25 #include "chromeos/dbus/dbus_thread_manager.h" | 26 #include "chromeos/dbus/dbus_thread_manager.h" |
26 #include "chromeos/login/login_state.h" | 27 #include "chromeos/login/login_state.h" |
27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
29 #include "crypto/sha2.h" | 30 #include "crypto/sha2.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 return true; | 482 return true; |
482 // Check if policy data is fine and continue in safe mode if needed. | 483 // Check if policy data is fine and continue in safe mode if needed. |
483 bool is_safe_mode = false; | 484 bool is_safe_mode = false; |
484 CrosSettings::Get()->GetBoolean(kPolicyMissingMitigationMode, &is_safe_mode); | 485 CrosSettings::Get()->GetBoolean(kPolicyMissingMitigationMode, &is_safe_mode); |
485 if (!is_safe_mode) { | 486 if (!is_safe_mode) { |
486 // Now we can continue with the login and report mount success. | 487 // Now we can continue with the login and report mount success. |
487 user_can_login_ = true; | 488 user_can_login_ = true; |
488 owner_is_verified_ = true; | 489 owner_is_verified_ = true; |
489 return true; | 490 return true; |
490 } | 491 } |
491 // Now we can continue reading the private key. | 492 |
492 DeviceSettingsService::Get()->SetUsername( | 493 OwnerSettingsServiceFactory::GetInstance()->SetUsername( |
493 current_state_->user_context.GetUserID()); | 494 current_state_->user_context.GetUserID()); |
| 495 |
494 // This should trigger certificate loading, which is needed in order to | 496 // This should trigger certificate loading, which is needed in order to |
495 // correctly determine if the current user is the owner. | 497 // correctly determine if the current user is the owner. |
496 if (LoginState::IsInitialized()) { | 498 if (LoginState::IsInitialized()) { |
497 LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_SAFE_MODE, | 499 LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_SAFE_MODE, |
498 LoginState::LOGGED_IN_USER_NONE); | 500 LoginState::LOGGED_IN_USER_NONE); |
499 } | 501 } |
500 DeviceSettingsService::Get()->IsCurrentUserOwnerAsync( | 502 DeviceSettingsService::Get()->IsCurrentUserOwnerAsync( |
501 base::Bind(&ParallelAuthenticator::OnOwnershipChecked, this)); | 503 base::Bind(&ParallelAuthenticator::OnOwnershipChecked, this)); |
502 return false; | 504 return false; |
503 } | 505 } |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 Resolve(); | 820 Resolve(); |
819 } | 821 } |
820 | 822 |
821 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, | 823 void ParallelAuthenticator::SetOwnerState(bool owner_check_finished, |
822 bool check_result) { | 824 bool check_result) { |
823 owner_is_verified_ = owner_check_finished; | 825 owner_is_verified_ = owner_check_finished; |
824 user_can_login_ = check_result; | 826 user_can_login_ = check_result; |
825 } | 827 } |
826 | 828 |
827 } // namespace chromeos | 829 } // namespace chromeos |
OLD | NEW |