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_LOADER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/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/time/time.h" | 12 #include "base/time/time.h" |
13 #include "components/policy/core/common/policy_types.h" | |
Thiemo Nagel
2015/09/01 17:40:36
Don't include header files when it can be prevente
fhorschig
2015/09/04 06:53:53
Done.
| |
13 #include "components/policy/core/common/schema_map.h" | 14 #include "components/policy/core/common/schema_map.h" |
14 #include "components/policy/policy_export.h" | 15 #include "components/policy/policy_export.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class SequencedTaskRunner; | 18 class SequencedTaskRunner; |
18 } | 19 } |
19 | 20 |
20 namespace policy { | 21 namespace policy { |
21 | 22 |
22 class PolicyBundle; | 23 class PolicyBundle; |
(...skipping 19 matching lines...) Expand all Loading... | |
42 | 43 |
43 // Returns the currently configured policies. Load() is always invoked on | 44 // Returns the currently configured policies. Load() is always invoked on |
44 // the background thread, except for the initial Load() at startup which is | 45 // the background thread, except for the initial Load() at startup which is |
45 // invoked from the thread that owns the provider. | 46 // invoked from the thread that owns the provider. |
46 virtual scoped_ptr<PolicyBundle> Load() = 0; | 47 virtual scoped_ptr<PolicyBundle> Load() = 0; |
47 | 48 |
48 // Allows implementations to finalize their initialization on the background | 49 // Allows implementations to finalize their initialization on the background |
49 // thread (e.g. setup file watchers). | 50 // thread (e.g. setup file watchers). |
50 virtual void InitOnBackgroundThread() = 0; | 51 virtual void InitOnBackgroundThread() = 0; |
51 | 52 |
53 // Provides the source of the policies for providers. | |
54 virtual PolicySource source() const = 0; | |
Thiemo Nagel
2015/09/01 17:40:36
Please add a source_ member and make this a non-ab
fhorschig
2015/09/04 06:53:54
Done. (Not even necessary. Loaders are always of p
| |
55 | |
52 // Implementations should return the time of the last modification detected, | 56 // Implementations should return the time of the last modification detected, |
53 // or base::Time() if it doesn't apply, which is the default. | 57 // or base::Time() if it doesn't apply, which is the default. |
54 virtual base::Time LastModificationTime(); | 58 virtual base::Time LastModificationTime(); |
55 | 59 |
56 // Used by the AsyncPolicyProvider to do the initial Load(). The first load | 60 // Used by the AsyncPolicyProvider to do the initial Load(). The first load |
57 // is also used to initialize |last_modification_time_| and | 61 // is also used to initialize |last_modification_time_| and |
58 // |schema_map_|. | 62 // |schema_map_|. |
59 scoped_ptr<PolicyBundle> InitialLoad(const scoped_refptr<SchemaMap>& schemas); | 63 scoped_ptr<PolicyBundle> InitialLoad(const scoped_refptr<SchemaMap>& schemas); |
60 | 64 |
61 // Implementations should invoke Reload() when a change is detected. This | 65 // Implementations should invoke Reload() when a change is detected. This |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 | 117 |
114 // Used to get WeakPtrs for the periodic reload task. | 118 // Used to get WeakPtrs for the periodic reload task. |
115 base::WeakPtrFactory<AsyncPolicyLoader> weak_factory_; | 119 base::WeakPtrFactory<AsyncPolicyLoader> weak_factory_; |
116 | 120 |
117 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyLoader); | 121 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyLoader); |
118 }; | 122 }; |
119 | 123 |
120 } // namespace policy | 124 } // namespace policy |
121 | 125 |
122 #endif // COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ | 126 #endif // COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ |
OLD | NEW |