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 10 matching lines...) Expand all Loading... |
21 namespace em = enterprise_management; | 21 namespace em = enterprise_management; |
22 | 22 |
23 // Keeps the authoritative copy of cloud policy information as read from the | 23 // Keeps the authoritative copy of cloud policy information as read from the |
24 // persistence file or determined by the policy backend. The cache doesn't talk | 24 // persistence file or determined by the policy backend. The cache doesn't talk |
25 // to the service directly, but receives updated policy information through | 25 // to the service directly, but receives updated policy information through |
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 ~DeviceManagementPolicyCache(); |
31 | 32 |
32 // Loads policy information from the backing file. Non-existing or erroneous | 33 // Loads policy information from the backing file. Non-existing or erroneous |
33 // cache files are ignored. | 34 // cache files are ignored. |
34 void LoadPolicyFromFile(); | 35 void LoadPolicyFromFile(); |
35 | 36 |
36 // Resets the policy information. Returns true if the new policy is different | 37 // Resets the policy information. Returns true if the new policy is different |
37 // from the previously stored policy. | 38 // from the previously stored policy. |
38 bool SetPolicy(const em::DevicePolicyResponse& policy); | 39 bool SetPolicy(const em::DevicePolicyResponse& policy); |
39 | 40 |
40 // Gets the policy information. Ownership of the return value is transferred | 41 // Gets the policy information. Ownership of the return value is transferred |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 85 |
85 bool is_device_unmanaged_; | 86 bool is_device_unmanaged_; |
86 | 87 |
87 // The time at which the policy was last refreshed. | 88 // The time at which the policy was last refreshed. |
88 base::Time last_policy_refresh_time_; | 89 base::Time last_policy_refresh_time_; |
89 }; | 90 }; |
90 | 91 |
91 } // namespace policy | 92 } // namespace policy |
92 | 93 |
93 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_CACHE_H_ | 94 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_CACHE_H_ |
OLD | NEW |