Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4943)

Unified Diff: chrome/browser/policy/configuration_policy_provider.cc

Issue 9111022: Removed ConfigurationPolicyType and extended PolicyMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
+ 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) {

Powered by Google App Engine
This is Rietveld 408576698