| 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" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "chrome/browser/policy/policy_domain_descriptor.h" |
| 13 #include "chrome/browser/policy/policy_map.h" | 14 #include "chrome/browser/policy/policy_map.h" |
| 14 | 15 |
| 15 namespace policy { | 16 namespace policy { |
| 16 | 17 |
| 17 PolicyServiceImpl::PolicyChangeInfo::PolicyChangeInfo( | 18 PolicyServiceImpl::PolicyChangeInfo::PolicyChangeInfo( |
| 18 const PolicyNamespace& policy_namespace, | 19 const PolicyNamespace& policy_namespace, |
| 19 const PolicyMap& previous, | 20 const PolicyMap& previous, |
| 20 const PolicyMap& current) | 21 const PolicyMap& current) |
| 21 : policy_namespace_(policy_namespace) { | 22 : policy_namespace_(policy_namespace) { |
| 22 previous_.CopyFrom(previous); | 23 previous_.CopyFrom(previous); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return; | 69 return; |
| 69 } | 70 } |
| 70 it->second->RemoveObserver(observer); | 71 it->second->RemoveObserver(observer); |
| 71 if (it->second->size() == 0) { | 72 if (it->second->size() == 0) { |
| 72 delete it->second; | 73 delete it->second; |
| 73 observers_.erase(it); | 74 observers_.erase(it); |
| 74 } | 75 } |
| 75 } | 76 } |
| 76 | 77 |
| 77 void PolicyServiceImpl::RegisterPolicyDomain( | 78 void PolicyServiceImpl::RegisterPolicyDomain( |
| 78 PolicyDomain domain, | 79 scoped_refptr<const PolicyDomainDescriptor> descriptor) { |
| 79 const std::set<std::string>& components) { | |
| 80 for (Iterator it = providers_.begin(); it != providers_.end(); ++it) | 80 for (Iterator it = providers_.begin(); it != providers_.end(); ++it) |
| 81 (*it)->RegisterPolicyDomain(domain, components); | 81 (*it)->RegisterPolicyDomain(descriptor); |
| 82 } | 82 } |
| 83 | 83 |
| 84 const PolicyMap& PolicyServiceImpl::GetPolicies( | 84 const PolicyMap& PolicyServiceImpl::GetPolicies( |
| 85 const PolicyNamespace& ns) const { | 85 const PolicyNamespace& ns) const { |
| 86 return policy_bundle_.Get(ns); | 86 return policy_bundle_.Get(ns); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool PolicyServiceImpl::IsInitializationComplete(PolicyDomain domain) const { | 89 bool PolicyServiceImpl::IsInitializationComplete(PolicyDomain domain) const { |
| 90 DCHECK(domain >= 0 && domain < POLICY_DOMAIN_SIZE); | 90 DCHECK(domain >= 0 && domain < POLICY_DOMAIN_SIZE); |
| 91 return initialization_complete_[domain]; | 91 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()) { | 233 if (refresh_pending_.empty() && !refresh_callbacks_.empty()) { |
| 234 std::vector<base::Closure> callbacks; | 234 std::vector<base::Closure> callbacks; |
| 235 callbacks.swap(refresh_callbacks_); | 235 callbacks.swap(refresh_callbacks_); |
| 236 std::vector<base::Closure>::iterator it; | 236 std::vector<base::Closure>::iterator it; |
| 237 for (it = callbacks.begin(); it != callbacks.end(); ++it) | 237 for (it = callbacks.begin(); it != callbacks.end(); ++it) |
| 238 it->Run(); | 238 it->Run(); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace policy | 242 } // namespace policy |
| OLD | NEW |