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

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: fix compile 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 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 "base/macros.h"
9 #include "chrome/browser/prefs/pref_hash_filter.h"
10 #include "chrome/browser/prefs/pref_hash_store.h"
11
12 // A TrackedPreferenceHelper is a helper class for TrackedPreference which
13 // handles decision making and reporting for TrackedPreference's
14 // implementations.
15 class TrackedPreferenceHelper {
16 public:
17 enum ResetAction {
18 DONT_RESET,
19 // WANTED_RESET is reported when DO_RESET would have been reported but the
20 // current |enforcement_level| doesn't allow a reset for the detected state.
21 WANTED_RESET,
22 DO_RESET,
23 };
24
25 TrackedPreferenceHelper(const std::string& pref_path,
erikwright (departed) 2014/01/21 18:44:45 <string>
gab 2014/01/21 20:51:42 Done.
26 size_t reporting_id,
27 size_t reporting_ids_count,
28 PrefHashFilter::EnforcementLevel enforcement_level);
29
30 // Returns a ResetAction stating whether a reset is desired (DO_RESET) based
31 // on observing |value_state| or not (DONT_RESET). |allow_changes_|,
32 // |allow_seeding_|, and |allow_migration_| make the decision softer in favor
33 // of WANTED_RESET over DO_RESET in various scenarios.
34 ResetAction GetAction(PrefHashStore::ValueState value_state) const;
35
36 // Reports |value_state| via UMA under |reporting_id_|.
37 void ReportValidationResult(PrefHashStore::ValueState value_state) const;
38
39 // Reports |reset_action| via UMA under |reporting_id_|.
40 void ReportAction(ResetAction reset_action) const;
41
42 // Reports, via UMA, the |count| of split preference entries that were
43 // considered invalid in a CHANGED event.
44 void ReportSplitPreferenceChangedCount(size_t count) const;
45
46 private:
47 const std::string pref_path_;
48
49 const size_t reporting_id_;
50 const size_t reporting_ids_count_;
51
52 // Allow setting changes.
53 const bool allow_changes_;
54 // Allow seeding unknown values for atomic preferences.
55 const bool allow_seeding_;
56 // Allow migration of values validated by the old MAC algorithm.
57 const bool allow_migration_;
58
59 DISALLOW_COPY_AND_ASSIGN(TrackedPreferenceHelper);
60 };
61
62 #endif // CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698