Chromium Code Reviews| Index: chrome/browser/pref_value_store.h |
| =================================================================== |
| --- chrome/browser/pref_value_store.h (revision 55061) |
| +++ chrome/browser/pref_value_store.h (working copy) |
| @@ -21,6 +21,7 @@ |
| #include "chrome/common/pref_store.h" |
| class PrefStore; |
| +class Profile; |
| // The class PrefValueStore provides values for preferences. Each Preference |
| // has a unique name. This name is used to retrieve the value of a Preference. |
| @@ -38,21 +39,20 @@ |
| // be called on the UI thread. |
| class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { |
| public: |
| - // In decreasing order of precedence: |
| - // |managed_prefs| contains all managed (policy) preference values. |
| - // |extension_prefs| contains preference values set by extensions. |
| - // |command_line_prefs| contains preference values set by command-line |
| - // switches. |
| - // |user_prefs| contains all user-set preference values. |
| - // |recommended_prefs| contains all recommended (policy) preference values. |
| - PrefValueStore(PrefStore* managed_prefs, |
| - PrefStore* extension_prefs, |
| - PrefStore* command_line_prefs, |
| - PrefStore* user_prefs, |
| - PrefStore* recommended_prefs); |
| - |
| ~PrefValueStore(); |
| + // Returns a new PrefValueStore with all applicable PrefStores. The |
| + // |pref_filename| points to the user preference file. The |profile| is the |
| + // one to which these preferences apply; it may be NULL if we're dealing |
| + // with the local state. If |pref_filename| is empty, the user PrefStore will |
| + // not be created. If |user_only| is true, no PrefStores will be created |
| + // other than the user PrefStore (if |pref_filename| is not empty). This |
| + // should not be called directly. The usual way to create a PrefValueStore is |
| + // by creating a PrefService. |
| + static PrefValueStore* CreatePrefValueStore(const FilePath& pref_filename, |
| + Profile* profile, |
| + bool user_only); |
| + |
| // Get the preference value for the given preference name. |
| // Return true if a value for the given preference name was found. |
| bool GetValue(const std::wstring& name, Value** out_value) const; |
| @@ -127,6 +127,23 @@ |
| PrefStore* recommended_pref_store, |
| AfterRefreshCallback callback); |
| + protected: |
| + // In decreasing order of precedence: |
| + // |managed_prefs| contains all managed (policy) preference values. |
| + // |extension_prefs| contains preference values set by extensions. |
| + // |command_line_prefs| contains preference values set by command-line |
| + // switches. |
| + // |user_prefs| contains all user-set preference values. |
| + // |recommended_prefs| contains all recommended (policy) preference values. |
| + // |
| + // This constructor should only be used by subclasses in testing. The usual |
|
Mattias Nissler (ping if slow)
2010/08/06 07:29:42
nit: It's also used for creating the actual PrefVa
|
| + // way to create a PrefValueStore is by creating a PrefService. |
| + PrefValueStore(PrefStore* managed_prefs, |
| + PrefStore* extension_prefs, |
| + PrefStore* command_line_prefs, |
| + PrefStore* user_prefs, |
| + PrefStore* recommended_prefs); |
| + |
| private: |
| friend class PrefValueStoreTest; |
| FRIEND_TEST_ALL_PREFIXES(PrefValueStoreTest, |