Chromium Code Reviews| Index: components/prefs/pref_value_store.h |
| diff --git a/components/prefs/pref_value_store.h b/components/prefs/pref_value_store.h |
| index 39b6bf1870ee3fc06e1eb9f53a243284c6109334..f6c9c3725a3a2dc4a16b1893be4d9e29199ced80 100644 |
| --- a/components/prefs/pref_value_store.h |
| +++ b/components/prefs/pref_value_store.h |
| @@ -30,6 +30,30 @@ class COMPONENTS_PREFS_EXPORT PrefValueStore { |
| public: |
| typedef base::Callback<void(const std::string&)> PrefChangedCallback; |
| + // PrefStores must be listed here in order from highest to lowest priority. |
| + // MANAGED contains all managed preference values that are provided by |
| + // mandatory policies (e.g. Windows Group Policy or cloud policy). |
| + // SUPERVISED_USER contains preferences that are valid for supervised users. |
| + // EXTENSION contains preference values set by extensions. |
| + // COMMAND_LINE contains preference values set by command-line switches. |
| + // USER contains all user-set preference values. |
| + // RECOMMENDED contains all preferences that are provided by recommended |
| + // policies. |
| + // DEFAULT contains all application default preference values. |
| + enum PrefStoreType { |
|
Bernhard Bauer
2017/03/09 09:25:22
Historically we haven't exposed the exact pref sto
tibell
2017/03/09 23:07:12
Yeah. I also felt it was a bit unfortunate but I c
|
| + // INVALID_STORE is not associated with an actual PrefStore but used as |
| + // an invalid marker, e.g. as a return value. |
| + INVALID_STORE = -1, |
| + MANAGED_STORE = 0, |
| + SUPERVISED_USER_STORE, |
| + EXTENSION_STORE, |
| + COMMAND_LINE_STORE, |
| + USER_STORE, |
| + RECOMMENDED_STORE, |
| + DEFAULT_STORE, |
| + PREF_STORE_TYPE_MAX = DEFAULT_STORE |
| + }; |
| + |
| // In decreasing order of precedence: |
| // |managed_prefs| contains all preferences from mandatory policies. |
| // |supervised_user_prefs| contains all preferences from supervised user |
| @@ -118,30 +142,6 @@ class COMPONENTS_PREFS_EXPORT PrefValueStore { |
| void UpdateCommandLinePrefStore(PrefStore* command_line_prefs); |
| private: |
| - // PrefStores must be listed here in order from highest to lowest priority. |
| - // MANAGED contains all managed preference values that are provided by |
| - // mandatory policies (e.g. Windows Group Policy or cloud policy). |
| - // SUPERVISED_USER contains preferences that are valid for supervised users. |
| - // EXTENSION contains preference values set by extensions. |
| - // COMMAND_LINE contains preference values set by command-line switches. |
| - // USER contains all user-set preference values. |
| - // RECOMMENDED contains all preferences that are provided by recommended |
| - // policies. |
| - // DEFAULT contains all application default preference values. |
| - enum PrefStoreType { |
| - // INVALID_STORE is not associated with an actual PrefStore but used as |
| - // an invalid marker, e.g. as a return value. |
| - INVALID_STORE = -1, |
| - MANAGED_STORE = 0, |
| - SUPERVISED_USER_STORE, |
| - EXTENSION_STORE, |
| - COMMAND_LINE_STORE, |
| - USER_STORE, |
| - RECOMMENDED_STORE, |
| - DEFAULT_STORE, |
| - PREF_STORE_TYPE_MAX = DEFAULT_STORE |
| - }; |
| - |
| // Keeps a PrefStore reference on behalf of the PrefValueStore and monitors |
| // the PrefStore for changes, forwarding notifications to PrefValueStore. This |
| // indirection is here for the sake of disambiguating notifications from the |
| @@ -257,4 +257,16 @@ class COMPONENTS_PREFS_EXPORT PrefValueStore { |
| DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
| }; |
| +namespace std { |
| + |
| +template <> |
| +struct hash<PrefValueStore::PrefStoreType> { |
|
Bernhard Bauer
2017/03/09 09:25:22
It might almost be worth making a macro out of thi
tibell
2017/03/09 23:07:12
Agreed. I'll see what other Chromies think.
|
| + size_t operator()(PrefValueStore::PrefStoreType type) const { |
| + return std::hash< |
| + base::underlying_type<PrefValueStore::PrefStoreType>::type>()(type); |
| + } |
| +}; |
| + |
| +} // namespace std |
| + |
| #endif // COMPONENTS_PREFS_PREF_VALUE_STORE_H_ |