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

Unified Diff: components/user_prefs/tracked/tracked_preference_helper.cc

Issue 2384213002: Send a TrackedPreference incident when registry pref validation fails. (Closed)
Patch Set: Address comments on patch set 4 Created 4 years, 2 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: components/user_prefs/tracked/tracked_preference_helper.cc
diff --git a/components/user_prefs/tracked/tracked_preference_helper.cc b/components/user_prefs/tracked/tracked_preference_helper.cc
index 2d39749cf53c27f70741bdbe308e5c0ecfb9a20b..fb36a2a1518f409b6b6f4b386b8a7aabb7eac340 100644
--- a/components/user_prefs/tracked/tracked_preference_helper.cc
+++ b/components/user_prefs/tracked/tracked_preference_helper.cc
@@ -38,6 +38,10 @@ TrackedPreferenceHelper::ResetAction TrackedPreferenceHelper::GetAction(
case PrefHashStoreTransaction::SECURE_LEGACY:
// Accept secure legacy device ID based hashes.
return DONT_RESET;
+ case PrefHashStoreTransaction::UNSUPPORTED:
+ NOTREACHED()
+ << "GetAction should not be called with an UNSUPPORTED value state";
+ return DONT_RESET;
case PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE: // Falls through.
case PrefHashStoreTransaction::CHANGED:
return enforce_ ? DO_RESET : WANTED_RESET;
@@ -54,7 +58,7 @@ bool TrackedPreferenceHelper::IsPersonal() const {
void TrackedPreferenceHelper::ReportValidationResult(
PrefHashStoreTransaction::ValueState value_state,
base::StringPiece validation_type_suffix) const {
- const char* histogram_name;
+ const char* histogram_name = nullptr;
switch (value_state) {
case PrefHashStoreTransaction::UNCHANGED:
histogram_name = user_prefs::tracked::kTrackedPrefHistogramUnchanged;
@@ -80,11 +84,12 @@ void TrackedPreferenceHelper::ReportValidationResult(
histogram_name =
user_prefs::tracked::kTrackedPrefHistogramNullInitialized;
break;
- default:
- NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: "
- << value_state;
+ case PrefHashStoreTransaction::UNSUPPORTED:
+ NOTREACHED() << "ReportValidationResult should not be called with an "
+ "UNSUPPORTED value state";
return;
}
+ DCHECK(histogram_name);
std::string full_histogram_name(histogram_name);
if (!validation_type_suffix.empty()) {

Powered by Google App Engine
This is Rietveld 408576698