| Index: chrome/browser/prefs/pref_hash_filter.h
|
| diff --git a/chrome/browser/prefs/pref_hash_filter.h b/chrome/browser/prefs/pref_hash_filter.h
|
| index baa7811a05aca3fd5ed75039ac5f2f8f626e780a..ead8dcebbb1134fc95cebc2057666919811fea68 100644
|
| --- a/chrome/browser/prefs/pref_hash_filter.h
|
| +++ b/chrome/browser/prefs/pref_hash_filter.h
|
| @@ -12,8 +12,7 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/prefs/pref_filter.h"
|
| -
|
| -class PrefHashStore;
|
| +#include "chrome/browser/prefs/pref_hash_store.h"
|
|
|
| namespace base {
|
| class DictionaryValue;
|
| @@ -25,7 +24,29 @@ class Value;
|
| // are changed.
|
| class PrefHashFilter : public PrefFilter {
|
| public:
|
| + enum PrefTrackingStrategy {
|
| + // Atomic preferences are tracked as a whole.
|
| + TRACKING_STRATEGY_ATOMIC,
|
| + // Split preferences are dictionaries for which each top-level entry is
|
| + // tracked independently.
|
| + TRACKING_STRATEGY_SPLIT,
|
| + };
|
| +
|
| + struct TrackedPreference {
|
| + size_t reporting_id;
|
| + const char* name;
|
| + PrefTrackingStrategy strategy;
|
| + };
|
| +
|
| + // Constructs a PrefHashFilter with the default set of tracked preferences.
|
| explicit PrefHashFilter(scoped_ptr<PrefHashStore> pref_hash_store);
|
| +
|
| + // Constructs a PrefHashFilter with the specified |tracked_preferences|. Meant
|
| + // to be used by tests only.
|
| + PrefHashFilter(scoped_ptr<PrefHashStore> pref_hash_store,
|
| + const TrackedPreference tracked_preferences[],
|
| + size_t tracked_preferences_size);
|
| +
|
| virtual ~PrefHashFilter();
|
|
|
| // PrefFilter implementation.
|
| @@ -35,8 +56,33 @@ class PrefHashFilter : public PrefFilter {
|
| const base::Value* value) OVERRIDE;
|
|
|
| private:
|
| + struct TrackedPreferenceMetaData {
|
| + size_t reporting_id;
|
| + PrefTrackingStrategy strategy;
|
| + };
|
| +
|
| + typedef std::map<std::string, const TrackedPreferenceMetaData>
|
| + TrackedPreferencesMap;
|
| +
|
| + /// Initializes |tracked_paths_| from |tracked_preferences_|.
|
| + void InitTrackedPreferences(const TrackedPreference tracked_preferences[],
|
| + size_t tracked_preferences_size);
|
| +
|
| + // Updates the hash(es) in |pref_hash_store_| for |value| at |path| based on
|
| + // the tracking |strategy|.
|
| + void StoreHashUsingStrategy(const std::string& path,
|
| + const base::Value* value,
|
| + PrefTrackingStrategy strategy);
|
| +
|
| + // Checks the hash(es) in |pref_hash_store_| for |value| at |path| based on
|
| + // the tracking |strategy|.
|
| + PrefHashStore::ValueState CheckValueUsingStrategy(
|
| + const std::string& path,
|
| + const base::Value* value,
|
| + PrefTrackingStrategy strategy);
|
| +
|
| scoped_ptr<PrefHashStore> pref_hash_store_;
|
| - std::set<std::string> tracked_paths_;
|
| + TrackedPreferencesMap tracked_paths_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(PrefHashFilter);
|
| };
|
|
|