OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_STORE_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_STORE_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_STORE_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_STORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/sequence_checker.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "components/policy/core/common/cloud/resource_cache.h" | 15 #include "components/policy/core/common/cloud/resource_cache.h" |
16 #include "components/policy/core/common/policy_bundle.h" | 16 #include "components/policy/core/common/policy_bundle.h" |
17 #include "components/policy/core/common/policy_namespace.h" | 17 #include "components/policy/core/common/policy_namespace.h" |
18 #include "components/policy/policy_export.h" | 18 #include "components/policy/policy_export.h" |
19 | 19 |
20 namespace enterprise_management { | 20 namespace enterprise_management { |
21 class ExternalPolicyData; | 21 class ExternalPolicyData; |
22 class PolicyData; | 22 class PolicyData; |
23 class PolicyFetchResponse; | 23 class PolicyFetchResponse; |
24 } | 24 } |
25 | 25 |
26 namespace policy { | 26 namespace policy { |
27 | 27 |
28 // Validates protobufs for external policy data, validates the data itself, and | 28 // Validates protobufs for external policy data, validates the data itself, and |
29 // caches both locally. | 29 // caches both locally. |
30 // | 30 // |
31 // The policy data is validated using the credentials that have to be passed | 31 // The policy data is validated using the credentials that have to be passed |
32 // beforehand using |SetCredentials|. The expectation is that these credentials | 32 // beforehand using |SetCredentials|. The expectation is that these credentials |
33 // should be the same as used for validating the superior policy (e.g. the user | 33 // should be the same as used for validating the superior policy (e.g. the user |
34 // policy, the device-local account policy, etc.). | 34 // policy, the device-local account policy, etc.). |
35 class POLICY_EXPORT ComponentCloudPolicyStore : public base::NonThreadSafe { | 35 class POLICY_EXPORT ComponentCloudPolicyStore { |
36 public: | 36 public: |
37 class POLICY_EXPORT Delegate { | 37 class POLICY_EXPORT Delegate { |
38 public: | 38 public: |
39 virtual ~Delegate(); | 39 virtual ~Delegate(); |
40 | 40 |
41 // Invoked whenever the policies served by policy() have changed, except | 41 // Invoked whenever the policies served by policy() have changed, except |
42 // for the initial Load(). | 42 // for the initial Load(). |
43 virtual void OnComponentCloudPolicyStoreUpdated() = 0; | 43 virtual void OnComponentCloudPolicyStoreUpdated() = 0; |
44 }; | 44 }; |
45 | 45 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 // The current list of policies. | 145 // The current list of policies. |
146 PolicyBundle policy_bundle_; | 146 PolicyBundle policy_bundle_; |
147 // Mapping from policy namespace to data hashes for each currently exposed | 147 // Mapping from policy namespace to data hashes for each currently exposed |
148 // component. | 148 // component. |
149 std::map<PolicyNamespace, std::string> cached_hashes_; | 149 std::map<PolicyNamespace, std::string> cached_hashes_; |
150 // Mapping from policy namespace to policy timestamp for each currently | 150 // Mapping from policy namespace to policy timestamp for each currently |
151 // exposed component. | 151 // exposed component. |
152 std::map<PolicyNamespace, base::Time> stored_policy_times_; | 152 std::map<PolicyNamespace, base::Time> stored_policy_times_; |
153 | 153 |
| 154 SEQUENCE_CHECKER(sequence_checker_); |
| 155 |
154 DISALLOW_COPY_AND_ASSIGN(ComponentCloudPolicyStore); | 156 DISALLOW_COPY_AND_ASSIGN(ComponentCloudPolicyStore); |
155 }; | 157 }; |
156 | 158 |
157 } // namespace policy | 159 } // namespace policy |
158 | 160 |
159 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_STORE_H_ | 161 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_STORE_H_ |
OLD | NEW |