| 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 ade75aea9f46266c456f794f47ad1089fc495d38..8ad62e4a7f16ae37444fd437d2b9c848baaa0518 100644
|
| --- a/components/user_prefs/tracked/tracked_preference_helper.cc
|
| +++ b/components/user_prefs/tracked/tracked_preference_helper.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/logging.h"
|
| #include "base/metrics/histogram.h"
|
| +#include "components/user_prefs/tracked/tracked_preference_histogram_names.h"
|
|
|
| TrackedPreferenceHelper::TrackedPreferenceHelper(
|
| const std::string& pref_path,
|
| @@ -23,16 +24,10 @@ TrackedPreferenceHelper::TrackedPreferenceHelper(
|
| TrackedPreferenceHelper::ResetAction TrackedPreferenceHelper::GetAction(
|
| PrefHashStoreTransaction::ValueState value_state) const {
|
| switch (value_state) {
|
| - case PrefHashStoreTransaction::UNCHANGED:
|
| - // Desired case, nothing to do.
|
| - return DONT_RESET;
|
| - case PrefHashStoreTransaction::CLEARED:
|
| - // Unfortunate case, but there is nothing we can do.
|
| - return DONT_RESET;
|
| + case PrefHashStoreTransaction::UNCHANGED: // Desired case, nothing to do.
|
| + case PrefHashStoreTransaction::CLEARED: // Unfortunate case, nothing to do.
|
| case PrefHashStoreTransaction::TRUSTED_NULL_VALUE: // Falls through.
|
| - case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE:
|
| - // It is okay to seed the hash in this case.
|
| - return DONT_RESET;
|
| + case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE: // Seed the hash.
|
| case PrefHashStoreTransaction::SECURE_LEGACY:
|
| // Accept secure legacy device ID based hashes.
|
| return DONT_RESET;
|
| @@ -53,33 +48,39 @@ void TrackedPreferenceHelper::ReportValidationResult(
|
| PrefHashStoreTransaction::ValueState value_state) const {
|
| switch (value_state) {
|
| case PrefHashStoreTransaction::UNCHANGED:
|
| - UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceUnchanged",
|
| - reporting_id_, reporting_ids_count_);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + tracked_pref_histogram_names::kTrackedPrefHistogramUnchanged,
|
| + reporting_id_, reporting_ids_count_);
|
| return;
|
| case PrefHashStoreTransaction::CLEARED:
|
| - UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceCleared",
|
| - reporting_id_, reporting_ids_count_);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + tracked_pref_histogram_names::kTrackedPrefHistogramCleared,
|
| + reporting_id_, reporting_ids_count_);
|
| return;
|
| case PrefHashStoreTransaction::SECURE_LEGACY:
|
| - UMA_HISTOGRAM_ENUMERATION(
|
| - "Settings.TrackedPreferenceMigratedLegacyDeviceId", reporting_id_,
|
| - reporting_ids_count_);
|
| + UMA_HISTOGRAM_ENUMERATION(tracked_pref_histogram_names::
|
| + kTrackedPrefHistogramMigratedLegacyDeviceId,
|
| + reporting_id_, reporting_ids_count_);
|
| return;
|
| case PrefHashStoreTransaction::CHANGED:
|
| - UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceChanged",
|
| - reporting_id_, reporting_ids_count_);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + tracked_pref_histogram_names::kTrackedPrefHistogramChanged,
|
| + reporting_id_, reporting_ids_count_);
|
| return;
|
| case PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE:
|
| - UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceInitialized",
|
| - reporting_id_, reporting_ids_count_);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + tracked_pref_histogram_names::kTrackedPrefHistogramInitialized,
|
| + reporting_id_, reporting_ids_count_);
|
| return;
|
| case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE:
|
| - UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceTrustedInitialized",
|
| - reporting_id_, reporting_ids_count_);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + tracked_pref_histogram_names::kTrackedPrefHistogramTrustedInitialized,
|
| + reporting_id_, reporting_ids_count_);
|
| return;
|
| case PrefHashStoreTransaction::TRUSTED_NULL_VALUE:
|
| - UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceNullInitialized",
|
| - reporting_id_, reporting_ids_count_);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + tracked_pref_histogram_names::kTrackedPrefHistogramNullInitialized,
|
| + reporting_id_, reporting_ids_count_);
|
| return;
|
| }
|
| NOTREACHED() << "Unexpected PrefHashStoreTransaction::ValueState: "
|
| @@ -92,12 +93,14 @@ void TrackedPreferenceHelper::ReportAction(ResetAction reset_action) const {
|
| // No report for DONT_RESET.
|
| break;
|
| case WANTED_RESET:
|
| - UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceWantedReset",
|
| - reporting_id_, reporting_ids_count_);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + tracked_pref_histogram_names::kTrackedPrefHistogramWantedReset,
|
| + reporting_id_, reporting_ids_count_);
|
| break;
|
| case DO_RESET:
|
| - UMA_HISTOGRAM_ENUMERATION("Settings.TrackedPreferenceReset",
|
| - reporting_id_, reporting_ids_count_);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + tracked_pref_histogram_names::kTrackedPrefHistogramReset,
|
| + reporting_id_, reporting_ids_count_);
|
| break;
|
| }
|
| }
|
| @@ -107,12 +110,11 @@ void TrackedPreferenceHelper::ReportSplitPreferenceChangedCount(
|
| // The histogram below is an expansion of the UMA_HISTOGRAM_COUNTS_100 macro
|
| // adapted to allow for a dynamically suffixed histogram name.
|
| // Note: The factory creates and owns the histogram.
|
| - base::HistogramBase* histogram =
|
| - base::LinearHistogram::FactoryGet(
|
| - "Settings.TrackedSplitPreferenceChanged." + pref_path_,
|
| - 1,
|
| - 100, // Allow counts up to 100.
|
| - 101,
|
| - base::HistogramBase::kUmaTargetedHistogramFlag);
|
| + base::HistogramBase* histogram = base::LinearHistogram::FactoryGet(
|
| + tracked_pref_histogram_names::kTrackedSplitPrefHistogramChanged +
|
| + pref_path_,
|
| + 1,
|
| + 100, // Allow counts up to 100.
|
| + 101, base::HistogramBase::kUmaTargetedHistogramFlag);
|
| histogram->Add(count);
|
| }
|
|
|