summaryrefslogtreecommitdiffstats
path: root/base/prefs
diff options
context:
space:
mode:
authorerikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-18 20:45:21 +0000
committererikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-18 20:45:21 +0000
commit1b5837665d4a213c8f18b4c70fe3feb2117ce744 (patch)
treeb438c3784b840aaf4681fb4aab991425a2321eb3 /base/prefs
parentc32964e11b20413036b5f9be21080930b8463b28 (diff)
downloadchromium_src-1b5837665d4a213c8f18b4c70fe3feb2117ce744.zip
chromium_src-1b5837665d4a213c8f18b4c70fe3feb2117ce744.tar.gz
chromium_src-1b5837665d4a213c8f18b4c70fe3feb2117ce744.tar.bz2
Move preference MACs to the protected preference stores.
(1) 1-time migration of MACs from local state to Preferences/Protected Preferences. (2) Migrate MACs between Preferences/Protected Preferences according to configuration changes. Proposed follow-up tasks are: (1) Introduce TrackedPreferencesMigrationDelegate (2) Introduce protections to prevent unintended stamping of the super MAC. (3) Expanded test coverage of PrefHashFilter (4) Expanded test coverage for legacy migration in TrackedPreferencesMigrationTest BUG=372547, 368480 R=asvitkine@chromium.org, gab@chromium.org Review URL: https://codereview.chromium.org/324493002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278164 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/prefs')
-rw-r--r--base/prefs/json_pref_store_unittest.cc2
-rw-r--r--base/prefs/persistent_pref_store.h10
-rw-r--r--base/prefs/pref_filter.h6
-rw-r--r--base/prefs/value_map_pref_store.cc9
-rw-r--r--base/prefs/value_map_pref_store.h3
-rw-r--r--base/prefs/writeable_pref_store.h11
6 files changed, 28 insertions, 13 deletions
diff --git a/base/prefs/json_pref_store_unittest.cc b/base/prefs/json_pref_store_unittest.cc
index 4c9c847..2b4a9e8 100644
--- a/base/prefs/json_pref_store_unittest.cc
+++ b/base/prefs/json_pref_store_unittest.cc
@@ -40,7 +40,7 @@ class InterceptingPrefFilter : public PrefFilter {
scoped_ptr<base::DictionaryValue> pref_store_contents) OVERRIDE;
virtual void FilterUpdate(const std::string& path) OVERRIDE {}
virtual void FilterSerializeData(
- const base::DictionaryValue* pref_store_contents) OVERRIDE {}
+ base::DictionaryValue* pref_store_contents) OVERRIDE {}
bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; }
diff --git a/base/prefs/persistent_pref_store.h b/base/prefs/persistent_pref_store.h
index 11d2a54..fb9d6dc 100644
--- a/base/prefs/persistent_pref_store.h
+++ b/base/prefs/persistent_pref_store.h
@@ -46,16 +46,6 @@ class BASE_PREFS_EXPORT PersistentPrefStore : public WriteablePrefStore {
virtual void OnError(PrefReadError error) = 0;
};
- // Equivalent to PrefStore::GetValue but returns a mutable value.
- virtual bool GetMutableValue(const std::string& key,
- base::Value** result) = 0;
-
- // Triggers a value changed notification. This function needs to be called
- // if one retrieves a list or dictionary with GetMutableValue and change its
- // value. SetValue takes care of notifications itself. Note that
- // 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
diff --git a/base/prefs/pref_filter.h b/base/prefs/pref_filter.h
index 1020029..82a44c6 100644
--- a/base/prefs/pref_filter.h
+++ b/base/prefs/pref_filter.h
@@ -45,9 +45,11 @@ class BASE_PREFS_EXPORT PrefFilter {
virtual void FilterUpdate(const std::string& path) = 0;
// Receives notification when the pref store is about to serialize data
- // contained in |pref_store_contents| to a string.
+ // contained in |pref_store_contents| to a string. Modifications to
+ // |pref_store_contents| will be persisted to disk and also affect the
+ // in-memory state.
virtual void FilterSerializeData(
- const base::DictionaryValue* pref_store_contents) = 0;
+ base::DictionaryValue* pref_store_contents) = 0;
};
#endif // BASE_PREFS_PREF_FILTER_H_
diff --git a/base/prefs/value_map_pref_store.cc b/base/prefs/value_map_pref_store.cc
index 0751469..5e890e2 100644
--- a/base/prefs/value_map_pref_store.cc
+++ b/base/prefs/value_map_pref_store.cc
@@ -38,6 +38,15 @@ void ValueMapPrefStore::RemoveValue(const std::string& key) {
FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
}
+bool ValueMapPrefStore::GetMutableValue(const std::string& key,
+ base::Value** value) {
+ return prefs_.GetValue(key, value);
+}
+
+void ValueMapPrefStore::ReportValueChanged(const std::string& key) {
+ FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
+}
+
ValueMapPrefStore::~ValueMapPrefStore() {}
void ValueMapPrefStore::NotifyInitializationCompleted() {
diff --git a/base/prefs/value_map_pref_store.h b/base/prefs/value_map_pref_store.h
index 29d0b382..c202725 100644
--- a/base/prefs/value_map_pref_store.h
+++ b/base/prefs/value_map_pref_store.h
@@ -30,6 +30,9 @@ class BASE_PREFS_EXPORT ValueMapPrefStore : public WriteablePrefStore {
// WriteablePrefStore overrides:
virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE;
virtual void RemoveValue(const std::string& key) OVERRIDE;
+ virtual bool GetMutableValue(const std::string& key,
+ base::Value** value) OVERRIDE;
+ virtual void ReportValueChanged(const std::string& key) OVERRIDE;
protected:
virtual ~ValueMapPrefStore();
diff --git a/base/prefs/writeable_pref_store.h b/base/prefs/writeable_pref_store.h
index c24af95..908d867 100644
--- a/base/prefs/writeable_pref_store.h
+++ b/base/prefs/writeable_pref_store.h
@@ -26,6 +26,17 @@ class BASE_PREFS_EXPORT WriteablePrefStore : public PrefStore {
// Removes the value for |key|.
virtual void RemoveValue(const std::string& key) = 0;
+ // Equivalent to PrefStore::GetValue but returns a mutable value.
+ virtual bool GetMutableValue(const std::string& key,
+ base::Value** result) = 0;
+
+ // Triggers a value changed notification. This function needs to be called
+ // if one retrieves a list or dictionary with GetMutableValue and change its
+ // value. SetValue takes care of notifications itself. Note that
+ // ReportValueChanged will trigger notifications even if nothing has changed.
+ virtual void ReportValueChanged(const std::string& key) = 0;
+
+
protected:
virtual ~WriteablePrefStore() {}