Chromium Code Reviews| Index: chrome/browser/extensions/api/settings_private/prefs_util.h |
| diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.h b/chrome/browser/extensions/api/settings_private/prefs_util.h |
| index fb4bef57545b2fce05590ab1420f818ed43cecc6..60e5813a5676646b20ecf48ec412837e5db03a9e 100644 |
| --- a/chrome/browser/extensions/api/settings_private/prefs_util.h |
| +++ b/chrome/browser/extensions/api/settings_private/prefs_util.h |
| @@ -17,31 +17,46 @@ class Profile; |
| namespace extensions { |
| -namespace prefs_util { |
| - |
| using TypedPrefMap = std::map<std::string, api::settings_private::PrefType>; |
|
stevenjb
2015/06/05 02:23:50
put this inside the class
Oren Blasberg
2015/06/05 20:12:21
Done.
|
| -// Gets the list of whitelisted pref keys -- that is, those which correspond to |
| -// prefs that clients of the settingsPrivate API may retrieve and manipulate. |
| -const TypedPrefMap& GetWhitelistedKeys(); |
| +class PrefsUtil { |
| + public: |
| + explicit PrefsUtil(Profile* profile); |
| + virtual ~PrefsUtil() {} |
|
stevenjb
2015/06/05 02:23:50
We should avoid inlining virtual methods, even tri
Oren Blasberg
2015/06/05 20:12:21
Done.
|
| + |
| + // Gets the list of whitelisted pref keys -- that is, those which correspond |
| + // to prefs that clients of the settingsPrivate API may retrieve and |
| + // manipulate. |
| + const TypedPrefMap& GetWhitelistedKeys(); |
| + |
| + // Gets the value of the pref with the given |name|. Returns a pointer to an |
| + // empty PrefObject if no pref is found for |name|. |
| + virtual scoped_ptr<api::settings_private::PrefObject> GetPref( |
| + const std::string& name); |
| + |
| + // Sets the pref with the given name and value in the proper PrefService. |
| + virtual bool SetPref(const std::string& name, const base::Value* value); |
| -// Gets the value of the pref with the given |name|. Returns a pointer to an |
| -// empty PrefObject if no pref is found for |name|. |
| -scoped_ptr<api::settings_private::PrefObject> GetPref(Profile* profile, |
| - const std::string& name); |
| + // Returns a pointer to the appropriate PrefService instance for the given |
| + // |pref_name|. |
| + virtual PrefService* FindServiceForPref(const std::string& pref_name); |
| -// Returns whether |pref_name| corresponds to a pref whose type is URL. |
| -bool IsPrefTypeURL(const std::string& pref_name); |
| + protected: |
| + // Returns whether |pref_name| corresponds to a pref whose type is URL. |
| + bool IsPrefTypeURL(const std::string& pref_name); |
| -// Returns whether |pref_name| corresponds to a pref that is user modifiable |
| -// (i.e., not made restricted by a user or device policy). |
| -bool IsPrefUserModifiable(Profile* profile, const std::string& pref_name); |
| + // Returns whether |pref_name| corresponds to a pref that is user modifiable |
| + // (i.e., not made restricted by a user or device policy). |
| + bool IsPrefUserModifiable(const std::string& pref_name); |
| -// Returns a pointer to the appropriate PrefService instance for the given |
| -// |pref_name|. |
| -PrefService* FindServiceForPref(Profile* profile, const std::string& pref_name); |
| + api::settings_private::PrefType GetType( |
| + const std::string& name, base::Value::Type type); |
|
stevenjb
2015/06/05 02:23:50
WS between all methods
Oren Blasberg
2015/06/05 20:12:21
Done.
|
| + scoped_ptr<api::settings_private::PrefObject> GetCrosSettingsPref( |
| + const std::string& name); |
| + bool SetCrosSettingsPref(const std::string& name, const base::Value* value); |
| -} // namespace prefs_util |
| + Profile* profile_; // weak |
| +}; |
| } // namespace extensions |