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_SERVICE_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/sequence_checker.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
18 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
19 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
20 #include "components/policy/core/common/policy_bundle.h" | 20 #include "components/policy/core/common/policy_bundle.h" |
21 #include "components/policy/core/common/policy_namespace.h" | 21 #include "components/policy/core/common/policy_namespace.h" |
22 #include "components/policy/core/common/schema_registry.h" | 22 #include "components/policy/core/common/schema_registry.h" |
23 #include "components/policy/policy_export.h" | 23 #include "components/policy/policy_export.h" |
24 | 24 |
25 namespace base { | 25 namespace base { |
(...skipping 19 matching lines...) Expand all Loading... |
45 // downloaded and cached, regardless of the current state of the schema | 45 // downloaded and cached, regardless of the current state of the schema |
46 // registry. However, exposed are only the policies whose components are present | 46 // registry. However, exposed are only the policies whose components are present |
47 // in the schema registry. | 47 // in the schema registry. |
48 // | 48 // |
49 // The exposed policies are guaranteed to be conformant to the corresponding | 49 // The exposed policies are guaranteed to be conformant to the corresponding |
50 // schemas. Values that do not pass validation against the schema are dropped. | 50 // schemas. Values that do not pass validation against the schema are dropped. |
51 class POLICY_EXPORT ComponentCloudPolicyService | 51 class POLICY_EXPORT ComponentCloudPolicyService |
52 : public CloudPolicyClient::Observer, | 52 : public CloudPolicyClient::Observer, |
53 public CloudPolicyCore::Observer, | 53 public CloudPolicyCore::Observer, |
54 public CloudPolicyStore::Observer, | 54 public CloudPolicyStore::Observer, |
55 public SchemaRegistry::Observer, | 55 public SchemaRegistry::Observer { |
56 public base::NonThreadSafe { | |
57 public: | 56 public: |
58 class POLICY_EXPORT Delegate { | 57 class POLICY_EXPORT Delegate { |
59 public: | 58 public: |
60 virtual ~Delegate(); | 59 virtual ~Delegate(); |
61 | 60 |
62 // Invoked whenever the policy served by policy() changes. This is also | 61 // Invoked whenever the policy served by policy() changes. This is also |
63 // invoked for the first time once the backend is initialized, and | 62 // invoked for the first time once the backend is initialized, and |
64 // is_initialized() becomes true. | 63 // is_initialized() becomes true. |
65 virtual void OnComponentCloudPolicyUpdated() = 0; | 64 virtual void OnComponentCloudPolicyUpdated() = 0; |
66 }; | 65 }; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // filtered and validated by the |current_schema_map_|. | 180 // filtered and validated by the |current_schema_map_|. |
182 std::unique_ptr<PolicyBundle> unfiltered_policy_; | 181 std::unique_ptr<PolicyBundle> unfiltered_policy_; |
183 | 182 |
184 // Contains all the current policies for components, filtered and validated by | 183 // Contains all the current policies for components, filtered and validated by |
185 // the |current_schema_map_|. | 184 // the |current_schema_map_|. |
186 PolicyBundle policy_; | 185 PolicyBundle policy_; |
187 | 186 |
188 // Whether policies are being served. | 187 // Whether policies are being served. |
189 bool policy_installed_ = false; | 188 bool policy_installed_ = false; |
190 | 189 |
| 190 SEQUENCE_CHECKER(sequence_checker_); |
| 191 |
191 // Must be the last member. | 192 // Must be the last member. |
192 base::WeakPtrFactory<ComponentCloudPolicyService> weak_ptr_factory_; | 193 base::WeakPtrFactory<ComponentCloudPolicyService> weak_ptr_factory_; |
193 | 194 |
194 DISALLOW_COPY_AND_ASSIGN(ComponentCloudPolicyService); | 195 DISALLOW_COPY_AND_ASSIGN(ComponentCloudPolicyService); |
195 }; | 196 }; |
196 | 197 |
197 } // namespace policy | 198 } // namespace policy |
198 | 199 |
199 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ | 200 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_COMPONENT_CLOUD_POLICY_SERVICE_H_ |
OLD | NEW |