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

Unified Diff: chrome/browser/pref_service.h

Issue 2823037: Add an ExtensionPrefStore, layered between the user prefs nad the managed pre... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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
« no previous file with comments | « chrome/browser/pref_member_unittest.cc ('k') | chrome/browser/pref_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/pref_service.h
===================================================================
--- chrome/browser/pref_service.h (revision 52073)
+++ chrome/browser/pref_service.h (working copy)
@@ -69,11 +69,21 @@
DISALLOW_COPY_AND_ASSIGN(Preference);
};
- // Factory method that creates a new instance of a |PrefService|.
+ // Factory method that creates a new instance of a |PrefService| with
+ // all platform-applicable PrefStores (managed, extension, user, etc.).
+ // This is the usual way to create a new PrefService.
static PrefService* CreatePrefService(const FilePath& pref_filename);
- // The |PrefValueStore| provides preference values.
+ // Convenience factory method for use in unit tests. Creates a new
+ // PrefService that uses a PrefValueStore with user preferences at the given
+ // |pref_filename|, and no other PrefStores (i.e., no other types of
+ // preferences).
+ static PrefService* CreateUserPrefService(const FilePath& pref_filename);
+
+ // This constructor is primarily used by tests. The |PrefValueStore| provides
+ // preference values.
explicit PrefService(PrefValueStore* pref_value_store);
+
~PrefService();
// Reloads the data from file. This should only be called when the importer
@@ -181,8 +191,18 @@
// preference is not registered.
const Preference* FindPreference(const wchar_t* pref_name) const;
+ // For the given pref_name, fire any observer of the pref only if |old_value|
+ // is different from the current value. Virtual so it can be mocked for a
+ // unit test.
+ virtual void FireObserversIfChanged(const wchar_t* pref_name,
+ const Value* old_value);
+
bool read_only() const { return pref_value_store_->ReadOnly(); }
+ protected:
+ // This should only be accessed by subclasses for unit-testing.
+ bool PrefIsChanged(const wchar_t* path, const Value* old_value);
+
private:
// Add a preference to the PreferenceMap. If the pref already exists, return
// false. This method takes ownership of |pref|.
@@ -195,11 +215,6 @@
// For the given pref_name, fire any observer of the pref.
void FireObservers(const wchar_t* pref_name);
- // For the given pref_name, fire any observer of the pref only if |old_value|
- // is different from the current value.
- void FireObserversIfChanged(const wchar_t* pref_name,
- const Value* old_value);
-
// Load from disk. Returns a non-zero error code on failure.
PrefStore::PrefReadError LoadPersistentPrefs();
« no previous file with comments | « chrome/browser/pref_member_unittest.cc ('k') | chrome/browser/pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698