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 23 matching lines...) Expand all Loading... |
34 void LoadPolicyFromFile(); | 34 void LoadPolicyFromFile(); |
35 | 35 |
36 // Resets the policy information. Returns true if the new policy is different | 36 // Resets the policy information. Returns true if the new policy is different |
37 // from the previously stored policy. | 37 // from the previously stored policy. |
38 bool SetPolicy(const em::DevicePolicyResponse& policy); | 38 bool SetPolicy(const em::DevicePolicyResponse& policy); |
39 | 39 |
40 // Gets the policy information. Ownership of the return value is transferred | 40 // Gets the policy information. Ownership of the return value is transferred |
41 // to the caller. | 41 // to the caller. |
42 DictionaryValue* GetPolicy(); | 42 DictionaryValue* GetPolicy(); |
43 | 43 |
44 void SetDeviceUnmanaged(bool is_device_unmanaged); | |
45 bool is_device_unmanaged() const { | |
46 return is_device_unmanaged_; | |
47 } | |
48 | |
49 // Returns the time as which the policy was last fetched. | 44 // Returns the time as which the policy was last fetched. |
50 base::Time last_policy_refresh_time() const { | 45 base::Time last_policy_refresh_time() const { |
51 return last_policy_refresh_time_; | 46 return last_policy_refresh_time_; |
52 } | 47 } |
53 | 48 |
54 private: | 49 private: |
55 friend class DeviceManagementPolicyCacheDecodeTest; | 50 friend class DeviceManagementPolicyCacheDecodeTest; |
56 FRIEND_TEST_ALL_PREFIXES(DeviceManagementPolicyCacheDecodeTest, DecodePolicy); | 51 FRIEND_TEST_ALL_PREFIXES(DeviceManagementPolicyCacheDecodeTest, DecodePolicy); |
57 | 52 |
58 // Decodes an int64 value. Checks whether the passed value fits the numeric | 53 // Decodes an int64 value. Checks whether the passed value fits the numeric |
(...skipping 16 matching lines...) Expand all Loading... |
75 // Protects |policy_|. | 70 // Protects |policy_|. |
76 Lock lock_; | 71 Lock lock_; |
77 | 72 |
78 // Policy key-value information. | 73 // Policy key-value information. |
79 scoped_ptr<DictionaryValue> policy_; | 74 scoped_ptr<DictionaryValue> policy_; |
80 | 75 |
81 // Tracks whether the store received a SetPolicy() call, which overrides any | 76 // Tracks whether the store received a SetPolicy() call, which overrides any |
82 // information loaded from the file. | 77 // information loaded from the file. |
83 bool fresh_policy_; | 78 bool fresh_policy_; |
84 | 79 |
85 bool is_device_unmanaged_; | |
86 | |
87 // The time at which the policy was last refreshed. | 80 // The time at which the policy was last refreshed. |
88 base::Time last_policy_refresh_time_; | 81 base::Time last_policy_refresh_time_; |
89 }; | 82 }; |
90 | 83 |
91 } // namespace policy | 84 } // namespace policy |
92 | 85 |
93 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_CACHE_H_ | 86 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_CACHE_H_ |
OLD | NEW |