Chromium Code Reviews| 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/configuration_policy_provider.h" | 5 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "chrome/browser/policy/policy_map.h" | 9 #include "chrome/browser/policy/policy_map.h" |
| 10 #include "policy/policy_constants.h" | 10 #include "policy/policy_constants.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 proxy_settings->Clear(); | 90 proxy_settings->Clear(); |
| 91 current_priority = *entry; | 91 current_priority = *entry; |
| 92 } | 92 } |
| 93 if (!entry->has_higher_priority_than(current_priority) && | 93 if (!entry->has_higher_priority_than(current_priority) && |
| 94 !current_priority.has_higher_priority_than(*entry)) { | 94 !current_priority.has_higher_priority_than(*entry)) { |
| 95 proxy_settings->Set(kProxyPolicies[i], entry->value->DeepCopy()); | 95 proxy_settings->Set(kProxyPolicies[i], entry->value->DeepCopy()); |
| 96 } | 96 } |
| 97 policies->Erase(kProxyPolicies[i]); | 97 policies->Erase(kProxyPolicies[i]); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 if (!proxy_settings->empty() && !policies->Get(key::kProxySettings)) { | 100 // Sets the new |proxy_settings| if kProxySettings isn't set yet, or if the |
| 101 // new priority is higher. | |
| 102 const PolicyMap::Entry* existing = policies->Get(key::kProxySettings); | |
| 103 if (!proxy_settings->empty() && | |
| 104 (!existing || current_priority.has_higher_priority_than(*existing))) { | |
|
Mattias Nissler (ping if slow)
2012/03/30 08:48:46
good catch.
| |
| 101 policies->Set(key::kProxySettings, | 105 policies->Set(key::kProxySettings, |
| 102 current_priority.level, | 106 current_priority.level, |
| 103 current_priority.scope, | 107 current_priority.scope, |
| 104 proxy_settings.release()); | 108 proxy_settings.release()); |
| 105 } | 109 } |
| 106 } | 110 } |
| 107 | 111 |
| 108 void ConfigurationPolicyProvider::NotifyPolicyUpdated() { | 112 void ConfigurationPolicyProvider::NotifyPolicyUpdated() { |
| 109 FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer, | 113 FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer, |
| 110 observer_list_, | 114 observer_list_, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 | 148 |
| 145 void ConfigurationPolicyObserverRegistrar::OnProviderGoingAway( | 149 void ConfigurationPolicyObserverRegistrar::OnProviderGoingAway( |
| 146 ConfigurationPolicyProvider* provider) { | 150 ConfigurationPolicyProvider* provider) { |
| 147 DCHECK_EQ(provider_, provider); | 151 DCHECK_EQ(provider_, provider); |
| 148 observer_->OnProviderGoingAway(provider_); | 152 observer_->OnProviderGoingAway(provider_); |
| 149 provider_->RemoveObserver(this); | 153 provider_->RemoveObserver(this); |
| 150 provider_ = NULL; | 154 provider_ = NULL; |
| 151 } | 155 } |
| 152 | 156 |
| 153 } // namespace policy | 157 } // namespace policy |
| OLD | NEW |