Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3239)

Unified Diff: chrome/browser/prefs/pref_hash_filter.h

Issue 114223002: Multi-strategy based tracking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use base::ScopedPtrHashMap Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 5dea96839cb2e8dd87ddd7790f32db74276d191f..23927937ab759dd0374ac074a1093abad57ed9f0 100644
--- a/chrome/browser/prefs/pref_hash_filter.h
+++ b/chrome/browser/prefs/pref_hash_filter.h
@@ -5,14 +5,16 @@
#ifndef CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_
#define CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_
-#include <map>
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/containers/scoped_ptr_hash_map.h"
#include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_filter.h"
#include "chrome/browser/prefs/pref_hash_store.h"
+#include "chrome/browser/prefs/tracked_preference.h"
+#include "chrome/browser/prefs/tracked_preference_helper.h"
namespace base {
class DictionaryValue;
@@ -24,25 +26,22 @@ class Value;
// are changed.
class PrefHashFilter : public PrefFilter {
public:
- // Enforcement levels are defined in order of intensity; the next level always
- // implies the previous one and more.
- enum EnforcementLevel {
- NO_ENFORCEMENT,
- ENFORCE,
- ENFORCE_NO_SEEDING,
- ENFORCE_NO_SEEDING_NO_MIGRATION,
- // ENFORCE_ALL must always remain last; it is meant to be used when the
- // desired level is underdetermined and the caller wants to enforce the
- // strongest setting to be safe.
- ENFORCE_ALL
+ 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. Note: preferences using this strategy must be kept
+ // in sync with TrackedSplitPreferences in histograms.xml.
+ TRACKING_STRATEGY_SPLIT,
};
- struct TrackedPreference {
+ struct TrackedPreferenceMetadata {
size_t reporting_id;
const char* name;
// Whether to actually reset this specific preference when everything else
// indicates that it should be.
bool allow_enforcement;
+ PrefTrackingStrategy strategy;
};
// Constructs a PrefHashFilter tracking the specified |tracked_preferences|
@@ -52,10 +51,10 @@ class PrefHashFilter : public PrefFilter {
// filter will enforce factory defaults upon detecting an untrusted preference
// value.
PrefHashFilter(scoped_ptr<PrefHashStore> pref_hash_store,
- const TrackedPreference tracked_preferences[],
+ const TrackedPreferenceMetadata tracked_preferences[],
size_t tracked_preferences_size,
size_t reporting_ids_count,
- EnforcementLevel enforcement_level);
+ TrackedPreferenceHelper::EnforcementLevel enforcement_level);
virtual ~PrefHashFilter();
@@ -66,20 +65,12 @@ class PrefHashFilter : public PrefFilter {
const base::Value* value) OVERRIDE;
private:
- typedef std::map<std::string, const TrackedPreference> TrackedPreferencesMap;
+ typedef base::ScopedPtrHashMap<std::string, TrackedPreference>
+ TrackedPreferencesMap;
scoped_ptr<PrefHashStore> pref_hash_store_;
TrackedPreferencesMap tracked_paths_;
- size_t reporting_ids_count_;
-
- // Prevent setting changes.
- bool enforce_;
- // Do not seed unknown values.
- bool no_seeding_;
- // Do not migrate values validated by the old MAC algorithm.
- bool no_migration_;
-
DISALLOW_COPY_AND_ASSIGN(PrefHashFilter);
};

Powered by Google App Engine
This is Rietveld 408576698