Index: components/user_prefs/tracked/pref_hash_filter.h |
diff --git a/components/user_prefs/tracked/pref_hash_filter.h b/components/user_prefs/tracked/pref_hash_filter.h |
index 8652a7f817c545a5b48e1154c60af1427eadbbbb..3d1ea3ba174293edc6bad01b2351239c143295b2 100644 |
--- a/components/user_prefs/tracked/pref_hash_filter.h |
+++ b/components/user_prefs/tracked/pref_hash_filter.h |
@@ -15,10 +15,12 @@ |
#include "base/callback.h" |
#include "base/compiler_specific.h" |
#include "base/containers/scoped_ptr_hash_map.h" |
+#include "base/files/file_path.h" |
#include "base/macros.h" |
#include "components/user_prefs/tracked/interceptable_pref_filter.h" |
#include "components/user_prefs/tracked/tracked_preference.h" |
+class HashStoreContents; |
class PrefHashStore; |
class PrefService; |
class PrefStore; |
@@ -73,8 +75,13 @@ class PrefHashFilter : public InterceptablePrefFilter { |
// than |tracked_preferences.size()|). If |report_super_mac_validity| is true, |
// the state of the super MAC will be reported via UMA during |
// FinalizeFilterOnLoad. |
+ // |external_validation_hash_store| will be used (if non-null) to perform |
+ // extra |
+ // validations without triggering resets. |
PrefHashFilter( |
std::unique_ptr<PrefHashStore> pref_hash_store, |
+ std::unique_ptr<PrefHashStore> external_validation_hash_store, |
+ std::unique_ptr<HashStoreContents> external_hash_store_contents, |
const std::vector<TrackedPreferenceMetadata>& tracked_preferences, |
const base::Closure& on_reset_on_load, |
TrackedPreferenceValidationDelegate* delegate, |
@@ -101,7 +108,8 @@ class PrefHashFilter : public InterceptablePrefFilter { |
// PrefFilter remaining implementation. |
void FilterUpdate(const std::string& path) override; |
- void FilterSerializeData(base::DictionaryValue* pref_store_contents) override; |
+ base::Callback<void(bool)> FilterSerializeData( |
+ base::DictionaryValue* pref_store_contents) override; |
private: |
// InterceptablePrefFilter implementation. |
@@ -110,6 +118,18 @@ class PrefHashFilter : public InterceptablePrefFilter { |
std::unique_ptr<base::DictionaryValue> pref_store_contents, |
bool prefs_altered) override; |
+ // Helper function to generate the callback returned by |FilterSerializeData|. |
+ base::Callback<void(bool)> GetOnWriteSynchronousCallback( |
+ base::DictionaryValue* pref_store_contents); |
+ |
+ // Write to the external store the MACs contained in |changed_paths_and_macs|. |
+ // This is called after the prefs are written to disk by the pref store to |
+ // ensure that the external store is consistent with the preference file. |
+ static void PrefHashFilter::FlushToExternalStore( |
+ std::unique_ptr<HashStoreContents> external_hash_store_contents, |
+ std::unique_ptr<base::DictionaryValue> changed_paths_and_macs, |
+ bool write_success); |
+ |
// Callback to be invoked only once (and subsequently reset) on the next |
// FilterOnLoad event. It will be allowed to modify the |prefs| handed to |
// FilterOnLoad before handing them back to this PrefHashFilter. |
@@ -120,12 +140,21 @@ class PrefHashFilter : public InterceptablePrefFilter { |
typedef base::ScopedPtrHashMap<std::string, |
std::unique_ptr<TrackedPreference>> |
TrackedPreferencesMap; |
+ |
// A map from changed paths to their corresponding TrackedPreferences (which |
// aren't owned by this map). |
typedef std::map<std::string, const TrackedPreference*> ChangedPathsMap; |
std::unique_ptr<PrefHashStore> pref_hash_store_; |
+ // A store on which to perform extra validations without triggering resets. |
+ // Will be null if the platform does not support external validation. |
+ std::unique_ptr<PrefHashStore> external_validation_hash_store_; |
+ |
+ // A store contents on which |external_validation_hash_store| can act. |
+ // Will be null if the platform does not support external validation. |
+ std::unique_ptr<HashStoreContents> external_validation_hash_store_contents_; |
+ |
// Invoked if a reset occurs in a call to FilterOnLoad. |
const base::Closure on_reset_on_load_; |