Chromium Code Reviews| Index: chrome/browser/policy/configuration_policy_provider.cc |
| diff --git a/chrome/browser/policy/configuration_policy_provider.cc b/chrome/browser/policy/configuration_policy_provider.cc |
| index bef2da7b9630c61b6ed8a70f807b71e4d330fe62..b95ae8149657d4713e7f8c7794112a966881f3d1 100644 |
| --- a/chrome/browser/policy/configuration_policy_provider.cc |
| +++ b/chrome/browser/policy/configuration_policy_provider.cc |
| @@ -4,6 +4,8 @@ |
| #include "chrome/browser/policy/configuration_policy_provider.h" |
| +#include <algorithm> |
| + |
| #include "chrome/browser/policy/policy_map.h" |
| #include "policy/policy_constants.h" |
| @@ -11,12 +13,12 @@ namespace policy { |
| namespace { |
| -ConfigurationPolicyType kProxyPolicies[] = { |
| - kPolicyProxyMode, |
| - kPolicyProxyServerMode, |
| - kPolicyProxyServer, |
| - kPolicyProxyPacUrl, |
| - kPolicyProxyBypassList, |
| +const char* kProxyPolicies[] = { |
| + key::kProxyMode, |
| + key::kProxyServerMode, |
| + key::kProxyServer, |
| + key::kProxyPacUrl, |
| + key::kProxyBypassList, |
| }; |
| } // namespace |
| @@ -82,16 +84,22 @@ void ConfigurationPolicyProvider::FixDeprecatedPolicies(PolicyMap* policies) { |
| // single Dictionary policy when all providers have support for that. For |
| // now, the individual policies are mapped here to a single Dictionary policy |
| // that the rest of the policy machinery uses. |
| + PolicyLevel level = POLICY_LEVEL_RECOMMENDED; |
| + PolicyScope scope = POLICY_SCOPE_USER; |
| scoped_ptr<DictionaryValue> proxy_settings(new DictionaryValue); |
| for (size_t i = 0; i < arraysize(kProxyPolicies); ++i) { |
| - const Value* value = policies->Get(kProxyPolicies[i]); |
| - if (value) { |
| - proxy_settings->Set(GetPolicyName(kProxyPolicies[i]), value->DeepCopy()); |
| + const PolicyMap::Entry* entry = policies->Get(kProxyPolicies[i]); |
| + if (entry) { |
| + // The level and scope of the merged policy is the highest of any of the |
| + // individual deprecated policies. |
|
Mattias Nissler (ping if slow)
2012/01/18 15:07:07
I think this is actually incorrect. Assume you hav
Joao da Silva
2012/01/18 16:49:29
Thanks for catching this, that is exactly what sho
|
| + level = std::max(level, entry->level); |
| + scope = std::max(scope, entry->scope); |
| + proxy_settings->Set(kProxyPolicies[i], entry->value->DeepCopy()); |
| policies->Erase(kProxyPolicies[i]); |
| } |
| } |
| - if (!proxy_settings->empty() && !policies->Get(kPolicyProxySettings)) |
| - policies->Set(kPolicyProxySettings, proxy_settings.release()); |
| + if (!proxy_settings->empty() && !policies->Get(key::kProxySettings)) |
| + policies->Set(key::kProxySettings, level, scope, proxy_settings.release()); |
| } |
| void ConfigurationPolicyProvider::AddObserver(Observer* observer) { |