OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_ | |
6 #define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_ | |
7 #pragma once | |
8 | |
9 #include "base/ref_counted.h" | |
10 #include "base/time.h" | |
Mattias Nissler (ping if slow)
2010/12/06 10:26:20
do you need this header?
danno
2010/12/06 14:05:12
Done.
| |
11 #include "base/weak_ptr.h" | |
12 #include "chrome/browser/policy/configuration_policy_provider.h" | |
13 | |
14 class CancelableTask; | |
Mattias Nissler (ping if slow)
2010/12/06 10:26:20
not needed?
danno
2010/12/06 14:05:12
Done.
| |
15 class MessageLoop; | |
Mattias Nissler (ping if slow)
2010/12/06 10:26:20
not needed?
danno
2010/12/06 14:05:12
Done.
| |
16 | |
17 namespace policy { | |
18 | |
19 class AsynchronousPolicyLoader; | |
20 | |
21 // Policy provider that loads policy asynchronously. Providers should subclass | |
22 // from this class if loading the policy requires disk access or must for some | |
23 // other reason be performed on the file thread. The actual logic for loading | |
24 // policy is handled by a delegate passed at construction time. | |
25 class AsynchronousPolicyProvider | |
26 : public ConfigurationPolicyProvider, | |
27 public base::SupportsWeakPtr<AsynchronousPolicyProvider> { | |
28 public: | |
29 // Must be implemented by subclasses of the asynchronous policy provider to | |
30 // provide the implementation details of how policy is loaded. | |
31 class Delegate { | |
32 public: | |
33 Delegate() {} | |
34 virtual ~Delegate() {} | |
35 | |
36 virtual DictionaryValue* Load() = 0; | |
37 | |
38 private: | |
39 DISALLOW_COPY_AND_ASSIGN(Delegate); | |
Mattias Nissler (ping if slow)
2010/12/06 10:26:20
I think technically you don't need DISALLOW_COPY_A
danno
2010/12/06 14:05:12
Done.
| |
40 }; | |
41 | |
42 // Assumes ownership of |delegate|. | |
Mattias Nissler (ping if slow)
2010/12/06 10:26:20
s/delegate/loader/
danno
2010/12/06 14:05:12
Done.
| |
43 AsynchronousPolicyProvider( | |
44 const PolicyDefinitionList* policy_list, | |
45 scoped_refptr<AsynchronousPolicyLoader> loader); | |
46 virtual ~AsynchronousPolicyProvider(); | |
47 | |
48 // ConfigurationPolicyProvider implementation. | |
49 virtual bool Provide(ConfigurationPolicyStoreInterface* store); | |
50 | |
51 // For tests to trigger reloads | |
Mattias Nissler (ping if slow)
2010/12/06 10:26:20
missing period. If tests construct the provider th
danno
2010/12/06 14:05:12
One the AsynchronousPolicyProvider allows the load
| |
52 scoped_refptr<AsynchronousPolicyLoader> loader(); | |
53 | |
54 protected: | |
55 // The loader object used internally. | |
Mattias Nissler (ping if slow)
2010/12/06 10:26:20
Indentation.
danno
2010/12/06 14:05:12
Done.
| |
56 scoped_refptr<AsynchronousPolicyLoader> loader_; | |
57 | |
58 private: | |
59 DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyProvider); | |
60 }; | |
61 | |
62 } // namespace policy | |
63 | |
64 #endif // CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_ | |
OLD | NEW |