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_CONFIGURATION_POLICY_PROVIDER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 virtual void RefreshPolicies() = 0; | 67 virtual void RefreshPolicies() = 0; |
68 | 68 |
69 // Observers must detach themselves before the provider is deleted. | 69 // Observers must detach themselves before the provider is deleted. |
70 virtual void AddObserver(Observer* observer); | 70 virtual void AddObserver(Observer* observer); |
71 virtual void RemoveObserver(Observer* observer); | 71 virtual void RemoveObserver(Observer* observer); |
72 | 72 |
73 // SchemaRegistry::Observer: | 73 // SchemaRegistry::Observer: |
74 void OnSchemaRegistryUpdated(bool has_new_schemas) override; | 74 void OnSchemaRegistryUpdated(bool has_new_schemas) override; |
75 void OnSchemaRegistryReady() override; | 75 void OnSchemaRegistryReady() override; |
76 | 76 |
77 // Returns where the provided policies originate from. | |
Thiemo Nagel
2015/09/04 20:15:54
In my opinion, a 1-line getter isn't worth a comme
fhorschig
2015/09/07 14:09:34
Done.
| |
78 PolicySource source() const { return source_; } | |
79 | |
77 protected: | 80 protected: |
78 // Subclasses must invoke this to update the policies currently served by | 81 // Subclasses must invoke this to update the policies currently served by |
79 // this provider. UpdatePolicy() takes ownership of |policies|. | 82 // this provider. UpdatePolicy() takes ownership of |policies|. |
80 // The observers are notified after the policies are updated. | 83 // The observers are notified after the policies are updated. |
81 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); | 84 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); |
82 | 85 |
83 SchemaRegistry* schema_registry() const; | 86 SchemaRegistry* schema_registry() const; |
84 | 87 |
85 const scoped_refptr<SchemaMap>& schema_map() const; | 88 const scoped_refptr<SchemaMap>& schema_map() const; |
86 | 89 |
90 // This provider provides a policies only from one source at a time. And this | |
Thiemo Nagel
2015/09/04 20:15:54
"a policies" --> "policies"
". And this source is
fhorschig
2015/09/07 14:09:34
Done.
| |
91 // source is stored in this value (defaulting to POLICY_SOURCE_UNKNOWN). | |
92 PolicySource source_; | |
93 | |
87 private: | 94 private: |
95 // Used to tag all policies provided by this provider as coming from a | |
Thiemo Nagel
2015/09/04 20:15:54
Not from "a specific source" but from "|source_|".
fhorschig
2015/09/07 14:09:34
Done.
| |
96 // specific source. | |
97 void SetPolicySources(); | |
98 | |
88 // The policies currently configured at this provider. | 99 // The policies currently configured at this provider. |
89 PolicyBundle policy_bundle_; | 100 PolicyBundle policy_bundle_; |
90 | 101 |
91 // Used to validate proper Init() and Shutdown() nesting. This flag is set by | 102 // Used to validate proper Init() and Shutdown() nesting. This flag is set by |
92 // Init() and cleared by Shutdown() and needs to be false in the destructor. | 103 // Init() and cleared by Shutdown() and needs to be false in the destructor. |
93 bool initialized_; | 104 bool initialized_; |
94 | 105 |
95 SchemaRegistry* schema_registry_; | 106 SchemaRegistry* schema_registry_; |
96 | 107 |
97 base::ObserverList<Observer, true> observer_list_; | 108 base::ObserverList<Observer, true> observer_list_; |
98 | 109 |
99 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); | 110 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); |
100 }; | 111 }; |
101 | 112 |
102 } // namespace policy | 113 } // namespace policy |
103 | 114 |
104 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ | 115 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ |
OLD | NEW |