diff options
author | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-14 17:28:14 +0000 |
---|---|---|
committer | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-14 17:28:14 +0000 |
commit | 023f5bb6914de1a16e57d6a4bf38c9a2a62171a0 (patch) | |
tree | d66edbc8e960e1e5ac222a11fb2c1304acbb6ecb /base/prefs | |
parent | 4f50241019116f686dab207841f696de017a1161 (diff) | |
download | chromium_src-023f5bb6914de1a16e57d6a4bf38c9a2a62171a0.zip chromium_src-023f5bb6914de1a16e57d6a4bf38c9a2a62171a0.tar.gz chromium_src-023f5bb6914de1a16e57d6a4bf38c9a2a62171a0.tar.bz2 |
Leftover cleanups from https://codereview.chromium.org/324493002 .
Moves one more method from PersistentPrefStore to WritablePrefStore. This allows most "writing" operations to be possible without the more complex PersistentPrefStore API.
BUG=None
Review URL: https://codereview.chromium.org/389333003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/prefs')
-rw-r--r-- | base/prefs/persistent_pref_store.h | 6 | ||||
-rw-r--r-- | base/prefs/value_map_pref_store.cc | 5 | ||||
-rw-r--r-- | base/prefs/value_map_pref_store.h | 2 | ||||
-rw-r--r-- | base/prefs/writeable_pref_store.h | 5 |
4 files changed, 12 insertions, 6 deletions
diff --git a/base/prefs/persistent_pref_store.h b/base/prefs/persistent_pref_store.h index fb9d6dc..093ea8d5 100644 --- a/base/prefs/persistent_pref_store.h +++ b/base/prefs/persistent_pref_store.h @@ -46,12 +46,6 @@ class BASE_PREFS_EXPORT PersistentPrefStore : public WriteablePrefStore { virtual void OnError(PrefReadError error) = 0; }; - // Same as SetValue, but doesn't generate notifications. This is used by - // PrefService::GetMutableUserPref() in order to put empty entries - // into the user pref store. Using SetValue is not an option since existing - // tests rely on the number of notifications generated. - virtual void SetValueSilently(const std::string& key, base::Value* value) = 0; - // Whether the store is in a pseudo-read-only mode where changes are not // actually persisted to disk. This happens in some cases when there are // read errors during startup. diff --git a/base/prefs/value_map_pref_store.cc b/base/prefs/value_map_pref_store.cc index 5e890e2..8af1282 100644 --- a/base/prefs/value_map_pref_store.cc +++ b/base/prefs/value_map_pref_store.cc @@ -47,6 +47,11 @@ void ValueMapPrefStore::ReportValueChanged(const std::string& key) { FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); } +void ValueMapPrefStore::SetValueSilently(const std::string& key, + base::Value* value) { + prefs_.SetValue(key, value); +} + ValueMapPrefStore::~ValueMapPrefStore() {} void ValueMapPrefStore::NotifyInitializationCompleted() { diff --git a/base/prefs/value_map_pref_store.h b/base/prefs/value_map_pref_store.h index c202725..d4e41f45 100644 --- a/base/prefs/value_map_pref_store.h +++ b/base/prefs/value_map_pref_store.h @@ -33,6 +33,8 @@ class BASE_PREFS_EXPORT ValueMapPrefStore : public WriteablePrefStore { virtual bool GetMutableValue(const std::string& key, base::Value** value) OVERRIDE; virtual void ReportValueChanged(const std::string& key) OVERRIDE; + virtual void SetValueSilently(const std::string& key, + base::Value* value) OVERRIDE; protected: virtual ~ValueMapPrefStore(); diff --git a/base/prefs/writeable_pref_store.h b/base/prefs/writeable_pref_store.h index 908d867..d320dcf 100644 --- a/base/prefs/writeable_pref_store.h +++ b/base/prefs/writeable_pref_store.h @@ -36,6 +36,11 @@ class BASE_PREFS_EXPORT WriteablePrefStore : public PrefStore { // ReportValueChanged will trigger notifications even if nothing has changed. virtual void ReportValueChanged(const std::string& key) = 0; + // Same as SetValue, but doesn't generate notifications. This is used by + // PrefService::GetMutableUserPref() in order to put empty entries + // into the user pref store. Using SetValue is not an option since existing + // tests rely on the number of notifications generated. + virtual void SetValueSilently(const std::string& key, base::Value* value) = 0; protected: virtual ~WriteablePrefStore() {} |