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

Side by Side Diff: chrome/browser/prefs/tracked/tracked_preference_helper.h

Issue 114223002: Multi-strategy based tracking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r248367 Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_
6 #define CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "chrome/browser/prefs/pref_hash_filter.h"
12 #include "chrome/browser/prefs/pref_hash_store.h"
13
14 // A TrackedPreferenceHelper is a helper class for TrackedPreference which
15 // handles decision making and reporting for TrackedPreference's
16 // implementations.
17 class TrackedPreferenceHelper {
18 public:
19 enum ResetAction {
20 DONT_RESET,
21 // WANTED_RESET is reported when DO_RESET would have been reported but the
22 // current |enforcement_level| doesn't allow a reset for the detected state.
23 WANTED_RESET,
24 DO_RESET,
25 };
26
27 TrackedPreferenceHelper(const std::string& pref_path,
28 size_t reporting_id,
29 size_t reporting_ids_count,
30 PrefHashFilter::EnforcementLevel enforcement_level);
31
32 // Returns a ResetAction stating whether a reset is desired (DO_RESET) based
33 // on observing |value_state| or not (DONT_RESET). |allow_changes_|,
34 // |allow_seeding_|, and |allow_migration_| make the decision softer in favor
35 // of WANTED_RESET over DO_RESET in various scenarios.
36 ResetAction GetAction(PrefHashStore::ValueState value_state) const;
37
38 // Reports |value_state| via UMA under |reporting_id_|.
39 void ReportValidationResult(PrefHashStore::ValueState value_state) const;
40
41 // Reports |reset_action| via UMA under |reporting_id_|.
42 void ReportAction(ResetAction reset_action) const;
43
44 // Reports, via UMA, the |count| of split preference entries that were
45 // considered invalid in a CHANGED event.
46 void ReportSplitPreferenceChangedCount(size_t count) const;
47
48 private:
49 const std::string pref_path_;
50
51 const size_t reporting_id_;
52 const size_t reporting_ids_count_;
53
54 // Allow setting changes.
55 const bool allow_changes_;
56 // Allow seeding unknown values for atomic preferences.
57 const bool allow_seeding_;
58 // Allow migration of values validated by the old MAC algorithm.
59 const bool allow_migration_;
60
61 DISALLOW_COPY_AND_ASSIGN(TrackedPreferenceHelper);
62 };
63
64 #endif // CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/tracked/tracked_preference.h ('k') | chrome/browser/prefs/tracked/tracked_preference_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698