| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 16 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
| 17 #include "chromeos/dbus/cryptohome_client.h" | 17 #include "chromeos/dbus/cryptohome_client.h" |
| 18 #include "chromeos/dbus/dbus_method_call_status.h" | 18 #include "chromeos/dbus/dbus_method_call_status.h" |
| 19 | 19 |
| 20 namespace chromeos { | |
| 21 class CryptohomeLibrary; | |
| 22 } | |
| 23 | |
| 24 namespace policy { | 20 namespace policy { |
| 25 | 21 |
| 26 // Brokers access to the enterprise-related installation-time attributes on | 22 // Brokers access to the enterprise-related installation-time attributes on |
| 27 // ChromeOS. | 23 // ChromeOS. |
| 28 // TODO(zelidrag, mnissler): Rename + move this class - http://crbug.com/249513. | 24 // TODO(zelidrag, mnissler): Rename + move this class - http://crbug.com/249513. |
| 29 class EnterpriseInstallAttributes { | 25 class EnterpriseInstallAttributes { |
| 30 public: | 26 public: |
| 31 // Return codes for LockDevice(). | 27 // Return codes for LockDevice(). |
| 32 enum LockResult { | 28 enum LockResult { |
| 33 LOCK_SUCCESS, | 29 LOCK_SUCCESS, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 static const char kUnknownDeviceMode[]; | 43 static const char kUnknownDeviceMode[]; |
| 48 | 44 |
| 49 // Field names in the lockbox. | 45 // Field names in the lockbox. |
| 50 static const char kAttrEnterpriseDeviceId[]; | 46 static const char kAttrEnterpriseDeviceId[]; |
| 51 static const char kAttrEnterpriseDomain[]; | 47 static const char kAttrEnterpriseDomain[]; |
| 52 static const char kAttrEnterpriseMode[]; | 48 static const char kAttrEnterpriseMode[]; |
| 53 static const char kAttrEnterpriseOwned[]; | 49 static const char kAttrEnterpriseOwned[]; |
| 54 static const char kAttrEnterpriseUser[]; | 50 static const char kAttrEnterpriseUser[]; |
| 55 static const char kAttrConsumerKioskEnabled[]; | 51 static const char kAttrConsumerKioskEnabled[]; |
| 56 | 52 |
| 57 EnterpriseInstallAttributes( | 53 explicit EnterpriseInstallAttributes( |
| 58 chromeos::CryptohomeLibrary* cryptohome, | |
| 59 chromeos::CryptohomeClient* cryptohome_client); | 54 chromeos::CryptohomeClient* cryptohome_client); |
| 60 ~EnterpriseInstallAttributes(); | 55 ~EnterpriseInstallAttributes(); |
| 61 | 56 |
| 62 // Reads data from the cache file. The cache file is used to work around slow | 57 // Reads data from the cache file. The cache file is used to work around slow |
| 63 // cryptohome startup, which takes a while to register its DBus interface. | 58 // cryptohome startup, which takes a while to register its DBus interface. |
| 64 // See http://crosbug.com/37367 for background on this. | 59 // See http://crosbug.com/37367 for background on this. |
| 65 void ReadCacheFile(const base::FilePath& cache_file); | 60 void ReadCacheFile(const base::FilePath& cache_file); |
| 66 | 61 |
| 67 // Makes sure the local caches for enterprise-related install attributes are | 62 // Makes sure the local caches for enterprise-related install attributes are |
| 68 // up-to-date with what cryptohome has. This method checks the readiness of | 63 // up-to-date with what cryptohome has. This method checks the readiness of |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 DeviceMode device_mode, | 122 DeviceMode device_mode, |
| 128 const std::string& device_id, | 123 const std::string& device_id, |
| 129 const LockResultCallback& callback, | 124 const LockResultCallback& callback, |
| 130 chromeos::DBusMethodCallStatus call_status, | 125 chromeos::DBusMethodCallStatus call_status, |
| 131 bool result); | 126 bool result); |
| 132 | 127 |
| 133 // Confirms the registered user and invoke the callback. | 128 // Confirms the registered user and invoke the callback. |
| 134 void OnReadImmutableAttributes(const std::string& user, | 129 void OnReadImmutableAttributes(const std::string& user, |
| 135 const LockResultCallback& callback); | 130 const LockResultCallback& callback); |
| 136 | 131 |
| 137 chromeos::CryptohomeLibrary* cryptohome_; | |
| 138 chromeos::CryptohomeClient* cryptohome_client_; | 132 chromeos::CryptohomeClient* cryptohome_client_; |
| 139 | 133 |
| 140 base::WeakPtrFactory<EnterpriseInstallAttributes> weak_ptr_factory_; | 134 base::WeakPtrFactory<EnterpriseInstallAttributes> weak_ptr_factory_; |
| 141 | 135 |
| 142 DISALLOW_COPY_AND_ASSIGN(EnterpriseInstallAttributes); | 136 DISALLOW_COPY_AND_ASSIGN(EnterpriseInstallAttributes); |
| 143 }; | 137 }; |
| 144 | 138 |
| 145 } // namespace policy | 139 } // namespace policy |
| 146 | 140 |
| 147 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ | 141 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENTERPRISE_INSTALL_ATTRIBUTES_H_ |
| OLD | NEW |