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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // which are guaranteed to happen even if the refresh fails. | 64 // which are guaranteed to happen even if the refresh fails. |
65 // It is possible that Shutdown() is called first though, and | 65 // It is possible that Shutdown() is called first though, and |
66 // OnUpdatePolicy won't be called if that happens. | 66 // OnUpdatePolicy won't be called if that happens. |
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 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) OVERRIDE; | 74 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) override; |
75 virtual void OnSchemaRegistryReady() OVERRIDE; | 75 virtual void OnSchemaRegistryReady() override; |
76 | 76 |
77 protected: | 77 protected: |
78 // Subclasses must invoke this to update the policies currently served by | 78 // Subclasses must invoke this to update the policies currently served by |
79 // this provider. UpdatePolicy() takes ownership of |policies|. | 79 // this provider. UpdatePolicy() takes ownership of |policies|. |
80 // The observers are notified after the policies are updated. | 80 // The observers are notified after the policies are updated. |
81 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); | 81 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); |
82 | 82 |
83 SchemaRegistry* schema_registry() const; | 83 SchemaRegistry* schema_registry() const; |
84 | 84 |
85 const scoped_refptr<SchemaMap>& schema_map() const; | 85 const scoped_refptr<SchemaMap>& schema_map() const; |
86 | 86 |
87 private: | 87 private: |
88 // The policies currently configured at this provider. | 88 // The policies currently configured at this provider. |
89 PolicyBundle policy_bundle_; | 89 PolicyBundle policy_bundle_; |
90 | 90 |
91 // Whether Shutdown() has been invoked. | 91 // Whether Shutdown() has been invoked. |
92 bool did_shutdown_; | 92 bool did_shutdown_; |
93 | 93 |
94 SchemaRegistry* schema_registry_; | 94 SchemaRegistry* schema_registry_; |
95 | 95 |
96 ObserverList<Observer, true> observer_list_; | 96 ObserverList<Observer, true> observer_list_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); | 98 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); |
99 }; | 99 }; |
100 | 100 |
101 } // namespace policy | 101 } // namespace policy |
102 | 102 |
103 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ | 103 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_H_ |
OLD | NEW |