Chromium Code Reviews| 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 COMPONENTS_USER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ | 5 #ifndef COMPONENTS_USER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ |
| 6 #define COMPONENTS_USER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ | 6 #define COMPONENTS_USER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/user_prefs/tracked/hash_store_contents.h" | |
| 13 #include "components/user_prefs/tracked/pref_hash_filter.h" | 14 #include "components/user_prefs/tracked/pref_hash_filter.h" |
| 14 #include "components/user_prefs/tracked/pref_hash_store_transaction.h" | 15 #include "components/user_prefs/tracked/pref_hash_store_transaction.h" |
| 15 | 16 |
| 16 // A TrackedPreferenceHelper is a helper class for TrackedPreference which | 17 // A TrackedPreferenceHelper is a helper class for TrackedPreference which |
| 17 // handles decision making and reporting for TrackedPreference's | 18 // handles decision making and reporting for TrackedPreference's |
| 18 // implementations. | 19 // implementations. |
| 19 class TrackedPreferenceHelper { | 20 class TrackedPreferenceHelper { |
| 20 public: | 21 public: |
| 21 enum ResetAction { | 22 enum ResetAction { |
| 22 DONT_RESET, | 23 DONT_RESET, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 34 | 35 |
| 35 // Returns a ResetAction stating whether a reset is desired (DO_RESET) or not | 36 // Returns a ResetAction stating whether a reset is desired (DO_RESET) or not |
| 36 // (DONT_RESET) based on observing |value_state|. Can also return WANTED_RESET | 37 // (DONT_RESET) based on observing |value_state|. Can also return WANTED_RESET |
| 37 // if a reset would have been desired but the current |enforcement_level| | 38 // if a reset would have been desired but the current |enforcement_level| |
| 38 // doesn't allow it. | 39 // doesn't allow it. |
| 39 ResetAction GetAction(PrefHashStoreTransaction::ValueState value_state) const; | 40 ResetAction GetAction(PrefHashStoreTransaction::ValueState value_state) const; |
| 40 | 41 |
| 41 // Returns true if the preference value may contain personal information. | 42 // Returns true if the preference value may contain personal information. |
| 42 bool IsPersonal() const; | 43 bool IsPersonal() const; |
| 43 | 44 |
| 44 // Reports |value_state| via UMA under |reporting_id_|. | 45 // Reports |value_state| via UMA under |reporting_id_|. |
|
gab
2016/08/03 18:19:36
// Reports |value_state| via UMA under |reporting_
proberge
2016/08/04 00:13:47
Done, but keeping |validation_type| for now.
| |
| 45 void ReportValidationResult( | 46 void ReportValidationResult(PrefHashStoreTransaction::ValueState value_state, |
| 46 PrefHashStoreTransaction::ValueState value_state) const; | 47 HashStoreContentsType validation_type) const; |
|
gab
2016/08/03 18:19:36
As mentioned above, I think this could just be
co
proberge
2016/08/04 00:13:47
Ack, see above reply
| |
| 47 | 48 |
| 48 // Reports |reset_action| via UMA under |reporting_id_|. | 49 // Reports |reset_action| via UMA under |reporting_id_|. |
| 49 void ReportAction(ResetAction reset_action) const; | 50 void ReportAction(ResetAction reset_action) const; |
| 50 | 51 |
| 51 // Reports, via UMA, the |count| of split preference entries that were | 52 // Reports, via UMA, the |count| of split preference entries that were |
| 52 // considered invalid in a CHANGED event. | 53 // considered invalid in a CHANGED event. |
| 53 void ReportSplitPreferenceChangedCount(size_t count) const; | 54 void ReportSplitPreferenceChangedCount(size_t count) const; |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 const std::string pref_path_; | 57 const std::string pref_path_; |
| 57 | 58 |
| 58 const size_t reporting_id_; | 59 const size_t reporting_id_; |
| 59 const size_t reporting_ids_count_; | 60 const size_t reporting_ids_count_; |
| 60 | 61 |
| 61 // Deny setting changes and hash seeding/migration. | 62 // Deny setting changes and hash seeding/migration. |
| 62 const bool enforce_; | 63 const bool enforce_; |
| 63 | 64 |
| 64 const bool personal_; | 65 const bool personal_; |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(TrackedPreferenceHelper); | 67 DISALLOW_COPY_AND_ASSIGN(TrackedPreferenceHelper); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 #endif // COMPONENTS_USER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ | 70 #endif // COMPONENTS_USER_PREFS_TRACKED_TRACKED_PREFERENCE_HELPER_H_ |
| OLD | NEW |