diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 01:39:08 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 01:39:08 +0000 |
commit | 2a8b3d869a06780d70f2697e9ccab877d370d822 (patch) | |
tree | 50732699a2f7ac7020ce3092584b6700109acd73 /components | |
parent | fe1cd1a4beb8b97ca6aee011acaf276cd39b4fb4 (diff) | |
download | chromium_src-2a8b3d869a06780d70f2697e9ccab877d370d822.zip chromium_src-2a8b3d869a06780d70f2697e9ccab877d370d822.tar.gz chromium_src-2a8b3d869a06780d70f2697e9ccab877d370d822.tar.bz2 |
[Autofill] Clean up requestAutocomplete metrics code a bit.
* Use a less verbose method name.
* Decompose out a helper function to get the "Autocheckout"
vs. "requestAutocomplete" prefix.
BUG=165570
Review URL: https://chromiumcodereview.appspot.com/12529010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187740 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/autofill/browser/autofill_metrics.cc | 27 | ||||
-rw-r--r-- | components/autofill/browser/autofill_metrics.h | 12 |
2 files changed, 22 insertions, 17 deletions
diff --git a/components/autofill/browser/autofill_metrics.cc b/components/autofill/browser/autofill_metrics.cc index d0f0e37..424cbdc 100644 --- a/components/autofill/browser/autofill_metrics.cc +++ b/components/autofill/browser/autofill_metrics.cc @@ -155,6 +155,20 @@ int GetFieldTypeGroupMetric(const AutofillFieldType field_type, return (group * num_possible_metrics) + metric; } +// Returns the histogram prefix to use for reporting metrics for |dialog_type|. +std::string GetPrefixForDialogType(autofill::DialogType dialog_type) { + switch (dialog_type) { + case autofill::DIALOG_TYPE_AUTOCHECKOUT: + return "Autocheckout"; + + case autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE: + return "RequestAutocomplete"; + } + + NOTREACHED(); + return "UnknownDialogType"; +} + // A version of the UMA_HISTOGRAM_ENUMERATION macro that allows the |name| // to vary over the program's runtime. void LogUMAHistogramEnumeration(const std::string& name, @@ -282,20 +296,11 @@ void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric) const { NUM_INFO_BAR_METRICS); } -void AutofillMetrics::LogRequestAutocompleteUiDuration( +void AutofillMetrics::LogDialogUiDuration( 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 prefix = GetPrefixForDialogType(dialog_type); std::string suffix; switch (dismissal_action) { diff --git a/components/autofill/browser/autofill_metrics.h b/components/autofill/browser/autofill_metrics.h index 36453b9..e2d05a6 100644 --- a/components/autofill/browser/autofill_metrics.h +++ b/components/autofill/browser/autofill_metrics.h @@ -183,12 +183,12 @@ class AutofillMetrics { virtual void LogUserHappinessMetric(UserHappinessMetric metric) const; - // This should be called when the requestAutocomplete dialog, invoked by the - // |requester|, is closed. |duration| should be the time elapsed between the - // dialog being shown and it being closed. |dismissal_action| should indicate - // whether the user dismissed the dialog by submitting the form data or by - // cancelling. - virtual void LogRequestAutocompleteUiDuration( + // This should be called when the requestAutocomplete dialog, invoked by a + // dialog of type |dialog_type|, is closed. |duration| should be the time + // elapsed between the dialog being shown and it being closed. + // |dismissal_action| should indicate whether the user dismissed the dialog by + // submitting the form data or by canceling. + virtual void LogDialogUiDuration( const base::TimeDelta& duration, autofill::DialogType dialog_type, DialogDismissalAction dismissal_action) const; |