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

Side by Side Diff: components/user_prefs/tracked/tracked_preference_helper.cc

Issue 2390213002: Revert of Send a TrackedPreference incident when registry pref validation fails. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
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 #include "components/user_prefs/tracked/tracked_preference_helper.h" 5 #include "components/user_prefs/tracked/tracked_preference_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "components/user_prefs/tracked/tracked_preference_histogram_names.h" 10 #include "components/user_prefs/tracked/tracked_preference_histogram_names.h"
(...skipping 20 matching lines...) Expand all
31 case PrefHashStoreTransaction::CLEARED: 31 case PrefHashStoreTransaction::CLEARED:
32 // Unfortunate case, but there is nothing we can do. 32 // Unfortunate case, but there is nothing we can do.
33 return DONT_RESET; 33 return DONT_RESET;
34 case PrefHashStoreTransaction::TRUSTED_NULL_VALUE: // Falls through. 34 case PrefHashStoreTransaction::TRUSTED_NULL_VALUE: // Falls through.
35 case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE: 35 case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE:
36 // It is okay to seed the hash in this case. 36 // It is okay to seed the hash in this case.
37 return DONT_RESET; 37 return DONT_RESET;
38 case PrefHashStoreTransaction::SECURE_LEGACY: 38 case PrefHashStoreTransaction::SECURE_LEGACY:
39 // Accept secure legacy device ID based hashes. 39 // Accept secure legacy device ID based hashes.
40 return DONT_RESET; 40 return DONT_RESET;
41 case PrefHashStoreTransaction::UNSUPPORTED:
42 NOTREACHED()
43 << "GetAction should not be called with an UNSUPPORTED value state";
44 return DONT_RESET;
45 case PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE: // Falls through. 41 case PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE: // Falls through.
46 case PrefHashStoreTransaction::CHANGED: 42 case PrefHashStoreTransaction::CHANGED:
47 return enforce_ ? DO_RESET : WANTED_RESET; 43 return enforce_ ? DO_RESET : WANTED_RESET;
48 } 44 }
49 NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: " 45 NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: "
50 << value_state; 46 << value_state;
51 return DONT_RESET; 47 return DONT_RESET;
52 } 48 }
53 49
54 bool TrackedPreferenceHelper::IsPersonal() const { 50 bool TrackedPreferenceHelper::IsPersonal() const {
(...skipping 22 matching lines...) Expand all
77 histogram_name = user_prefs::tracked::kTrackedPrefHistogramInitialized; 73 histogram_name = user_prefs::tracked::kTrackedPrefHistogramInitialized;
78 break; 74 break;
79 case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE: 75 case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE:
80 histogram_name = 76 histogram_name =
81 user_prefs::tracked::kTrackedPrefHistogramTrustedInitialized; 77 user_prefs::tracked::kTrackedPrefHistogramTrustedInitialized;
82 break; 78 break;
83 case PrefHashStoreTransaction::TRUSTED_NULL_VALUE: 79 case PrefHashStoreTransaction::TRUSTED_NULL_VALUE:
84 histogram_name = 80 histogram_name =
85 user_prefs::tracked::kTrackedPrefHistogramNullInitialized; 81 user_prefs::tracked::kTrackedPrefHistogramNullInitialized;
86 break; 82 break;
87 case PrefHashStoreTransaction::UNSUPPORTED:
88 return;
89 default: 83 default:
90 NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: " 84 NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: "
91 << value_state; 85 << value_state;
92 return; 86 return;
93 } 87 }
94 88
95 std::string full_histogram_name(histogram_name); 89 std::string full_histogram_name(histogram_name);
96 if (!validation_type_suffix.empty()) { 90 if (!validation_type_suffix.empty()) {
97 full_histogram_name.push_back('.'); 91 full_histogram_name.push_back('.');
98 validation_type_suffix.AppendToString(&full_histogram_name); 92 validation_type_suffix.AppendToString(&full_histogram_name);
(...skipping 28 matching lines...) Expand all
127 size_t count) const { 121 size_t count) const {
128 // The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro 122 // The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro
129 // adapted to allow for a dynamically suffixed histogram name. 123 // adapted to allow for a dynamically suffixed histogram name.
130 // Note: The factory creates and owns the histogram. 124 // Note: The factory creates and owns the histogram.
131 base::HistogramBase* histogram = base::LinearHistogram::FactoryGet( 125 base::HistogramBase* histogram = base::LinearHistogram::FactoryGet(
132 user_prefs::tracked::kTrackedSplitPrefHistogramChanged + pref_path_, 1, 126 user_prefs::tracked::kTrackedSplitPrefHistogramChanged + pref_path_, 1,
133 100, // Allow counts up to 100. 127 100, // Allow counts up to 100.
134 101, base::HistogramBase::kUmaTargetedHistogramFlag); 128 101, base::HistogramBase::kUmaTargetedHistogramFlag);
135 histogram->Add(count); 129 histogram->Add(count);
136 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698