OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ASYNC_POLICY_PROVIDER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_PROVIDER_H_ |
6 #define CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_PROVIDER_H_ |
7 | 7 |
8 #include "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "components/policy/core/common/configuration_policy_provider.h" | 13 #include "components/policy/core/common/configuration_policy_provider.h" |
| 14 #include "components/policy/policy_export.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class MessageLoopProxy; | 17 class MessageLoopProxy; |
17 } | 18 } |
18 | 19 |
19 namespace policy { | 20 namespace policy { |
20 | 21 |
21 class AsyncPolicyLoader; | 22 class AsyncPolicyLoader; |
22 class PolicyBundle; | 23 class PolicyBundle; |
23 class SchemaRegistry; | 24 class SchemaRegistry; |
24 | 25 |
25 // A policy provider that loads its policies asynchronously on a background | 26 // A policy provider that loads its policies asynchronously on a background |
26 // thread. Platform-specific providers are created by passing an implementation | 27 // thread. Platform-specific providers are created by passing an implementation |
27 // of AsyncPolicyLoader to a new AsyncPolicyProvider. | 28 // of AsyncPolicyLoader to a new AsyncPolicyProvider. |
28 class AsyncPolicyProvider : public ConfigurationPolicyProvider, | 29 class POLICY_EXPORT AsyncPolicyProvider : public ConfigurationPolicyProvider, |
29 public base::NonThreadSafe { | 30 public base::NonThreadSafe { |
30 public: | 31 public: |
31 // The AsyncPolicyProvider does a synchronous load in its constructor, and | 32 // The AsyncPolicyProvider does a synchronous load in its constructor, and |
32 // therefore it needs the |registry| at construction time. The same |registry| | 33 // therefore it needs the |registry| at construction time. The same |registry| |
33 // should be passed later to Init(). | 34 // should be passed later to Init(). |
34 AsyncPolicyProvider(SchemaRegistry* registry, | 35 AsyncPolicyProvider(SchemaRegistry* registry, |
35 scoped_ptr<AsyncPolicyLoader> loader); | 36 scoped_ptr<AsyncPolicyLoader> loader); |
36 virtual ~AsyncPolicyProvider(); | 37 virtual ~AsyncPolicyProvider(); |
37 | 38 |
38 // ConfigurationPolicyProvider implementation. | 39 // ConfigurationPolicyProvider implementation. |
39 virtual void Init(SchemaRegistry* registry) OVERRIDE; | 40 virtual void Init(SchemaRegistry* registry) OVERRIDE; |
(...skipping 25 matching lines...) Expand all Loading... |
65 | 66 |
66 // Callback used to synchronize RefreshPolicies() calls with the background | 67 // Callback used to synchronize RefreshPolicies() calls with the background |
67 // thread. See the implementation for the details. | 68 // thread. See the implementation for the details. |
68 base::CancelableClosure refresh_callback_; | 69 base::CancelableClosure refresh_callback_; |
69 | 70 |
70 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyProvider); | 71 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyProvider); |
71 }; | 72 }; |
72 | 73 |
73 } // namespace policy | 74 } // namespace policy |
74 | 75 |
75 #endif // CHROME_BROWSER_POLICY_ASYNC_POLICY_PROVIDER_H_ | 76 #endif // COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_PROVIDER_H_ |
OLD | NEW |