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..f2732db78eabb32e3014f944ca1a461b713e69bb 100644 |
--- a/components/policy/core/common/policy_map.h |
+++ b/components/policy/core/common/policy_map.h |
@@ -25,6 +25,7 @@ class POLICY_EXPORT PolicyMap { |
struct POLICY_EXPORT Entry { |
PolicyLevel level; |
PolicyScope scope; |
+ PolicySource source; |
Thiemo Nagel
2015/09/01 17:40:37
Please annotate that this is for debugging/display
fhorschig
2015/09/04 06:53:54
Done.
|
base::Value* value; |
ExternalDataFetcher* external_data_fetcher; |
@@ -58,13 +59,24 @@ 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; |
+ // Sets the source of every Entry in the Map to the passed |source|. |
+ void SetSources(PolicySource source); |
Thiemo Nagel
2015/09/01 17:40:37
SetSource would seem easier understandable to me.
fhorschig
2015/09/04 06:53:54
Obviously misleading name. It sets the sources of
|
+ |
+ // Calls |Set| with default source. |
+ void Set(const std::string& policy, |
+ 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 Set(const std::string& policy, |
Thiemo Nagel
2015/09/01 17:40:37
Function overloading is frowned upon, cf. http://g
fhorschig
2015/09/04 06:53:54
SetSources manipulates ALL entries. We don't want
|
PolicyLevel level, |
PolicyScope scope, |
base::Value* value, |
- ExternalDataFetcher* external_data_fetcher); |
+ ExternalDataFetcher* external_data_fetcher, |
+ PolicySource source); |
// Erase the given |policy|, if it exists in this map. |
void Erase(const std::string& policy); |
@@ -84,12 +96,17 @@ class POLICY_EXPORT PolicyMap { |
// maps with the same priority, the current value in |this| is preserved. |
void MergeFrom(const PolicyMap& other); |
- // Loads the values in |policies| into this PolicyMap. All policies loaded |
- // will have |level| and |scope| in their entries. Existing entries are |
- // replaced. |
+ // Calls |LoadFrom| with default source. |
void LoadFrom(const base::DictionaryValue* policies, |
PolicyLevel level, |
PolicyScope scope); |
+ // Loads the values in |policies| into this PolicyMap. All policies loaded |
Thiemo Nagel
2015/09/01 17:40:37
Again, please don't overload.
fhorschig
2015/09/04 06:53:54
Done.
|
+ // will have |level| and |scope| in their entries and originate from |source|. |
+ // Existing entries are replaced. |
+ void LoadFrom(const base::DictionaryValue* policies, |
+ PolicyLevel level, |
+ PolicyScope scope, |
+ PolicySource source); |
// Compares this value map against |other| and stores all key names that have |
// different values or reference different external data in |differing_keys|. |