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

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: Fixed another test. 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..2820767c14358008e3c5615eb4f684ad16b8ab6f 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_ENTERPRISE_DEFAULT;
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,8 @@ void FixDeprecatedPolicies(PolicyMap* policies) {
if (entry->has_higher_priority_than(current_priority)) {
proxy_settings->Clear();
current_priority = *entry;
+ if (entry->source > inherited_source) // Higher priority?
+ inherited_source = entry->source;
}
if (!entry->has_higher_priority_than(current_priority) &&
!current_priority.has_higher_priority_than(*entry)) {
@@ -64,6 +68,7 @@ void FixDeprecatedPolicies(PolicyMap* policies) {
policies->Set(key::kProxySettings,
current_priority.level,
current_priority.scope,
+ inherited_source,
proxy_settings.release(),
NULL);
}
« no previous file with comments | « components/policy/core/common/policy_map_unittest.cc ('k') | components/policy/core/common/policy_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698