| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_POLICY_CLOUD_POLICY_CACHE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_CACHE_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_CACHE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_CACHE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 explicit CloudPolicyCache(const FilePath& backing_file_path); | 47 explicit CloudPolicyCache(const FilePath& backing_file_path); |
| 48 ~CloudPolicyCache(); | 48 ~CloudPolicyCache(); |
| 49 | 49 |
| 50 // Loads policy information from the backing file. Non-existing or erroneous | 50 // Loads policy information from the backing file. Non-existing or erroneous |
| 51 // cache files are ignored. | 51 // cache files are ignored. |
| 52 void LoadFromFile(); | 52 void LoadFromFile(); |
| 53 | 53 |
| 54 // Resets the policy information. | 54 // Resets the policy information. |
| 55 void SetPolicy(const em::CloudPolicyResponse& policy); | 55 void SetPolicy(const em::PolicyFetchResponse& policy); |
| 56 void SetDevicePolicy(const em::DevicePolicyResponse& policy); | 56 void SetDevicePolicy(const em::DevicePolicyResponse& policy); |
| 57 | 57 |
| 58 ConfigurationPolicyProvider* GetManagedPolicyProvider(); | 58 ConfigurationPolicyProvider* GetManagedPolicyProvider(); |
| 59 ConfigurationPolicyProvider* GetRecommendedPolicyProvider(); | 59 ConfigurationPolicyProvider* GetRecommendedPolicyProvider(); |
| 60 | 60 |
| 61 void SetUnmanaged(); | 61 void SetUnmanaged(); |
| 62 bool is_unmanaged() const { | 62 bool is_unmanaged() const { |
| 63 return is_unmanaged_; | 63 return is_unmanaged_; |
| 64 } | 64 } |
| 65 | 65 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 class CloudPolicyProvider; | 78 class CloudPolicyProvider; |
| 79 | 79 |
| 80 friend class CloudPolicyCacheTest; | 80 friend class CloudPolicyCacheTest; |
| 81 friend class DeviceManagementPolicyCacheTest; | 81 friend class DeviceManagementPolicyCacheTest; |
| 82 friend class DeviceManagementPolicyCacheDecodeTest; | 82 friend class DeviceManagementPolicyCacheDecodeTest; |
| 83 | 83 |
| 84 // Decodes a CloudPolicyResponse into two (ConfigurationPolicyType -> Value*) | 84 // Decodes a CloudPolicyResponse into two (ConfigurationPolicyType -> Value*) |
| 85 // maps and a timestamp. Also performs verification, returns NULL if any | 85 // maps and a timestamp. Also performs verification, returns NULL if any |
| 86 // check fails. | 86 // check fails. |
| 87 static bool DecodePolicyResponse( | 87 static bool DecodePolicyResponse( |
| 88 const em::CloudPolicyResponse& policy_response, | 88 const em::PolicyFetchResponse& policy_response, |
| 89 PolicyMap* mandatory, | 89 PolicyMap* mandatory, |
| 90 PolicyMap* recommended, | 90 PolicyMap* recommended, |
| 91 base::Time* timestamp); | 91 base::Time* timestamp); |
| 92 | 92 |
| 93 // Returns true if |certificate_chain| is trusted and a |signature| created | 93 // Returns true if |certificate_chain| is trusted and a |signature| created |
| 94 // from it matches |data|. | 94 // from it matches |data|. |
| 95 static bool VerifySignature( | 95 static bool VerifySignature( |
| 96 const std::string& signature, | 96 const std::string& signature, |
| 97 const std::string& data, | 97 const std::string& data, |
| 98 const RepeatedPtrField<std::string>& certificate_chain); | 98 const RepeatedPtrField<std::string>& certificate_chain); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 // Provider observers that are registered with this cache's providers. | 141 // Provider observers that are registered with this cache's providers. |
| 142 ObserverList<ConfigurationPolicyProvider::Observer, true> observer_list_; | 142 ObserverList<ConfigurationPolicyProvider::Observer, true> observer_list_; |
| 143 | 143 |
| 144 DISALLOW_COPY_AND_ASSIGN(CloudPolicyCache); | 144 DISALLOW_COPY_AND_ASSIGN(CloudPolicyCache); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 } // namespace policy | 147 } // namespace policy |
| 148 | 148 |
| 149 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_CACHE_H_ | 149 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_CACHE_H_ |
| OLD | NEW |