| 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 COMPONENTS_POLICY_CORE_COMMON_POLICY_SERVICE_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_SERVICE_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_SERVICE_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // Will invoke |callback| whenever |policy_name| changes its value, as long | 93 // Will invoke |callback| whenever |policy_name| changes its value, as long |
| 94 // as this registrar exists. | 94 // as this registrar exists. |
| 95 // Only one callback can be registed per policy name; a second call with the | 95 // Only one callback can be registed per policy name; a second call with the |
| 96 // same |policy_name| will overwrite the previous callback. | 96 // same |policy_name| will overwrite the previous callback. |
| 97 void Observe(const std::string& policy_name, const UpdateCallback& callback); | 97 void Observe(const std::string& policy_name, const UpdateCallback& callback); |
| 98 | 98 |
| 99 // Implementation of PolicyService::Observer: | 99 // Implementation of PolicyService::Observer: |
| 100 virtual void OnPolicyUpdated(const PolicyNamespace& ns, | 100 virtual void OnPolicyUpdated(const PolicyNamespace& ns, |
| 101 const PolicyMap& previous, | 101 const PolicyMap& previous, |
| 102 const PolicyMap& current) OVERRIDE; | 102 const PolicyMap& current) override; |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 typedef std::map<std::string, UpdateCallback> CallbackMap; | 105 typedef std::map<std::string, UpdateCallback> CallbackMap; |
| 106 | 106 |
| 107 PolicyService* policy_service_; | 107 PolicyService* policy_service_; |
| 108 PolicyNamespace ns_; | 108 PolicyNamespace ns_; |
| 109 CallbackMap callback_map_; | 109 CallbackMap callback_map_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar); | 111 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace policy | 114 } // namespace policy |
| 115 | 115 |
| 116 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_SERVICE_H_ | 116 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_SERVICE_H_ |
| OLD | NEW |