OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 REMOTING_HOST_POLICY_WATCHER_H_ | 5 #ifndef REMOTING_HOST_POLICY_WATCHER_H_ |
6 #define REMOTING_HOST_POLICY_WATCHER_H_ | 6 #define REMOTING_HOST_POLICY_WATCHER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/sequence_checker.h" |
14 #include "components/policy/core/common/policy_service.h" | 14 #include "components/policy/core/common/policy_service.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 class SingleThreadTaskRunner; | 18 class SingleThreadTaskRunner; |
19 } // namespace base | 19 } // namespace base |
20 | 20 |
21 namespace policy { | 21 namespace policy { |
22 class AsyncPolicyLoader; | 22 class AsyncPolicyLoader; |
23 class ConfigurationPolicyProvider; | 23 class ConfigurationPolicyProvider; |
24 class Schema; | 24 class Schema; |
25 class SchemaRegistry; | 25 class SchemaRegistry; |
26 } // namespace policy | 26 } // namespace policy |
27 | 27 |
28 namespace remoting { | 28 namespace remoting { |
29 | 29 |
30 // Watches for changes to the managed remote access host policies. | 30 // Watches for changes to the managed remote access host policies. |
31 class PolicyWatcher : public policy::PolicyService::Observer, | 31 class PolicyWatcher : public policy::PolicyService::Observer { |
32 public base::NonThreadSafe { | |
33 public: | 32 public: |
34 // Called first with all policies, and subsequently with any changed policies. | 33 // Called first with all policies, and subsequently with any changed policies. |
35 typedef base::Callback<void(std::unique_ptr<base::DictionaryValue>)> | 34 typedef base::Callback<void(std::unique_ptr<base::DictionaryValue>)> |
36 PolicyUpdatedCallback; | 35 PolicyUpdatedCallback; |
37 | 36 |
38 // Called after detecting malformed policies. | 37 // Called after detecting malformed policies. |
39 typedef base::Callback<void()> PolicyErrorCallback; | 38 typedef base::Callback<void()> PolicyErrorCallback; |
40 | 39 |
41 ~PolicyWatcher() override; | 40 ~PolicyWatcher() override; |
42 | 41 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 policy::PolicyService* policy_service_; | 150 policy::PolicyService* policy_service_; |
152 | 151 |
153 // Order of fields below is important to ensure destruction takes object | 152 // Order of fields below is important to ensure destruction takes object |
154 // dependencies into account: | 153 // dependencies into account: |
155 // - |owned_policy_service_| uses |owned_policy_provider_| | 154 // - |owned_policy_service_| uses |owned_policy_provider_| |
156 // - |owned_policy_provider_| uses |owned_schema_registry_| | 155 // - |owned_policy_provider_| uses |owned_schema_registry_| |
157 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry_; | 156 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry_; |
158 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_; | 157 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_; |
159 std::unique_ptr<policy::PolicyService> owned_policy_service_; | 158 std::unique_ptr<policy::PolicyService> owned_policy_service_; |
160 | 159 |
| 160 SEQUENCE_CHECKER(sequence_checker_); |
| 161 |
161 DISALLOW_COPY_AND_ASSIGN(PolicyWatcher); | 162 DISALLOW_COPY_AND_ASSIGN(PolicyWatcher); |
162 }; | 163 }; |
163 | 164 |
164 } // namespace remoting | 165 } // namespace remoting |
165 | 166 |
166 #endif // REMOTING_HOST_POLICY_WATCHER_H_ | 167 #endif // REMOTING_HOST_POLICY_WATCHER_H_ |
OLD | NEW |