| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CONFIGURATION_POLICY_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ | 6 #define CHROME_BROWSER_POLICY_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // which are guaranteed to happen even if the refresh fails. | 62 // which are guaranteed to happen even if the refresh fails. |
| 63 // It is possible that Shutdown() is called first though, and | 63 // It is possible that Shutdown() is called first though, and |
| 64 // OnUpdatePolicy won't be called if that happens. | 64 // OnUpdatePolicy won't be called if that happens. |
| 65 virtual void RefreshPolicies() = 0; | 65 virtual void RefreshPolicies() = 0; |
| 66 | 66 |
| 67 // Observers must detach themselves before the provider is deleted. | 67 // Observers must detach themselves before the provider is deleted. |
| 68 virtual void AddObserver(Observer* observer); | 68 virtual void AddObserver(Observer* observer); |
| 69 virtual void RemoveObserver(Observer* observer); | 69 virtual void RemoveObserver(Observer* observer); |
| 70 | 70 |
| 71 // SchemaRegistry::Observer: | 71 // SchemaRegistry::Observer: |
| 72 // This base implementation calls RefreshPolicies if | |
| 73 // |has_new_schemas| is true. | |
| 74 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) OVERRIDE; | 72 virtual void OnSchemaRegistryUpdated(bool has_new_schemas) OVERRIDE; |
| 73 virtual void OnSchemaRegistryReady() OVERRIDE; |
| 75 | 74 |
| 76 protected: | 75 protected: |
| 77 // Subclasses must invoke this to update the policies currently served by | 76 // Subclasses must invoke this to update the policies currently served by |
| 78 // this provider. UpdatePolicy() takes ownership of |policies|. | 77 // this provider. UpdatePolicy() takes ownership of |policies|. |
| 79 // The observers are notified after the policies are updated. | 78 // The observers are notified after the policies are updated. |
| 80 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); | 79 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); |
| 81 | 80 |
| 82 const scoped_refptr<SchemaMap>& schema_map() const; | 81 const scoped_refptr<SchemaMap>& schema_map() const; |
| 83 | 82 |
| 84 private: | 83 private: |
| 85 // The policies currently configured at this provider. | 84 // The policies currently configured at this provider. |
| 86 PolicyBundle policy_bundle_; | 85 PolicyBundle policy_bundle_; |
| 87 | 86 |
| 88 // Whether Shutdown() has been invoked. | 87 // Whether Shutdown() has been invoked. |
| 89 bool did_shutdown_; | 88 bool did_shutdown_; |
| 90 | 89 |
| 91 SchemaRegistry* schema_registry_; | 90 SchemaRegistry* schema_registry_; |
| 92 | 91 |
| 93 ObserverList<Observer, true> observer_list_; | 92 ObserverList<Observer, true> observer_list_; |
| 94 | 93 |
| 95 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); | 94 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 } // namespace policy | 97 } // namespace policy |
| 99 | 98 |
| 100 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ | 99 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| OLD | NEW |