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
parent 4f502410
......@@ -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.
......
......@@ -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() {
......
......@@ -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();
......
......@@ -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() {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment