OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ |
6 #define CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ | 6 #define CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // current |enforcement_level| doesn't allow a reset for the detected state. | 22 // current |enforcement_level| doesn't allow a reset for the detected state. |
23 WANTED_RESET, | 23 WANTED_RESET, |
24 DO_RESET, | 24 DO_RESET, |
25 }; | 25 }; |
26 | 26 |
27 TrackedPreferenceHelper(const std::string& pref_path, | 27 TrackedPreferenceHelper(const std::string& pref_path, |
28 size_t reporting_id, | 28 size_t reporting_id, |
29 size_t reporting_ids_count, | 29 size_t reporting_ids_count, |
30 PrefHashFilter::EnforcementLevel enforcement_level); | 30 PrefHashFilter::EnforcementLevel enforcement_level); |
31 | 31 |
32 // Returns a ResetAction stating whether a reset is desired (DO_RESET) based | 32 // Returns a ResetAction stating whether a reset is desired (DO_RESET) or not |
33 // on observing |value_state| or not (DONT_RESET). |allow_changes_|, | 33 // (DONT_RESET) based on observing |value_state|. Can also return WANTED_RESET |
34 // |allow_seeding_|, and |allow_migration_| make the decision softer in favor | 34 // if a reset would have been desired but the current |enforcement_level| |
35 // of WANTED_RESET over DO_RESET in various scenarios. | 35 // doesn't allow it. |
36 ResetAction GetAction( | 36 ResetAction GetAction( |
37 PrefHashStoreTransaction::ValueState value_state) const; | 37 PrefHashStoreTransaction::ValueState value_state) const; |
38 | 38 |
39 // Reports |value_state| via UMA under |reporting_id_|. | 39 // Reports |value_state| via UMA under |reporting_id_|. |
40 void ReportValidationResult( | 40 void ReportValidationResult( |
41 PrefHashStoreTransaction::ValueState value_state) const; | 41 PrefHashStoreTransaction::ValueState value_state) const; |
42 | 42 |
43 // Reports |reset_action| via UMA under |reporting_id_|. | 43 // Reports |reset_action| via UMA under |reporting_id_|. |
44 void ReportAction(ResetAction reset_action) const; | 44 void ReportAction(ResetAction reset_action) const; |
45 | 45 |
46 // Reports, via UMA, the |count| of split preference entries that were | 46 // Reports, via UMA, the |count| of split preference entries that were |
47 // considered invalid in a CHANGED event. | 47 // considered invalid in a CHANGED event. |
48 void ReportSplitPreferenceChangedCount(size_t count) const; | 48 void ReportSplitPreferenceChangedCount(size_t count) const; |
49 | 49 |
50 private: | 50 private: |
51 const std::string pref_path_; | 51 const std::string pref_path_; |
52 | 52 |
53 const size_t reporting_id_; | 53 const size_t reporting_id_; |
54 const size_t reporting_ids_count_; | 54 const size_t reporting_ids_count_; |
55 | 55 |
56 // Allow setting changes. | 56 // Deny setting changes and hash seeding/migration. |
57 const bool allow_changes_; | 57 const bool enforce_; |
58 // Allow seeding unknown values for atomic preferences. | |
59 const bool allow_seeding_; | |
60 // Allow migration of values validated by the old MAC algorithm. | |
61 const bool allow_migration_; | |
62 | 58 |
63 DISALLOW_COPY_AND_ASSIGN(TrackedPreferenceHelper); | 59 DISALLOW_COPY_AND_ASSIGN(TrackedPreferenceHelper); |
64 }; | 60 }; |
65 | 61 |
66 #endif // CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ | 62 #endif // CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ |
OLD | NEW |