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