| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // asynchronous loads. IsInitializationComplete() returns true once all | 69 // asynchronous loads. IsInitializationComplete() returns true once all |
| 70 // sources have loaded their policies. It is safe to read policy from the | 70 // sources have loaded their policies. It is safe to read policy from the |
| 71 // PolicyService even if IsInitializationComplete() is false; there will be an | 71 // PolicyService even if IsInitializationComplete() is false; there will be an |
| 72 // OnPolicyUpdated() notification once new policies become available. | 72 // OnPolicyUpdated() notification once new policies become available. |
| 73 // | 73 // |
| 74 // OnPolicyServiceInitialized() is called when IsInitializationComplete() | 74 // OnPolicyServiceInitialized() is called when IsInitializationComplete() |
| 75 // becomes true, which happens at most once. If IsInitializationComplete() is | 75 // becomes true, which happens at most once. If IsInitializationComplete() is |
| 76 // already true when an Observer is registered, then that Observer will not | 76 // already true when an Observer is registered, then that Observer will not |
| 77 // have a OnPolicyServiceInitialized() notification. | 77 // have a OnPolicyServiceInitialized() notification. |
| 78 virtual bool IsInitializationComplete() const = 0; | 78 virtual bool IsInitializationComplete() const = 0; |
| 79 |
| 80 // Asks the PolicyService to reload policy from all available policy sources. |
| 81 // |callback| is invoked once every source has reloaded its policies, and |
| 82 // GetPolicies() is guaranteed to return the updated values at that point. |
| 83 virtual void RefreshPolicies(const base::Closure& callback) = 0; |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 // A registrar that only observes changes to particular policies within the | 86 // A registrar that only observes changes to particular policies within the |
| 82 // PolicyMap for the given policy namespace. | 87 // PolicyMap for the given policy namespace. |
| 83 class PolicyChangeRegistrar : public PolicyService::Observer { | 88 class PolicyChangeRegistrar : public PolicyService::Observer { |
| 84 public: | 89 public: |
| 85 typedef base::Callback<void(const Value*, const Value*)> UpdateCallback; | 90 typedef base::Callback<void(const Value*, const Value*)> UpdateCallback; |
| 86 | 91 |
| 87 // Observes updates to the given (domain, component_id) namespace in the given | 92 // Observes updates to the given (domain, component_id) namespace in the given |
| 88 // |policy_service|, and notifies |observer| whenever any of the registered | 93 // |policy_service|, and notifies |observer| whenever any of the registered |
| (...skipping 24 matching lines...) Expand all Loading... |
| 113 PolicyDomain domain_; | 118 PolicyDomain domain_; |
| 114 std::string component_id_; | 119 std::string component_id_; |
| 115 CallbackMap callback_map_; | 120 CallbackMap callback_map_; |
| 116 | 121 |
| 117 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar); | 122 DISALLOW_COPY_AND_ASSIGN(PolicyChangeRegistrar); |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 } // namespace policy | 125 } // namespace policy |
| 121 | 126 |
| 122 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ | 127 #endif // CHROME_BROWSER_POLICY_POLICY_SERVICE_H_ |
| OLD | NEW |