| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DEVICE_MANAGEMENT_POLICY_CACHE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_CACHE_H_ |
| 6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_CACHE_H_ | 6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_CACHE_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/lock.h" | 10 #include "base/lock.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // SetPolicy() calls, which is then persisted and decoded into the internal | 26 // SetPolicy() calls, which is then persisted and decoded into the internal |
| 27 // Value representation chrome uses. | 27 // Value representation chrome uses. |
| 28 class DeviceManagementPolicyCache { | 28 class DeviceManagementPolicyCache { |
| 29 public: | 29 public: |
| 30 explicit DeviceManagementPolicyCache(const FilePath& backing_file_path); | 30 explicit DeviceManagementPolicyCache(const FilePath& backing_file_path); |
| 31 | 31 |
| 32 // Loads policy information from the backing file. Non-existing or erroneous | 32 // Loads policy information from the backing file. Non-existing or erroneous |
| 33 // cache files are ignored. | 33 // cache files are ignored. |
| 34 void LoadPolicyFromFile(); | 34 void LoadPolicyFromFile(); |
| 35 | 35 |
| 36 // Resets the policy information. | 36 // Resets the policy information. Returns true if the new policy is different |
| 37 void SetPolicy(const em::DevicePolicyResponse& policy); | 37 // from the previously stored policy. |
| 38 bool SetPolicy(const em::DevicePolicyResponse& policy); |
| 38 | 39 |
| 39 // Gets the policy information. Ownership of the return value is transferred | 40 // Gets the policy information. Ownership of the return value is transferred |
| 40 // to the caller. | 41 // to the caller. |
| 41 DictionaryValue* GetPolicy(); | 42 DictionaryValue* GetPolicy(); |
| 42 | 43 |
| 43 // Returns the time as which the policy was last fetched. | 44 // Returns the time as which the policy was last fetched. |
| 44 base::Time last_policy_refresh_time() const { | 45 base::Time last_policy_refresh_time() const { |
| 45 return last_policy_refresh_time_; | 46 return last_policy_refresh_time_; |
| 46 } | 47 } |
| 47 | 48 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 76 // information loaded from the file. | 77 // information loaded from the file. |
| 77 bool fresh_policy_; | 78 bool fresh_policy_; |
| 78 | 79 |
| 79 // The time at which the policy was last refreshed. | 80 // The time at which the policy was last refreshed. |
| 80 base::Time last_policy_refresh_time_; | 81 base::Time last_policy_refresh_time_; |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 } // namespace policy | 84 } // namespace policy |
| 84 | 85 |
| 85 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_CACHE_H_ | 86 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_CACHE_H_ |
| OLD | NEW |