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

Unified Diff: chrome/browser/prefs/pref_service.h

Issue 5441002: Clean up pref change notification handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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
Index: chrome/browser/prefs/pref_service.h
diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h
index 632bc8482c375ac31392e6da0402f26385a20ebc..8f993c04dcbbf92bc5f81f5eaecfb3b38967a22e 100644
--- a/chrome/browser/prefs/pref_service.h
+++ b/chrome/browser/prefs/pref_service.h
@@ -17,6 +17,7 @@
#include "base/values.h"
#include "chrome/common/pref_store.h"
+class DefaultPrefStore;
class FilePath;
class NotificationObserver;
class PrefChangeObserver;
@@ -95,11 +96,11 @@ class PrefService : public NonThreadSafe {
DISALLOW_COPY_AND_ASSIGN(Preference);
};
- // Factory method that creates a new instance of a PrefService with
- // a PrefValueStore containing all platform-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. This is the usual way to create a new PrefService.
+ // Factory method that creates a new instance of a PrefService with the
+ // 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. This is the usual way to create
+ // a new PrefService.
static PrefService* CreatePrefService(const FilePath& pref_filename,
Profile* profile);
@@ -109,9 +110,16 @@ class PrefService : public NonThreadSafe {
// other types of preferences).
static PrefService* CreateUserPrefService(const FilePath& pref_filename);
- // This constructor is primarily used by tests. The |pref_value_store|
- // provides preference values.
- explicit PrefService(PrefValueStore* pref_value_store);
+ // Construct a new pref service, specifying the pref sources as explicit
+ // PrefStore pointers. This constructor is what CreatePrefService() ends up
+ // calling. It's also used for unit tests.
+ PrefService(PrefStore* managed_platform_prefs,
+ PrefStore* device_management_prefs,
+ PrefStore* extension_prefs,
+ PrefStore* command_line_prefs,
+ PrefStore* user_prefs,
+ PrefStore* recommended_prefs,
+ Profile* profile);
danno 2010/12/02 10:31:52 How about making this protected and the testingpre
Mattias Nissler (ping if slow) 2010/12/02 16:38:24 Done.
virtual ~PrefService();
@@ -221,9 +229,9 @@ class PrefService : public NonThreadSafe {
bool ReadOnly() const;
- PrefNotifier* pref_notifier() const { return pref_notifier_.get(); }
-
- PrefValueStore* pref_value_store() const { return pref_value_store_.get(); }
+ // TODO(mnissler): This should not be public. Change client code to call a
+ // preference setter or use ScopedPrefUpdate.
+ PrefNotifier* pref_notifier() const;
protected:
// The PrefNotifier handles registering and notifying preference observers.
@@ -271,6 +279,9 @@ class PrefService : public NonThreadSafe {
// and owned by this PrefService. Subclasses may access it for unit testing.
scoped_refptr<PrefValueStore> pref_value_store_;
+ // Points to the default pref store we passed to the PrefValueStore.
+ DefaultPrefStore* default_store_;
+
// A set of all the registered Preference objects.
PreferenceSet prefs_;

Powered by Google App Engine
This is Rietveld 408576698