diff options
author | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-22 20:19:51 +0000 |
---|---|---|
committer | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-22 20:19:51 +0000 |
commit | 0ca10241cd75d258c1679d50e4e136d8755a2fba (patch) | |
tree | 21d093f93a78d6564081def55b123dfc9031ba74 /base/prefs | |
parent | 1bcb9ca8f5055cf1a259e53adf4642a462f80c1f (diff) | |
download | chromium_src-0ca10241cd75d258c1679d50e4e136d8755a2fba.zip chromium_src-0ca10241cd75d258c1679d50e4e136d8755a2fba.tar.gz chromium_src-0ca10241cd75d258c1679d50e4e136d8755a2fba.tar.bz2 |
Introduce a temporary workaround to ensure tracked preferences set to empty list/dict are not confused with those that are simply not set (i.e., NULL).
Review URL: https://codereview.chromium.org/79013003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/prefs')
-rw-r--r-- | base/prefs/pref_service.cc | 4 | ||||
-rw-r--r-- | base/prefs/pref_service.h | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc index 296e6f2..4c707a5 100644 --- a/base/prefs/pref_service.cc +++ b/base/prefs/pref_service.cc @@ -297,6 +297,10 @@ const base::Value* PrefService::GetDefaultPrefValue(const char* path) const { return value; } +void PrefService::MarkUserStoreNeedsEmptyValue(const std::string& key) const { + user_pref_store_->MarkNeedsEmptyValue(key); +} + const base::ListValue* PrefService::GetList(const char* path) const { DCHECK(CalledOnValidThread()); diff --git a/base/prefs/pref_service.h b/base/prefs/pref_service.h index 599a2aa..9f4dc7c 100644 --- a/base/prefs/pref_service.h +++ b/base/prefs/pref_service.h @@ -221,6 +221,13 @@ class BASE_PREFS_EXPORT PrefService : public base::NonThreadSafe { // registered preference. In that case, will never return NULL. const base::Value* GetDefaultPrefValue(const char* path) const; + // Deprecated. Do not add calls to this method. + // Marks that the user store should not prune out empty values for |key| when + // writting to disk. + // TODO(gab): Enforce this at a lower level for all values and remove this + // method. + void MarkUserStoreNeedsEmptyValue(const std::string& key) const; + // Returns true if a value has been set for the specified path. // NOTE: this is NOT the same as FindPreference. In particular // FindPreference returns whether RegisterXXX has been invoked, where as |