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 // Template Method used to inject a providers source into |UpdatePolicy|. | |
Thiemo Nagel
2015/09/01 17:40:37
Could you please add a source_ member and make tha
fhorschig
2015/09/04 06:53:54
Done.
| |
78 virtual PolicySource source() const = 0; | |
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 |
87 private: | 90 private: |
91 // Used to tag all policies provided by this provider coming from a specific | |
92 // source. | |
93 void SetSources(PolicySource source); | |
Thiemo Nagel
2015/09/01 17:40:37
Again I think it would be clearer to call this "Se
fhorschig
2015/09/04 06:53:54
The name is misleading. This function actually set
| |
94 | |
88 // The policies currently configured at this provider. | 95 // The policies currently configured at this provider. |
89 PolicyBundle policy_bundle_; | 96 PolicyBundle policy_bundle_; |
90 | 97 |
91 // Used to validate proper Init() and Shutdown() nesting. This flag is set by | 98 // 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. | 99 // Init() and cleared by Shutdown() and needs to be false in the destructor. |
93 bool initialized_; | 100 bool initialized_; |
94 | 101 |
95 SchemaRegistry* schema_registry_; | 102 SchemaRegistry* schema_registry_; |
96 | 103 |
97 base::ObserverList<Observer, true> observer_list_; | 104 base::ObserverList<Observer, true> observer_list_; |
98 | 105 |
99 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); | 106 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); |
100 }; | 107 }; |
101 | 108 |
102 } // namespace policy | 109 } // namespace policy |
103 | 110 |
104 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ | 111 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ |
OLD | NEW |