Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1446)

Unified Diff: chrome/browser/chromeos/ownership/owner_settings_service.cc

Issue 419013003: Replace c/b/nss_context by a KeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added Linux implementation. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698