| Index: chrome/browser/autofill/autofill_metrics.cc
|
| diff --git a/chrome/browser/autofill/autofill_metrics.cc b/chrome/browser/autofill/autofill_metrics.cc
|
| index 6af361cd82f3a8b8dd7dcd90c9613bbc31a9bace..c8bbbd953072c617ed7e493f7b9c1f1e68427654 100644
|
| --- a/chrome/browser/autofill/autofill_metrics.cc
|
| +++ b/chrome/browser/autofill/autofill_metrics.cc
|
| @@ -160,17 +160,30 @@ int GetFieldTypeGroupMetric(const AutofillFieldType field_type,
|
| void LogUMAHistogramEnumeration(const std::string& name,
|
| int sample,
|
| int boundary_value) {
|
| - // We can't use the UMA_HISTOGRAM_ENUMERATION macro here because the histogram
|
| - // name can vary over the duration of the program.
|
| - // Note that this leaks memory; that is expected behavior.
|
| - base::HistogramBase* counter =
|
| + // Note: This leaks memory, which is expected behavior.
|
| + base::HistogramBase* histogram =
|
| base::LinearHistogram::FactoryGet(
|
| name,
|
| 1,
|
| boundary_value,
|
| boundary_value + 1,
|
| base::HistogramBase::kUmaTargetedHistogramFlag);
|
| - counter->Add(sample);
|
| + histogram->Add(sample);
|
| +}
|
| +
|
| +// A version of the UMA_HISTOGRAM_LONG_TIMES macro that allows the |name|
|
| +// to vary over the program's runtime.
|
| +void LogUMAHistogramLongTimes(const std::string& name,
|
| + const base::TimeDelta& duration) {
|
| + // Note: This leaks memory, which is expected behavior.
|
| + base::HistogramBase* histogram =
|
| + base::Histogram::FactoryTimeGet(
|
| + name,
|
| + base::TimeDelta::FromMilliseconds(1),
|
| + base::TimeDelta::FromHours(1),
|
| + 50,
|
| + base::HistogramBase::kUmaTargetedHistogramFlag);
|
| + histogram->AddTime(duration);
|
| }
|
|
|
| // Logs a type quality metric. The primary histogram name is constructed based
|
| @@ -268,6 +281,36 @@ void AutofillMetrics::LogAutocheckoutInfoBarMetric(InfoBarMetric metric) const {
|
| NUM_INFO_BAR_METRICS);
|
| }
|
|
|
| +void AutofillMetrics::LogRequestAutocompleteUiDuration(
|
| + const base::TimeDelta& duration,
|
| + autofill::DialogType dialog_type,
|
| + DialogDismissalAction dismissal_action) const {
|
| + std::string prefix;
|
| + switch (dialog_type) {
|
| + case autofill::DIALOG_TYPE_AUTOCHECKOUT:
|
| + prefix = "Autocheckout";
|
| + break;
|
| +
|
| + case autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE:
|
| + prefix = "RequestAutocomplete";
|
| + break;
|
| + }
|
| +
|
| + std::string suffix;
|
| + switch (dismissal_action) {
|
| + case DIALOG_ACCEPTED:
|
| + suffix = "Submit";
|
| + break;
|
| +
|
| + case DIALOG_CANCELED:
|
| + suffix = "Cancel";
|
| + break;
|
| + }
|
| +
|
| + LogUMAHistogramLongTimes(prefix + ".UiDuration", duration);
|
| + LogUMAHistogramLongTimes(prefix + ".UiDuration." + suffix, duration);
|
| +}
|
| +
|
| void AutofillMetrics::LogDeveloperEngagementMetric(
|
| DeveloperEngagementMetric metric) const {
|
| DCHECK(metric < NUM_DEVELOPER_ENGAGEMENT_METRICS);
|
|
|