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 #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" |
11 | 11 |
12 TrackedPreferenceHelper::TrackedPreferenceHelper( | 12 TrackedPreferenceHelper::TrackedPreferenceHelper( |
13 const std::string& pref_path, | 13 const std::string& pref_path, |
14 size_t reporting_id, | 14 size_t reporting_id, |
15 size_t reporting_ids_count, | 15 size_t reporting_ids_count, |
16 PrefHashFilter::EnforcementLevel enforcement_level, | 16 PrefHashFilter::EnforcementLevel enforcement_level, |
17 PrefHashFilter::ValueType value_type) | 17 PrefHashFilter::ValueType value_type) |
18 : pref_path_(pref_path), | 18 : pref_path_(pref_path), |
19 reporting_id_(reporting_id), | 19 reporting_id_(reporting_id), |
20 reporting_ids_count_(reporting_ids_count), | 20 reporting_ids_count_(reporting_ids_count), |
21 enforce_(enforcement_level == PrefHashFilter::ENFORCE_ON_LOAD), | 21 enforce_(enforcement_level == |
22 personal_(value_type == PrefHashFilter::VALUE_PERSONAL) { | 22 PrefHashFilter::EnforcementLevel::ENFORCE_ON_LOAD), |
23 } | 23 personal_(value_type == PrefHashFilter::ValueType::PERSONAL) {} |
24 | 24 |
25 TrackedPreferenceHelper::ResetAction TrackedPreferenceHelper::GetAction( | 25 TrackedPreferenceHelper::ResetAction TrackedPreferenceHelper::GetAction( |
26 PrefHashStoreTransaction::ValueState value_state) const { | 26 PrefHashStoreTransaction::ValueState value_state) const { |
27 switch (value_state) { | 27 switch (value_state) { |
28 case PrefHashStoreTransaction::UNCHANGED: | 28 case PrefHashStoreTransaction::UNCHANGED: |
29 // Desired case, nothing to do. | 29 // Desired case, nothing to do. |
30 return DONT_RESET; | 30 return DONT_RESET; |
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; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 size_t count) const { | 126 size_t count) const { |
127 // The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro | 127 // The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro |
128 // adapted to allow for a dynamically suffixed histogram name. | 128 // adapted to allow for a dynamically suffixed histogram name. |
129 // Note: The factory creates and owns the histogram. | 129 // Note: The factory creates and owns the histogram. |
130 base::HistogramBase* histogram = base::LinearHistogram::FactoryGet( | 130 base::HistogramBase* histogram = base::LinearHistogram::FactoryGet( |
131 user_prefs::tracked::kTrackedSplitPrefHistogramChanged + pref_path_, 1, | 131 user_prefs::tracked::kTrackedSplitPrefHistogramChanged + pref_path_, 1, |
132 100, // Allow counts up to 100. | 132 100, // Allow counts up to 100. |
133 101, base::HistogramBase::kUmaTargetedHistogramFlag); | 133 101, base::HistogramBase::kUmaTargetedHistogramFlag); |
134 histogram->Add(count); | 134 histogram->Add(count); |
135 } | 135 } |
OLD | NEW |