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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Asks the PolicyService to reload policy from all available policy sources. | 71 // Asks the PolicyService to reload policy from all available policy sources. |
72 // |callback| is invoked once every source has reloaded its policies, and | 72 // |callback| is invoked once every source has reloaded its policies, and |
73 // GetPolicies() is guaranteed to return the updated values at that point. | 73 // GetPolicies() is guaranteed to return the updated values at that point. |
74 virtual void RefreshPolicies(const base::Closure& callback) = 0; | 74 virtual void RefreshPolicies(const base::Closure& callback) = 0; |
75 }; | 75 }; |
76 | 76 |
77 // A registrar that only observes changes to particular policies within the | 77 // A registrar that only observes changes to particular policies within the |
78 // PolicyMap for the given policy namespace. | 78 // PolicyMap for the given policy namespace. |
79 class POLICY_EXPORT PolicyChangeRegistrar : public PolicyService::Observer { | 79 class POLICY_EXPORT PolicyChangeRegistrar : public PolicyService::Observer { |
80 public: | 80 public: |
81 typedef base::Callback<void(const Value*, const Value*)> UpdateCallback; | 81 typedef base::Callback<void(const base::Value*, |
| 82 const base::Value*)> UpdateCallback; |
82 | 83 |
83 // Observes updates to the given (domain, component_id) namespace in the given | 84 // Observes updates to the given (domain, component_id) namespace in the given |
84 // |policy_service|, and notifies |observer| whenever any of the registered | 85 // |policy_service|, and notifies |observer| whenever any of the registered |
85 // policy keys changes. Both the |policy_service| and the |observer| must | 86 // policy keys changes. Both the |policy_service| and the |observer| must |
86 // outlive |this|. | 87 // outlive |this|. |
87 PolicyChangeRegistrar(PolicyService* policy_service, | 88 PolicyChangeRegistrar(PolicyService* policy_service, |
88 const PolicyNamespace& ns); | 89 const PolicyNamespace& ns); |
89 | 90 |
90 virtual ~PolicyChangeRegistrar(); | 91 virtual ~PolicyChangeRegistrar(); |
91 | 92 |
(...skipping 14 matching lines...) Expand all Loading... |
106 PolicyService* policy_service_; | 107 PolicyService* policy_service_; |
107 PolicyNamespace ns_; | 108 PolicyNamespace ns_; |
108 CallbackMap callback_map_; | 109 CallbackMap callback_map_; |
109 | 110 |
110 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar); | 111 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar); |
111 }; | 112 }; |
112 | 113 |
113 } // namespace policy | 114 } // namespace policy |
114 | 115 |
115 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_SERVICE_H_ | 116 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_SERVICE_H_ |
OLD | NEW |