OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ASYNCHRONOUS_POLICY_LOADER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_LOADER_H_ |
6 #define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_LOADER_H_ | 6 #define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_LOADER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "base/time.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "chrome/browser/policy/asynchronous_policy_provider.h" | 14 #include "chrome/browser/policy/asynchronous_policy_provider.h" |
14 #include "chrome/browser/policy/configuration_policy_provider.h" | 15 #include "chrome/browser/policy/configuration_policy_provider.h" |
15 | 16 |
| 17 class CancelableTask; |
| 18 class MessageLoop; |
| 19 |
16 namespace policy { | 20 namespace policy { |
17 | 21 |
18 // Used by the implementation of asynchronous policy provider to manage the | 22 // Used by the implementation of asynchronous policy provider to manage the |
19 // tasks on the file thread that do the heavy lifting of loading policies. | 23 // tasks on the file thread that do the heavy lifting of loading policies. |
20 class AsynchronousPolicyLoader | 24 class AsynchronousPolicyLoader |
21 : public base::RefCountedThreadSafe<AsynchronousPolicyLoader> { | 25 : public base::RefCountedThreadSafe<AsynchronousPolicyLoader> { |
22 public: | 26 public: |
23 explicit AsynchronousPolicyLoader( | 27 AsynchronousPolicyLoader(AsynchronousPolicyProvider::Delegate* delegate, |
24 AsynchronousPolicyProvider::Delegate* delegate, | 28 int reload_interval_minutes); |
25 int reload_interval_minutes); | |
26 | 29 |
27 // Triggers initial policy load. | 30 // Triggers initial policy load. |
28 virtual void Init(); | 31 virtual void Init(); |
29 | 32 |
30 // Reloads policy, sending notification of changes if necessary. Must be | 33 // Reloads policy, sending notification of changes if necessary. Must be |
31 // called on the file thread. | 34 // called on the file thread. |
32 virtual void Reload(); | 35 virtual void Reload(); |
33 | 36 |
34 // Stops any pending reload tasks. | 37 // Stops any pending reload tasks. |
35 virtual void Stop(); | 38 virtual void Stop(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 bool stopped_; | 112 bool stopped_; |
110 | 113 |
111 ObserverList<ConfigurationPolicyProvider::Observer, true> observer_list_; | 114 ObserverList<ConfigurationPolicyProvider::Observer, true> observer_list_; |
112 | 115 |
113 DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyLoader); | 116 DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyLoader); |
114 }; | 117 }; |
115 | 118 |
116 } // namespace policy | 119 } // namespace policy |
117 | 120 |
118 #endif // CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_LOADER_H_ | 121 #endif // CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_LOADER_H_ |
OLD | NEW |