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_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_ |
6 #define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_ | 6 #define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_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/memory/weak_ptr.h" | |
11 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
12 #include "chrome/browser/policy/configuration_policy_provider.h" | 11 #include "chrome/browser/policy/configuration_policy_provider.h" |
13 | 12 |
14 namespace policy { | 13 namespace policy { |
15 | 14 |
16 class AsynchronousPolicyLoader; | 15 class AsynchronousPolicyLoader; |
17 | 16 |
18 // Policy provider that loads policy asynchronously. Providers should subclass | 17 // Policy provider that loads policy asynchronously. Providers should subclass |
19 // from this class if loading the policy requires disk access or must for some | 18 // from this class if loading the policy requires disk access or must for some |
20 // other reason be performed on the file thread. The actual logic for loading | 19 // other reason be performed on the file thread. The actual logic for loading |
(...skipping 11 matching lines...) Expand all Loading... |
32 virtual DictionaryValue* Load() = 0; | 31 virtual DictionaryValue* Load() = 0; |
33 }; | 32 }; |
34 | 33 |
35 // Assumes ownership of |loader|. | 34 // Assumes ownership of |loader|. |
36 AsynchronousPolicyProvider( | 35 AsynchronousPolicyProvider( |
37 const PolicyDefinitionList* policy_list, | 36 const PolicyDefinitionList* policy_list, |
38 scoped_refptr<AsynchronousPolicyLoader> loader); | 37 scoped_refptr<AsynchronousPolicyLoader> loader); |
39 virtual ~AsynchronousPolicyProvider(); | 38 virtual ~AsynchronousPolicyProvider(); |
40 | 39 |
41 // ConfigurationPolicyProvider implementation. | 40 // ConfigurationPolicyProvider implementation. |
42 virtual bool Provide(PolicyMap* map); | 41 virtual bool Provide(PolicyMap* map) OVERRIDE; |
43 | 42 |
44 // For tests to trigger reloads. | 43 // For tests to trigger reloads. |
45 scoped_refptr<AsynchronousPolicyLoader> loader(); | 44 scoped_refptr<AsynchronousPolicyLoader> loader(); |
46 | 45 |
47 protected: | 46 protected: |
48 // The loader object used internally. | 47 // The loader object used internally. |
49 scoped_refptr<AsynchronousPolicyLoader> loader_; | 48 scoped_refptr<AsynchronousPolicyLoader> loader_; |
50 | 49 |
51 private: | 50 private: |
52 // ConfigurationPolicyProvider overrides: | 51 // ConfigurationPolicyProvider overrides: |
53 virtual void AddObserver(ConfigurationPolicyProvider::Observer* observer); | 52 virtual void AddObserver(ConfigurationPolicyProvider::Observer* observer) |
54 virtual void RemoveObserver(ConfigurationPolicyProvider::Observer* observer); | 53 OVERRIDE; |
| 54 virtual void RemoveObserver(ConfigurationPolicyProvider::Observer* observer) |
| 55 OVERRIDE; |
55 | 56 |
56 DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyProvider); | 57 DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyProvider); |
57 }; | 58 }; |
58 | 59 |
59 } // namespace policy | 60 } // namespace policy |
60 | 61 |
61 #endif // CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_ | 62 #endif // CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_ |
OLD | NEW |