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

Unified Diff: components/policy/core/common/policy_service_impl.cc

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test and platform fixes. Created 5 years, 3 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: components/policy/core/common/policy_service_impl.cc
diff --git a/components/policy/core/common/policy_service_impl.cc b/components/policy/core/common/policy_service_impl.cc
index 96922ace797cebb1970bbf359acaa8f729bb74c1..2cde1a5957bce5a6e745b47d4f1b2cc2c1df6e1d 100644
--- a/components/policy/core/common/policy_service_impl.cc
+++ b/components/policy/core/common/policy_service_impl.cc
@@ -14,6 +14,7 @@
#include "base/values.h"
#include "components/policy/core/common/policy_bundle.h"
#include "components/policy/core/common/policy_map.h"
+#include "components/policy/core/common/policy_types.h"
#include "policy/policy_constants.h"
namespace policy {
@@ -41,6 +42,7 @@ void FixDeprecatedPolicies(PolicyMap* policies) {
// 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.
+ PolicySource inherited_source = POLICY_SOURCE_PLATFORM;
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]);
@@ -48,6 +50,7 @@ void FixDeprecatedPolicies(PolicyMap* policies) {
if (entry->has_higher_priority_than(current_priority)) {
proxy_settings->Clear();
current_priority = *entry;
+ inherited_source = entry->source; // Source of last existing entry.
bartfab (slow) 2015/09/17 15:45:51 Nit: Policy sources actually have a precedence ord
fhorschig 2015/09/18 08:30:22 Agreed. Platform policies can override (all known)
}
if (!entry->has_higher_priority_than(current_priority) &&
!current_priority.has_higher_priority_than(*entry)) {
@@ -64,6 +67,7 @@ void FixDeprecatedPolicies(PolicyMap* policies) {
policies->Set(key::kProxySettings,
current_priority.level,
current_priority.scope,
+ inherited_source,
proxy_settings.release(),
NULL);
}

Powered by Google App Engine
This is Rietveld 408576698