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

Unified Diff: chrome/browser/chromeos/policy/enterprise_install_attributes.h

Issue 1189203003: Add UMA for consistency between TPM and install attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master3
Patch Set: Address more comments. Created 5 years, 6 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/policy/enterprise_install_attributes.h
diff --git a/chrome/browser/chromeos/policy/enterprise_install_attributes.h b/chrome/browser/chromeos/policy/enterprise_install_attributes.h
index bb9a681c721e037fa0a6f657d8de611f46748e2a..029558292012c1ebb23e81654610b07648120f01 100644
--- a/chrome/browser/chromeos/policy/enterprise_install_attributes.h
+++ b/chrome/browser/chromeos/policy/enterprise_install_attributes.h
@@ -52,11 +52,11 @@ class EnterpriseInstallAttributes {
chromeos::CryptohomeClient* cryptohome_client);
~EnterpriseInstallAttributes();
- // Reads data from the cache file which is created early during the boot
- // process. The cache file is used to work around slow cryptohome startup,
- // which takes a while to register its DBus interface. See
- // http://crosbug.com/37367 for background on this.
- void ReadCacheFile(const base::FilePath& cache_file);
+ // Tries to read install attributes from the cache file which is created early
+ // during the boot process. The cache file is used to work around slow
+ // cryptohome startup, which takes a while to register its DBus interface.
+ // (See http://crosbug.com/37367 for background on this.)
+ void Init(const base::FilePath& cache_file);
// Makes sure the local caches for enterprise-related install attributes are
// up-to-date with what cryptohome has. This method checks the readiness of
@@ -67,7 +67,8 @@ class EnterpriseInstallAttributes {
// Locks the device to be an enterprise device registered by the given user.
// This can also be called after the lock has already been taken, in which
// case it checks that the passed user agrees with the locked attribute.
- // |callback| must not be null and is called with the result.
+ // |callback| must not be null and is called with the result. Must not be
+ // called while a previous LockDevice() invocation is still pending.
void LockDevice(const std::string& user,
DeviceMode device_mode,
const std::string& device_id,
@@ -97,7 +98,19 @@ class EnterpriseInstallAttributes {
DeviceMode GetMode();
protected:
+ // True if install attributes have been read successfully. False if read
+ // failed or no read attempt was made.
bool device_locked_;
+
+ // Whether the TPM / install attributes consistency check is running.
+ bool consistency_check_running_;
+
+ // To be run after the consistency check has finished.
+ base::Closure post_check_action_;
+
+ // Wether the LockDevice() initiated TPM calls are running.
+ bool registration_running_;
Mattias Nissler (ping if slow) 2015/06/24 13:26:06 nit: "registration" is somewhat odd naming here -
Thiemo Nagel 2015/06/24 14:05:40 The registration_* members? But I'd be happy to c
Mattias Nissler (ping if slow) 2015/06/24 18:37:10 The registration_* members are called such because
Thiemo Nagel 2015/06/25 09:04:07 Thanks. I've changed the name to device_lock_runn
+
std::string registration_user_;
std::string registration_domain_;
std::string registration_device_id_;
@@ -158,6 +171,17 @@ class EnterpriseInstallAttributes {
void OnReadImmutableAttributes(const std::string& user,
const LockResultCallback& callback);
+ // Check state of install attributes against TPM lock state and generate UMA
+ // for the result. Asynchronously retry |dbus_retries| times in case of DBUS
+ // errors (cryptohomed startup is slow).
+ void TriggerConsistencyCheck(int dbus_retries);
+
+ // Callback for TpmIsOwned() DBUS call. Generates UMA or schedules retry in
+ // case of DBUS error.
+ void OnTpmOwnerCheckCompleted(int dbus_retries_remaining,
+ chromeos::DBusMethodCallStatus call_status,
+ bool result);
+
chromeos::CryptohomeClient* cryptohome_client_;
base::WeakPtrFactory<EnterpriseInstallAttributes> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698