Chromium Code Reviews| Index: chrome/browser/prefs/pref_service.h |
| diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h |
| index 04d7b91348f0307245d14763f090317e45010bcc..dd306c0aa942955bd97c54da924ad3989463d71a 100644 |
| --- a/chrome/browser/prefs/pref_service.h |
| +++ b/chrome/browser/prefs/pref_service.h |
| @@ -42,7 +42,8 @@ class PrefService : public NonThreadSafe { |
| // dictionary (a branch), or list. You shouldn't need to construct this on |
| // your own; use the PrefService::Register*Pref methods instead. |
| Preference(const PrefService* service, |
| - const char* name); |
| + const char* name, |
| + Value::ValueType type); |
| ~Preference() {} |
| // Returns the name of the Preference (i.e., the key, e.g., |
| @@ -92,6 +93,8 @@ class PrefService : public NonThreadSafe { |
| std::string name_; |
| + Value::ValueType type_; |
| + |
| // Reference to the PrefService in which this pref was created. |
| const PrefService* pref_service_; |
| @@ -105,9 +108,17 @@ class PrefService : public NonThreadSafe { |
| // a new PrefService. |extension_pref_store| is used as the source for |
| // extension-controlled preferences and may be NULL. The PrefService takes |
| // ownership of |extension_pref_store|. |
| - static PrefService* CreatePrefService(const FilePath& pref_filename, |
| - PrefStore* extension_pref_store, |
| - Profile* profile); |
| + static PrefService* CreatePrefService( |
| + const FilePath& pref_filename, |
| + scoped_refptr<PrefStore> extension_pref_store, |
| + Profile* profile); |
| + |
| + // Creates an incognito copy of the pref service that shares most pref stores |
| + // but uses a fresh non-persistent overlay for the user pref store and an |
| + // individual extension pref store (to cache the effective extension prefs for |
| + // incognito windows). |
| + PrefService* CreateIncognitoPrefService( |
| + scoped_refptr<PrefStore> incognito_extension_prefs); |
|
Mattias Nissler (ping if slow)
2010/12/20 14:50:02
We should have a unit test for this, ensuring that
battre
2010/12/21 18:51:59
Done.
|
| virtual ~PrefService(); |
| @@ -225,14 +236,20 @@ class PrefService : public NonThreadSafe { |
| // 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, |
| - PersistentPrefStore* user_prefs, |
| - PrefStore* recommended_prefs, |
| + PrefService(scoped_refptr<PrefStore> managed_platform_prefs, |
|
Mattias Nissler (ping if slow)
2010/12/20 14:50:02
The majority of the codebase passes reference coun
|
| + scoped_refptr<PrefStore> device_management_prefs, |
| + scoped_refptr<PrefStore> extension_prefs, |
| + scoped_refptr<PrefStore> command_line_prefs, |
| + scoped_refptr<PersistentPrefStore> user_prefs, |
| + scoped_refptr<PrefStore> recommended_prefs, |
| Profile* profile); |
| + // Constructor to be used only for CreateIncognitoPrefService. |
|
Mattias Nissler (ping if slow)
2010/12/20 14:50:02
After pondering this for a while, I'm now leaning
battre
2010/12/21 18:51:59
Done.
|
| + PrefService(PrefValueStore* old_pref_value_store, |
| + scoped_refptr<PersistentPrefStore> old_user_pref_store, |
| + scoped_refptr<PrefStore> incognito_extension_prefs, |
| + scoped_refptr<DefaultPrefStore> default_store); |
| + |
| // The PrefNotifier handles registering and notifying preference observers. |
| // It is created and owned by this PrefService. Subclasses may access it for |
| // unit testing. |
| @@ -274,13 +291,15 @@ class PrefService : public NonThreadSafe { |
| scoped_refptr<PrefValueStore> pref_value_store_; |
| // The persistent pref store used for actual user data. |
| - PersistentPrefStore* user_pref_store_; |
| + scoped_refptr<PersistentPrefStore> user_pref_store_; |
| // Points to the default pref store we passed to the PrefValueStore. |
| - DefaultPrefStore* default_store_; |
| + scoped_refptr<DefaultPrefStore> default_store_; |
| - // A set of all the registered Preference objects. |
| - PreferenceSet prefs_; |
| + // Local cache of registered Preference objects. The default_store_ |
| + // is authoritative with respect to what the types and default values |
| + // of registered preferences are. |
| + mutable PreferenceSet prefs_; |
| DISALLOW_COPY_AND_ASSIGN(PrefService); |
| }; |