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

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

Issue 113813003: Cleanup the policy code after the recent moves into the component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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/policy_transformations.cc
diff --git a/chrome/browser/policy/policy_transformations.cc b/chrome/browser/policy/policy_transformations.cc
deleted file mode 100644
index a678dc685956b82956853a68c0aec43ba14b88c1..0000000000000000000000000000000000000000
--- a/chrome/browser/policy/policy_transformations.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/policy/policy_transformations.h"
-
-#include "base/memory/scoped_ptr.h"
-#include "base/values.h"
-#include "components/policy/core/common/policy_bundle.h"
-#include "components/policy/core/common/policy_map.h"
-#include "policy/policy_constants.h"
-
-namespace policy {
-
-namespace {
-
-const char* kProxyPolicies[] = {
- key::kProxyMode,
- key::kProxyServerMode,
- key::kProxyServer,
- key::kProxyPacUrl,
- key::kProxyBypassList,
-};
-
-void FixDeprecatedPolicies(PolicyMap* policies) {
- // Proxy settings have been configured by 5 policies that didn't mix well
- // together, and maps of policies had to take this into account when merging
- // policy sources. The proxy settings will eventually be configured by a
- // 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.
-
- // The highest (level, scope) pair for an existing proxy policy is determined
- // first, and then only policies with those exact attributes are merged.
- PolicyMap::Entry current_priority; // Defaults to the lowest priority.
- scoped_ptr<base::DictionaryValue> proxy_settings(new base::DictionaryValue);
- for (size_t i = 0; i < arraysize(kProxyPolicies); ++i) {
- const PolicyMap::Entry* entry = policies->Get(kProxyPolicies[i]);
- if (entry) {
- if (entry->has_higher_priority_than(current_priority)) {
- proxy_settings->Clear();
- current_priority = *entry;
- }
- if (!entry->has_higher_priority_than(current_priority) &&
- !current_priority.has_higher_priority_than(*entry)) {
- proxy_settings->Set(kProxyPolicies[i], entry->value->DeepCopy());
- }
- policies->Erase(kProxyPolicies[i]);
- }
- }
- // Sets the new |proxy_settings| if kProxySettings isn't set yet, or if the
- // new priority is higher.
- const PolicyMap::Entry* existing = policies->Get(key::kProxySettings);
- if (!proxy_settings->empty() &&
- (!existing || current_priority.has_higher_priority_than(*existing))) {
- policies->Set(key::kProxySettings,
- current_priority.level,
- current_priority.scope,
- proxy_settings.release(),
- NULL);
- }
-}
-
-} // namespace
-
-void FixDeprecatedPolicies(PolicyBundle* bundle) {
- FixDeprecatedPolicies(
- &bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())));
-}
-
-} // namespace policy
« no previous file with comments | « chrome/browser/policy/policy_transformations.h ('k') | chrome/browser/policy/policy_transformations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698