| 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 #include "chrome/browser/policy/policy_service_impl.h" | 5 #include "chrome/browser/policy/policy_service_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 it->second->RemoveObserver(observer); | 70 it->second->RemoveObserver(observer); |
| 71 if (it->second->size() == 0) { | 71 if (it->second->size() == 0) { |
| 72 delete it->second; | 72 delete it->second; |
| 73 observers_.erase(it); | 73 observers_.erase(it); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 void PolicyServiceImpl::RegisterPolicyDomain( | 77 void PolicyServiceImpl::RegisterPolicyDomain( |
| 78 PolicyDomain domain, | 78 scoped_refptr<const PolicyDomainDescriptor> descriptor) { |
| 79 const std::set<std::string>& components) { | |
| 80 for (Iterator it = providers_.begin(); it != providers_.end(); ++it) | 79 for (Iterator it = providers_.begin(); it != providers_.end(); ++it) |
| 81 (*it)->RegisterPolicyDomain(domain, components); | 80 (*it)->RegisterPolicyDomain(descriptor); |
| 82 } | 81 } |
| 83 | 82 |
| 84 const PolicyMap& PolicyServiceImpl::GetPolicies( | 83 const PolicyMap& PolicyServiceImpl::GetPolicies( |
| 85 const PolicyNamespace& ns) const { | 84 const PolicyNamespace& ns) const { |
| 86 return policy_bundle_.Get(ns); | 85 return policy_bundle_.Get(ns); |
| 87 } | 86 } |
| 88 | 87 |
| 89 bool PolicyServiceImpl::IsInitializationComplete(PolicyDomain domain) const { | 88 bool PolicyServiceImpl::IsInitializationComplete(PolicyDomain domain) const { |
| 90 DCHECK(domain >= 0 && domain < POLICY_DOMAIN_SIZE); | 89 DCHECK(domain >= 0 && domain < POLICY_DOMAIN_SIZE); |
| 91 return initialization_complete_[domain]; | 90 return initialization_complete_[domain]; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 if (refresh_pending_.empty() && !refresh_callbacks_.empty()) { | 232 if (refresh_pending_.empty() && !refresh_callbacks_.empty()) { |
| 234 std::vector<base::Closure> callbacks; | 233 std::vector<base::Closure> callbacks; |
| 235 callbacks.swap(refresh_callbacks_); | 234 callbacks.swap(refresh_callbacks_); |
| 236 std::vector<base::Closure>::iterator it; | 235 std::vector<base::Closure>::iterator it; |
| 237 for (it = callbacks.begin(); it != callbacks.end(); ++it) | 236 for (it = callbacks.begin(); it != callbacks.end(); ++it) |
| 238 it->Run(); | 237 it->Run(); |
| 239 } | 238 } |
| 240 } | 239 } |
| 241 | 240 |
| 242 } // namespace policy | 241 } // namespace policy |
| OLD | NEW |