| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "chrome/browser/autofill/field_types.h" | 13 #include "chrome/browser/autofill/field_types.h" |
| 14 | 14 |
| 15 namespace base { |
| 16 class TimeDelta; |
| 17 } |
| 18 |
| 15 class AutofillMetrics { | 19 class AutofillMetrics { |
| 16 public: | 20 public: |
| 17 enum InfoBarMetric { | 21 enum InfoBarMetric { |
| 18 INFOBAR_SHOWN = 0, // We showed an infobar, e.g. prompting to save credit | 22 INFOBAR_SHOWN = 0, // We showed an infobar, e.g. prompting to save credit |
| 19 // card info. | 23 // card info. |
| 20 INFOBAR_ACCEPTED, // The user explicitly accepted the infobar. | 24 INFOBAR_ACCEPTED, // The user explicitly accepted the infobar. |
| 21 INFOBAR_DENIED, // The user explicitly denied the infobar. | 25 INFOBAR_DENIED, // The user explicitly denied the infobar. |
| 22 INFOBAR_IGNORED, // The user completely ignored the infobar (logged on | 26 INFOBAR_IGNORED, // The user completely ignored the infobar (logged on |
| 23 // tab close). | 27 // tab close). |
| 24 NUM_INFO_BAR_METRICS | 28 NUM_INFO_BAR_METRICS |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 USER_DID_AUTOFILL, | 113 USER_DID_AUTOFILL, |
| 110 // Same as above, but only logged once per page load. | 114 // Same as above, but only logged once per page load. |
| 111 USER_DID_AUTOFILL_ONCE, | 115 USER_DID_AUTOFILL_ONCE, |
| 112 // User edited a previously autofilled field. | 116 // User edited a previously autofilled field. |
| 113 USER_DID_EDIT_AUTOFILLED_FIELD, | 117 USER_DID_EDIT_AUTOFILLED_FIELD, |
| 114 // Same as above, but only logged once per page load. | 118 // Same as above, but only logged once per page load. |
| 115 USER_DID_EDIT_AUTOFILLED_FIELD_ONCE, | 119 USER_DID_EDIT_AUTOFILLED_FIELD_ONCE, |
| 116 NUM_USER_HAPPINESS_METRICS | 120 NUM_USER_HAPPINESS_METRICS |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 // TODO(isherman): Add histograms to measure time elapsed between form load | |
| 120 // form submission, comparing autofilled and non-autofilled forms. So that we | |
| 121 // are measuring apples to apples, restrict just to fillable forms. | |
| 122 | |
| 123 AutofillMetrics(); | 123 AutofillMetrics(); |
| 124 virtual ~AutofillMetrics(); | 124 virtual ~AutofillMetrics(); |
| 125 | 125 |
| 126 virtual void LogCreditCardInfoBarMetric(InfoBarMetric metric) const; | 126 virtual void LogCreditCardInfoBarMetric(InfoBarMetric metric) const; |
| 127 | 127 |
| 128 virtual void LogHeuristicTypePrediction( | 128 virtual void LogHeuristicTypePrediction( |
| 129 FieldTypeQualityMetric metric, | 129 FieldTypeQualityMetric metric, |
| 130 AutofillFieldType field_type, | 130 AutofillFieldType field_type, |
| 131 const std::string& experiment_id) const; | 131 const std::string& experiment_id) const; |
| 132 virtual void LogOverallTypePrediction( | 132 virtual void LogOverallTypePrediction( |
| 133 FieldTypeQualityMetric metric, | 133 FieldTypeQualityMetric metric, |
| 134 AutofillFieldType field_type, | 134 AutofillFieldType field_type, |
| 135 const std::string& experiment_id) const; | 135 const std::string& experiment_id) const; |
| 136 virtual void LogServerTypePrediction(FieldTypeQualityMetric metric, | 136 virtual void LogServerTypePrediction(FieldTypeQualityMetric metric, |
| 137 AutofillFieldType field_type, | 137 AutofillFieldType field_type, |
| 138 const std::string& experiment_id) const; | 138 const std::string& experiment_id) const; |
| 139 | 139 |
| 140 virtual void LogQualityMetric(QualityMetric metric, | 140 virtual void LogQualityMetric(QualityMetric metric, |
| 141 const std::string& experiment_id) const; | 141 const std::string& experiment_id) const; |
| 142 | 142 |
| 143 virtual void LogServerQueryMetric(ServerQueryMetric metric) const; | 143 virtual void LogServerQueryMetric(ServerQueryMetric metric) const; |
| 144 | 144 |
| 145 virtual void LogUserHappinessMetric(UserHappinessMetric metric) const; | 145 virtual void LogUserHappinessMetric(UserHappinessMetric metric) const; |
| 146 | 146 |
| 147 // This should be called when a form that has been Autofilled is submitted. |
| 148 // |duration| should be the time elapsed between form load and submission. |
| 149 virtual void LogFormFillDurationFromLoadWithAutofill( |
| 150 const base::TimeDelta& duration) const; |
| 151 |
| 152 // This should be called when a fillable form that has not been Autofilled is |
| 153 // submitted. |duration| should be the time elapsed between form load and |
| 154 // submission. |
| 155 virtual void LogFormFillDurationFromLoadWithoutAutofill( |
| 156 const base::TimeDelta& duration) const; |
| 157 |
| 158 // This should be called when a form that has been Autofilled is submitted. |
| 159 // |duration| should be the time elapsed between the initial form interaction |
| 160 // and submission. |
| 161 virtual void LogFormFillDurationFromInteractionWithAutofill( |
| 162 const base::TimeDelta& duration) const; |
| 163 |
| 164 // This should be called when a fillable form that has not been Autofilled is |
| 165 // submitted. |duration| should be the time elapsed between the initial form |
| 166 // interaction and submission. |
| 167 virtual void LogFormFillDurationFromInteractionWithoutAutofill( |
| 168 const base::TimeDelta& duration) const; |
| 147 | 169 |
| 148 // This should be called each time a page containing forms is loaded. | 170 // This should be called each time a page containing forms is loaded. |
| 149 virtual void LogIsAutofillEnabledAtPageLoad(bool enabled) const; | 171 virtual void LogIsAutofillEnabledAtPageLoad(bool enabled) const; |
| 150 | 172 |
| 151 // This should be called each time a new profile is launched. | 173 // This should be called each time a new profile is launched. |
| 152 virtual void LogIsAutofillEnabledAtStartup(bool enabled) const; | 174 virtual void LogIsAutofillEnabledAtStartup(bool enabled) const; |
| 153 | 175 |
| 154 // This should be called each time a new profile is launched. | 176 // This should be called each time a new profile is launched. |
| 155 virtual void LogStoredProfileCount(size_t num_profiles) const; | 177 virtual void LogStoredProfileCount(size_t num_profiles) const; |
| 156 | 178 |
| 157 // Log the number of Autofill suggestions presented to the user when filling a | 179 // Log the number of Autofill suggestions presented to the user when filling a |
| 158 // form. | 180 // form. |
| 159 virtual void LogAddressSuggestionsCount(size_t num_suggestions) const; | 181 virtual void LogAddressSuggestionsCount(size_t num_suggestions) const; |
| 160 | 182 |
| 161 // Logs the experiment id corresponding to a server query response. | 183 // Logs the experiment id corresponding to a server query response. |
| 162 virtual void LogServerExperimentIdForQuery( | 184 virtual void LogServerExperimentIdForQuery( |
| 163 const std::string& experiment_id) const; | 185 const std::string& experiment_id) const; |
| 164 | 186 |
| 165 // Logs the experiment id corresponding to an upload to the server. | 187 // Logs the experiment id corresponding to an upload to the server. |
| 166 virtual void LogServerExperimentIdForUpload( | 188 virtual void LogServerExperimentIdForUpload( |
| 167 const std::string& experiment_id) const; | 189 const std::string& experiment_id) const; |
| 168 | 190 |
| 169 private: | 191 private: |
| 170 DISALLOW_COPY_AND_ASSIGN(AutofillMetrics); | 192 DISALLOW_COPY_AND_ASSIGN(AutofillMetrics); |
| 171 }; | 193 }; |
| 172 | 194 |
| 173 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ | 195 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ |
| OLD | NEW |