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

Unified Diff: components/policy/core/common/policy_map.h

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: 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_map.h
diff --git a/components/policy/core/common/policy_map.h b/components/policy/core/common/policy_map.h
index 7d0d06b80b4ba35e13154726b2dabd17d7e86a43..c7059afec08b19f76c95a45a2c331354c6ef21d3 100644
--- a/components/policy/core/common/policy_map.h
+++ b/components/policy/core/common/policy_map.h
@@ -28,6 +28,9 @@ class POLICY_EXPORT PolicyMap {
base::Value* value;
ExternalDataFetcher* external_data_fetcher;
+ // For debugging and displaying only. Set by provider delivering the policy.
+ PolicySource source;
+
Entry();
// Deletes all members owned by |this|.
@@ -58,14 +61,25 @@ class POLICY_EXPORT PolicyMap {
// This is equivalent to Get(policy)->value, when it doesn't return NULL.
const base::Value* GetValue(const std::string& policy) const;
- // Takes ownership of |value| and |external_data_fetcher|. Overwrites any
- // existing information stored in the map for the key |policy|.
+ // Sets the source of every Entry with unknown source to the passed |source|.
bartfab (slow) 2015/09/14 14:42:27 Nit: s/passed/given/ ("passed" is used with scoped
fhorschig 2015/09/16 13:52:05 Done.
+ void ApplySourceToEntries(PolicySource source);
+
+ // Calls |SetWithSource| with default source.
bartfab (slow) 2015/09/14 14:42:27 Nit 1: The most common style is to use |pipes| for
fhorschig 2015/09/16 13:52:05 1 & 2 Done. Nit 3: This change is certainly useful
void Set(const std::string& policy,
bartfab (slow) 2015/09/14 14:42:27 Would it not be possible to make the code that cal
fhorschig 2015/09/16 13:52:05 It is possible. Let me just update these 531 refer
bartfab (slow) 2015/09/16 15:58:40 Thanks. This looks much better now.
fhorschig 2015/09/17 11:20:41 Thank you :D
PolicyLevel level,
PolicyScope scope,
base::Value* value,
ExternalDataFetcher* external_data_fetcher);
+ // Takes ownership of |value| and |external_data_fetcher|. Overwrites any
+ // existing information stored in the map for the key |policy|.
+ void SetWithSource(const std::string& policy,
+ PolicyLevel level,
+ PolicyScope scope,
+ base::Value* value,
+ ExternalDataFetcher* external_data_fetcher,
+ PolicySource source);
+
// Erase the given |policy|, if it exists in this map.
void Erase(const std::string& policy);

Powered by Google App Engine
This is Rietveld 408576698