OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_ASYNC_POLICY_PROVIDER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_PROVIDER_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // forwards to OnLoaderReloaded() on the loop that owns the provider, | 53 // forwards to OnLoaderReloaded() on the loop that owns the provider, |
54 // if |weak_this| is still valid. | 54 // if |weak_this| is still valid. |
55 static void LoaderUpdateCallback(scoped_refptr<base::MessageLoopProxy> loop, | 55 static void LoaderUpdateCallback(scoped_refptr<base::MessageLoopProxy> loop, |
56 base::WeakPtr<AsyncPolicyProvider> weak_this, | 56 base::WeakPtr<AsyncPolicyProvider> weak_this, |
57 scoped_ptr<PolicyBundle> bundle); | 57 scoped_ptr<PolicyBundle> bundle); |
58 | 58 |
59 // The |loader_| that does the platform-specific policy loading. It lives | 59 // The |loader_| that does the platform-specific policy loading. It lives |
60 // on the background thread but is owned by |this|. | 60 // on the background thread but is owned by |this|. |
61 AsyncPolicyLoader* loader_; | 61 AsyncPolicyLoader* loader_; |
62 | 62 |
| 63 // Callback used to synchronize RefreshPolicies() calls with the background |
| 64 // thread. See the implementation for the details. |
| 65 base::CancelableClosure refresh_callback_; |
| 66 |
63 // Used to get a WeakPtr to |this| for the update callback given to the | 67 // Used to get a WeakPtr to |this| for the update callback given to the |
64 // loader. | 68 // loader. |
65 base::WeakPtrFactory<AsyncPolicyProvider> weak_factory_; | 69 base::WeakPtrFactory<AsyncPolicyProvider> weak_factory_; |
66 | 70 |
67 // Callback used to synchronize RefreshPolicies() calls with the background | |
68 // thread. See the implementation for the details. | |
69 base::CancelableClosure refresh_callback_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyProvider); | 71 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyProvider); |
72 }; | 72 }; |
73 | 73 |
74 } // namespace policy | 74 } // namespace policy |
75 | 75 |
76 #endif // COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_PROVIDER_H_ | 76 #endif // COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_PROVIDER_H_ |
OLD | NEW |