Index: chrome/browser/chromeos/ownership/owner_settings_service.cc |
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service.cc b/chrome/browser/chromeos/ownership/owner_settings_service.cc |
index d9e1dabfd93ceccdc5e41631acfbdb1d83c8c8d6..a35071d9a916ca05858d5d96cf1a6d1d25ef83ba 100644 |
--- a/chrome/browser/chromeos/ownership/owner_settings_service.cc |
+++ b/chrome/browser/chromeos/ownership/owner_settings_service.cc |
@@ -19,6 +19,7 @@ |
#include "chrome/browser/profiles/profile.h" |
#include "chromeos/chromeos_paths.h" |
#include "chromeos/dbus/dbus_thread_manager.h" |
+#include "chromeos/tpm_token_loader.h" |
#include "components/ownership/owner_key_util_impl.h" |
#include "components/policy/core/common/cloud/cloud_policy_constants.h" |
#include "content/public/browser/browser_thread.h" |
@@ -248,8 +249,11 @@ OwnerSettingsService::OwnerSettingsService(Profile* profile) |
waiting_for_tpm_token_(true), |
weak_factory_(this) { |
if (TPMTokenLoader::IsInitialized()) { |
- waiting_for_tpm_token_ = !TPMTokenLoader::Get()->IsTPMTokenReady(); |
- TPMTokenLoader::Get()->AddObserver(this); |
+ TPMTokenLoader::TPMTokenStatus tpm_token_status = |
+ TPMTokenLoader::Get()->IsTPMTokenEnabled( |
+ base::Bind(&OwnerSettingsService::OnTPMTokenReady, as_weak_ptr())); |
+ waiting_for_tpm_token_ = |
+ tpm_token_status == TPMTokenLoader::TPM_TOKEN_STATUS_UNDETERMINED; |
} |
if (DBusThreadManager::IsInitialized() && |
@@ -264,9 +268,6 @@ OwnerSettingsService::OwnerSettingsService(Profile* profile) |
OwnerSettingsService::~OwnerSettingsService() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
- if (TPMTokenLoader::IsInitialized()) |
- TPMTokenLoader::Get()->RemoveObserver(this); |
- |
if (DBusThreadManager::IsInitialized() && |
DBusThreadManager::Get()->GetSessionManagerClient()) { |
DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
@@ -366,7 +367,7 @@ void OwnerSettingsService::Observe( |
ReloadPrivateKey(); |
} |
-void OwnerSettingsService::OnTPMTokenReady() { |
+void OwnerSettingsService::OnTPMTokenReady(bool token_enabled) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
waiting_for_tpm_token_ = false; |