| 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 "components/policy/core/common/policy_service_impl.h" | 5 #include "components/policy/core/common/policy_service_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 // There are no observers yet, but calls to GetPolicies() should already get | 94 // There are no observers yet, but calls to GetPolicies() should already get |
| 95 // the processed policy values. | 95 // the processed policy values. |
| 96 MergeAndTriggerUpdates(); | 96 MergeAndTriggerUpdates(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 PolicyServiceImpl::~PolicyServiceImpl() { | 99 PolicyServiceImpl::~PolicyServiceImpl() { |
| 100 DCHECK(thread_checker_.CalledOnValidThread()); | 100 DCHECK(thread_checker_.CalledOnValidThread()); |
| 101 for (Iterator it = providers_.begin(); it != providers_.end(); ++it) | 101 for (Iterator it = providers_.begin(); it != providers_.end(); ++it) |
| 102 (*it)->RemoveObserver(this); | 102 (*it)->RemoveObserver(this); |
| 103 STLDeleteValues(&observers_); | 103 base::STLDeleteValues(&observers_); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void PolicyServiceImpl::AddObserver(PolicyDomain domain, | 106 void PolicyServiceImpl::AddObserver(PolicyDomain domain, |
| 107 PolicyService::Observer* observer) { | 107 PolicyService::Observer* observer) { |
| 108 DCHECK(thread_checker_.CalledOnValidThread()); | 108 DCHECK(thread_checker_.CalledOnValidThread()); |
| 109 Observers*& list = observers_[domain]; | 109 Observers*& list = observers_[domain]; |
| 110 if (!list) | 110 if (!list) |
| 111 list = new Observers(); | 111 list = new Observers(); |
| 112 list->AddObserver(observer); | 112 list->AddObserver(observer); |
| 113 } | 113 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 if (refresh_pending_.empty() && !refresh_callbacks_.empty()) { | 280 if (refresh_pending_.empty() && !refresh_callbacks_.empty()) { |
| 281 std::vector<base::Closure> callbacks; | 281 std::vector<base::Closure> callbacks; |
| 282 callbacks.swap(refresh_callbacks_); | 282 callbacks.swap(refresh_callbacks_); |
| 283 std::vector<base::Closure>::iterator it; | 283 std::vector<base::Closure>::iterator it; |
| 284 for (it = callbacks.begin(); it != callbacks.end(); ++it) | 284 for (it = callbacks.begin(); it != callbacks.end(); ++it) |
| 285 it->Run(); | 285 it->Run(); |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace policy | 289 } // namespace policy |
| OLD | NEW |