| Index: components/autofill/core/browser/autofill_metrics.h
|
| diff --git a/components/autofill/core/browser/autofill_metrics.h b/components/autofill/core/browser/autofill_metrics.h
|
| index 92539ba77a68ecf710118bcbc385cd717ee9711c..2c199ebdbb8beee7871cffead8ec9175a0b1718c 100644
|
| --- a/components/autofill/core/browser/autofill_metrics.h
|
| +++ b/components/autofill/core/browser/autofill_metrics.h
|
| @@ -243,6 +243,19 @@ class AutofillMetrics {
|
| NUM_USER_HAPPINESS_METRICS,
|
| };
|
|
|
| + // Form Events for autofill.
|
| + // These events are triggered separetly for address and credit card forms.
|
| + enum AutofillFormEvent {
|
| + // User interacted with a field of this kind of form. Logged only once per
|
| + // page load.
|
| + // TODO(waltercacau): All histograms here seem to start with 0,
|
| + // but the histogram code seems to expect a minimum of 1. Strangely,
|
| + // they seem to succeed all the assertions as long as there is more then
|
| + // one enum value.
|
| + INTERACTED_ONCE = 1,
|
| + NUM_AUTOFILL_FORM_EVENTS,
|
| + };
|
| +
|
| // For measuring the network request time of various Wallet API calls. See
|
| // WalletClient::RequestType.
|
| enum WalletApiCallMetric {
|
| @@ -415,6 +428,31 @@ class AutofillMetrics {
|
| // form.
|
| static void LogAddressSuggestionsCount(size_t num_suggestions);
|
|
|
| + // Utility to autofill form events in the relevant histograms depending on
|
| + // the presence of server and/or local data.
|
| + class FormEventLogger {
|
| + public:
|
| + FormEventLogger(bool is_credit_card);
|
| +
|
| + // Sets if server data is available or not. If not called assumed false.
|
| + void set_is_server_data_available(bool is_server_data_available);
|
| +
|
| + // Sets if server data is available or not. If not called assumed false.
|
| + void set_is_local_data_available(bool is_local_data_available);
|
| +
|
| + // Should be called when the user interacted with an autofillable form.
|
| + void OnDidInteractWithAutofillableForm();
|
| +
|
| + private:
|
| + // Logs a form event.
|
| + void Log(AutofillFormEvent event) const;
|
| +
|
| + bool is_credit_card_;
|
| + bool is_server_data_available_;
|
| + bool is_local_data_available_;
|
| + bool has_logged_interacted_;
|
| + };
|
| +
|
| private:
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics);
|
| };
|
|
|