diff options
| author | pam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 11:14:01 +0000 |
|---|---|---|
| committer | pam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 11:14:01 +0000 |
| commit | 40a47c1697c8597153a2e0450ca7f95e8f2c7fe2 (patch) | |
| tree | ae22fce34f33a7a3a215537cc3c384f2d7501a06 /chrome/browser/prefs/pref_value_store.h | |
| parent | cc0424241b32f8ae14180bd2e3e69896c5e0c380 (diff) | |
| download | chromium_src-40a47c1697c8597153a2e0450ca7f95e8f2c7fe2.zip chromium_src-40a47c1697c8597153a2e0450ca7f95e8f2c7fe2.tar.gz chromium_src-40a47c1697c8597153a2e0450ca7f95e8f2c7fe2.tar.bz2 | |
Revert 58920 - Create a DefaultPrefStore to hold registered application-default preference values.
This allows notifications to be sent properly when another PrefStore takes control from a default value.
BUG=52719
TEST=covered by PrefValueStoreTest.* unit tests
Review URL: http://codereview.chromium.org/3331016
TBR=pam@chromium.org
[Reverting because it causes PrefsControllerTest.ValidateCustomHomePagesTable to crash on Mac.]
Review URL: http://codereview.chromium.org/3353019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prefs/pref_value_store.h')
| -rw-r--r-- | chrome/browser/prefs/pref_value_store.h | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/chrome/browser/prefs/pref_value_store.h b/chrome/browser/prefs/pref_value_store.h index fe9e291..fb1cb21 100644 --- a/chrome/browser/prefs/pref_value_store.h +++ b/chrome/browser/prefs/pref_value_store.h @@ -49,9 +49,7 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { ~PrefValueStore(); // Get the preference value for the given preference name. - // Return true if a value for the given preference name was found in any of - // the available PrefStores. Most callers should use Preference::GetValue() - // instead of calling this method directly. + // Return true if a value for the given preference name was found. bool GetValue(const std::string& name, Value** out_value) const; // Read preference values into the three PrefStores so that they are available @@ -79,8 +77,7 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { // TODO(pamg): If we're setting the same value as we already had, into the // same store that was controlling it before, and there's also a value set in // a lower-priority store, *and* we're not the highest-priority store, then - // this will return true when it shouldn't. This comes up frequently because - // every pref has a value in the default PrefStore. + // this will return true when it shouldn't. Fix that if it causes problems. virtual bool PrefHasChanged(const char* path, PrefNotifier::PrefStoreType new_store, const Value* old_value); @@ -104,26 +101,22 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { // or recommended this function should have no effect. void RemoveUserPrefValue(const char* name); - // Sets a value in the DefaultPrefStore, which takes ownership of the Value. - void SetDefaultPrefValue(const char* name, Value* in_value); - // These methods return true if a preference with the given name is in the // indicated pref store, even if that value is currently being overridden by // a higher-priority source. - bool PrefValueInManagedStore(const char* name) const; - bool PrefValueInExtensionStore(const char* name) const; - bool PrefValueInUserStore(const char* name) const; + bool PrefValueInManagedStore(const char* name); + bool PrefValueInExtensionStore(const char* name); + bool PrefValueInUserStore(const char* name); // These methods return true if a preference with the given name is actually // being controlled by the indicated pref store and not being overridden by // a higher-priority source. - bool PrefValueFromExtensionStore(const char* name) const; - bool PrefValueFromUserStore(const char* name) const; - bool PrefValueFromDefaultStore(const char* name) const; + bool PrefValueFromExtensionStore(const char* name); + bool PrefValueFromUserStore(const char* name); // Check whether a Preference value is modifiable by the user, i.e. whether // there is no higher-priority source controlling it. - bool PrefValueUserModifiable(const char* name) const; + bool PrefValueUserModifiable(const char* name); // Signature of callback triggered after policy refresh. Parameter is not // passed as reference to prevent passing along a pointer to a set whose @@ -151,8 +144,6 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { // switches. // |user_prefs| contains all user-set preference values. // |recommended_prefs| contains all recommended (policy) preference values. - // |default_prefs| contains application-default preference values. It must - // be non-null if any preferences are to be registered. // // This constructor should only be used internally, or by subclasses in // testing. The usual way to create a PrefValueStore is by creating a @@ -161,8 +152,7 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { PrefStore* extension_prefs, PrefStore* command_line_prefs, PrefStore* user_prefs, - PrefStore* recommended_prefs, - PrefStore* default_prefs); + PrefStore* recommended_prefs); private: friend class PrefValueStoreTest; @@ -171,8 +161,7 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { scoped_ptr<PrefStore> pref_stores_[PrefNotifier::PREF_STORE_TYPE_MAX + 1]; - bool PrefValueInStore(const char* name, - PrefNotifier::PrefStoreType type) const; + bool PrefValueInStore(const char* name, PrefNotifier::PrefStoreType type); // Returns true if the preference |name| is found in any PrefStore starting // just beyond the |boundary|, non-inclusive, and checking either @@ -180,13 +169,12 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { // stores. bool PrefValueInStoreRange(const char* name, PrefNotifier::PrefStoreType boundary, - bool higher_priority) const; + bool higher_priority); // Returns the pref store type identifying the source that controls the // Preference identified by |name|. If none of the sources has a value, // INVALID is returned. - PrefNotifier::PrefStoreType ControllingPrefStoreForPref( - const char* name) const; + PrefNotifier::PrefStoreType ControllingPrefStoreForPref(const char* name); // Called during policy refresh after ReadPrefs completes on the thread // that initiated the policy refresh. RefreshPolicyPrefsCompletion takes |
