Chromium Code Reviews| 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..563e8f90fd09fa07bf0d3486e4706104663845e3 100644 |
| --- a/chrome/browser/chromeos/policy/enterprise_install_attributes.h |
| +++ b/chrome/browser/chromeos/policy/enterprise_install_attributes.h |
| @@ -25,6 +25,13 @@ namespace policy { |
| // TODO(zelidrag, mnissler): Rename + move this class - http://crbug.com/249513. |
| class EnterpriseInstallAttributes { |
| public: |
| + enum LockState { |
| + STATE_UNKNOWN = 0, // Not initialized, yet. |
|
Mattias Nissler (ping if slow)
2015/06/23 11:34:09
suggestion: remove comma
Thiemo Nagel
2015/06/23 13:17:55
Done. (I was told in school that a comma was requ
|
| + STATE_NOT_LOCKED = 1, // Install attributes not present. |
| + STATE_LOCKING = 2, // Lock attempt in process. |
| + STATE_LOCKED = 3, // Valid install attributes have been obtained. |
| + }; |
| + |
| // EnterpriseInstallAttributes status codes. Do not change the numeric ids or |
| // the meaning of the existing codes to preserve the interpretability of old |
| // logfiles. |
| @@ -52,10 +59,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. |
| + // 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.) This method may |
| + // only be called once for initialization. |
| void ReadCacheFile(const base::FilePath& cache_file); |
| // Makes sure the local caches for enterprise-related install attributes are |
| @@ -96,8 +104,14 @@ class EnterpriseInstallAttributes { |
| // are not locked yet will be DEVICE_MODE_UNKNOWN. |
| DeviceMode GetMode(); |
| + // Check state of install attributes against TPM lock state and generate UMA |
| + // for the result. Retry asynchronously for up to 60 seconds in case of DBUS |
| + // errors (cryptohomed startup is slow). |
| + void TriggerConsistencyCheck(); |
|
Mattias Nissler (ping if slow)
2015/06/23 11:34:09
Does it make sense to trigger this externally? Mig
Thiemo Nagel
2015/06/23 13:17:55
I only want to call it after ReadCacheFile() becau
|
| + |
| protected: |
| - bool device_locked_; |
| + LockState lock_state_; |
| + int dbus_tries_remaining_; |
| std::string registration_user_; |
| std::string registration_domain_; |
| std::string registration_device_id_; |
| @@ -158,6 +172,12 @@ class EnterpriseInstallAttributes { |
| void OnReadImmutableAttributes(const std::string& user, |
| const LockResultCallback& callback); |
| + // Callback for TpmIsOwned() DBUS call. Generates UMA or schedules retry in |
| + // case of DBUS error. |
| + void CheckConsistencyAgainstTpmOwnershipState( |
| + chromeos::DBusMethodCallStatus call_status, |
| + bool result); |
| + |
| chromeos::CryptohomeClient* cryptohome_client_; |
| base::WeakPtrFactory<EnterpriseInstallAttributes> weak_ptr_factory_; |