| 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_POLICY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ |
| 6 #define CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ | 6 #define CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // account their priorities. Policy clients can retrieve policy for their domain | 31 // account their priorities. Policy clients can retrieve policy for their domain |
| 32 // and register for notifications on policy updates. | 32 // and register for notifications on policy updates. |
| 33 // | 33 // |
| 34 // The PolicyService is available from BrowserProcess as a global singleton. | 34 // The PolicyService is available from BrowserProcess as a global singleton. |
| 35 // There is also a PolicyService for browser-wide policies available from | 35 // There is also a PolicyService for browser-wide policies available from |
| 36 // BrowserProcess as a global singleton. | 36 // BrowserProcess as a global singleton. |
| 37 class PolicyService { | 37 class PolicyService { |
| 38 public: | 38 public: |
| 39 class Observer { | 39 class Observer { |
| 40 public: | 40 public: |
| 41 virtual ~Observer() {} | |
| 42 | |
| 43 // Invoked whenever policies for the |domain|, |component_id| namespace are | 41 // Invoked whenever policies for the |domain|, |component_id| namespace are |
| 44 // modified. This is only invoked for changes that happen after AddObserver | 42 // modified. This is only invoked for changes that happen after AddObserver |
| 45 // is called. |previous| contains the values of the policies before the | 43 // is called. |previous| contains the values of the policies before the |
| 46 // update, and |current| contains the current values. | 44 // update, and |current| contains the current values. |
| 47 virtual void OnPolicyUpdated(PolicyDomain domain, | 45 virtual void OnPolicyUpdated(PolicyDomain domain, |
| 48 const std::string& component_id, | 46 const std::string& component_id, |
| 49 const PolicyMap& previous, | 47 const PolicyMap& previous, |
| 50 const PolicyMap& current) = 0; | 48 const PolicyMap& current) = 0; |
| 51 | 49 |
| 52 // Invoked at most once, when the PolicyService becomes ready. If | 50 // Invoked at most once, when the PolicyService becomes ready. If |
| 53 // IsInitializationComplete() is false, then this will be invoked once all | 51 // IsInitializationComplete() is false, then this will be invoked once all |
| 54 // the policy providers are ready. | 52 // the policy providers are ready. |
| 55 virtual void OnPolicyServiceInitialized() {} | 53 virtual void OnPolicyServiceInitialized() {} |
| 54 |
| 55 protected: |
| 56 virtual ~Observer() {} |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 virtual ~PolicyService() {} | 59 virtual ~PolicyService() {} |
| 59 | 60 |
| 60 virtual void AddObserver(PolicyDomain domain, | 61 virtual void AddObserver(PolicyDomain domain, |
| 61 const std::string& component_id, | 62 const std::string& component_id, |
| 62 Observer* observer) = 0; | 63 Observer* observer) = 0; |
| 63 | 64 |
| 64 virtual void RemoveObserver(PolicyDomain domain, | 65 virtual void RemoveObserver(PolicyDomain domain, |
| 65 const std::string& component_id, | 66 const std::string& component_id, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 PolicyDomain domain_; | 123 PolicyDomain domain_; |
| 123 std::string component_id_; | 124 std::string component_id_; |
| 124 CallbackMap callback_map_; | 125 CallbackMap callback_map_; |
| 125 | 126 |
| 126 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar); | 127 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar); |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 } // namespace policy | 130 } // namespace policy |
| 130 | 131 |
| 131 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ | 132 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ |
| OLD | NEW |