| Index: chrome/browser/policy/policy_service_impl.cc
|
| diff --git a/chrome/browser/policy/policy_service_impl.cc b/chrome/browser/policy/policy_service_impl.cc
|
| index 5083a0cf490d2961c10927126d347943d1d902aa..a9111665457d6d43b39e561f87ff43af4b71de63 100644
|
| --- a/chrome/browser/policy/policy_service_impl.cc
|
| +++ b/chrome/browser/policy/policy_service_impl.cc
|
| @@ -125,18 +125,21 @@ void PolicyServiceImpl::MaybeCleanup(const PolicyNamespace& ns) {
|
| void PolicyServiceImpl::MergeAndTriggerUpdates() {
|
| // TODO(joaodasilva): do this for each namespace once the providers also
|
| // provide policy for more namespaces.
|
| - PolicyMap new_policies;
|
| + PolicyMap policies;
|
| for (ProviderList::iterator it = providers_.begin();
|
| it != providers_.end(); ++it) {
|
| - new_policies.MergeFrom((*it)->policies);
|
| + policies.MergeFrom((*it)->policies);
|
| }
|
|
|
| Entry* entry = GetOrCreate(std::make_pair(POLICY_DOMAIN_CHROME, ""));
|
| - if (!new_policies.Equals(entry->policies)) {
|
| - entry->policies.Swap(&new_policies);
|
| - FOR_EACH_OBSERVER(PolicyService::Observer,
|
| - entry->observers,
|
| - OnPolicyUpdated(POLICY_DOMAIN_CHROME, ""));
|
| + if (!policies.Equals(entry->policies)) {
|
| + // Swap first, so that observers that call GetPolicies() see the current
|
| + // values.
|
| + entry->policies.Swap(&policies);
|
| + FOR_EACH_OBSERVER(
|
| + PolicyService::Observer,
|
| + entry->observers,
|
| + OnPolicyUpdated(POLICY_DOMAIN_CHROME, "", policies, entry->policies));
|
| }
|
|
|
| // Check if all providers became initialized just now, if they weren't before.
|
|
|