| 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 17 matching lines...) Expand all Loading... |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 ConfigurationPolicyProvider(); | 30 ConfigurationPolicyProvider(); |
| 31 | 31 |
| 32 // Policy providers can be deleted quite late during shutdown of the browser, | 32 // Policy providers can be deleted quite late during shutdown of the browser, |
| 33 // and it's not guaranteed that the message loops will still be running when | 33 // and it's not guaranteed that the message loops will still be running when |
| 34 // this is invoked. Override Shutdown() instead for cleanup code that needs | 34 // this is invoked. Override Shutdown() instead for cleanup code that needs |
| 35 // to post to the FILE thread, for example. | 35 // to post to the FILE thread, for example. |
| 36 virtual ~ConfigurationPolicyProvider(); | 36 virtual ~ConfigurationPolicyProvider(); |
| 37 | 37 |
| 38 // Perform an initial synchronous load before initialization. |
| 39 virtual void InitialLoad(); |
| 40 |
| 38 // Invoked as soon as the main message loops are spinning. Policy providers | 41 // Invoked as soon as the main message loops are spinning. Policy providers |
| 39 // are created early during startup to provide the initial policies; the | 42 // are created early during startup to provide the initial policies; the |
| 40 // Init() call allows them to perform initialization tasks that require | 43 // Init() call allows them to perform initialization tasks that require |
| 41 // running message loops. | 44 // running message loops. |
| 42 virtual void Init(); | 45 virtual void Init(); |
| 43 | 46 |
| 44 // Must be invoked before deleting the provider. Implementations can override | 47 // Must be invoked before deleting the provider. Implementations can override |
| 45 // this method to do appropriate cleanup while threads are still running, and | 48 // this method to do appropriate cleanup while threads are still running, and |
| 46 // must also invoke ConfigurationPolicyProvider::Shutdown(). | 49 // must also invoke ConfigurationPolicyProvider::Shutdown(). |
| 47 // The provider should keep providing the current policies after Shutdown() | 50 // The provider should keep providing the current policies after Shutdown() |
| (...skipping 20 matching lines...) Expand all Loading... |
| 68 virtual void RemoveObserver(Observer* observer); | 71 virtual void RemoveObserver(Observer* observer); |
| 69 | 72 |
| 70 // Notifies the provider that there is interest in loading policy for the | 73 // Notifies the provider that there is interest in loading policy for the |
| 71 // listed components in the given |descriptor|. The list is complete; all the | 74 // listed components in the given |descriptor|. The list is complete; all the |
| 72 // components that matter for the domain are included, and components not | 75 // components that matter for the domain are included, and components not |
| 73 // included can be discarded. The provider can ignore this information or use | 76 // included can be discarded. The provider can ignore this information or use |
| 74 // it to selectively load the corresponding policy from its sources. | 77 // it to selectively load the corresponding policy from its sources. |
| 75 virtual void RegisterPolicyDomain( | 78 virtual void RegisterPolicyDomain( |
| 76 scoped_refptr<const PolicyDomainDescriptor> descriptor); | 79 scoped_refptr<const PolicyDomainDescriptor> descriptor); |
| 77 | 80 |
| 81 // Registers a policy domain without triggering a policy load. |
| 82 virtual void InitialRegisterPolicyDomain( |
| 83 scoped_refptr<const PolicyDomainDescriptor> descriptor); |
| 84 |
| 78 protected: | 85 protected: |
| 79 // Subclasses must invoke this to update the policies currently served by | 86 // Subclasses must invoke this to update the policies currently served by |
| 80 // this provider. UpdatePolicy() takes ownership of |policies|. | 87 // this provider. UpdatePolicy() takes ownership of |policies|. |
| 81 // The observers are notified after the policies are updated. | 88 // The observers are notified after the policies are updated. |
| 82 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); | 89 void UpdatePolicy(scoped_ptr<PolicyBundle> bundle); |
| 83 | 90 |
| 84 private: | 91 private: |
| 85 // The policies currently configured at this provider. | 92 // The policies currently configured at this provider. |
| 86 PolicyBundle policy_bundle_; | 93 PolicyBundle policy_bundle_; |
| 87 | 94 |
| 88 // Whether Shutdown() has been invoked. | 95 // Whether Shutdown() has been invoked. |
| 89 bool did_shutdown_; | 96 bool did_shutdown_; |
| 90 | 97 |
| 91 ObserverList<Observer, true> observer_list_; | 98 ObserverList<Observer, true> observer_list_; |
| 92 | 99 |
| 93 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); | 100 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProvider); |
| 94 }; | 101 }; |
| 95 | 102 |
| 96 } // namespace policy | 103 } // namespace policy |
| 97 | 104 |
| 98 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ | 105 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| OLD | NEW |