| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/autofill/core/browser/autofill_client.h" | 12 #include "components/autofill/core/browser/autofill_client.h" |
| 13 #include "components/autofill/core/browser/autofill_profile.h" | 13 #include "components/autofill/core/browser/autofill_profile.h" |
| 14 #include "components/autofill/core/browser/credit_card.h" | 14 #include "components/autofill/core/browser/credit_card.h" |
| 15 #include "components/autofill/core/browser/field_types.h" | 15 #include "components/autofill/core/browser/field_types.h" |
| 16 #include "components/autofill/core/common/form_field_data.h" | 16 #include "components/autofill/core/common/form_field_data.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class TimeDelta; | 19 class TimeDelta; |
| 20 } // namespace base | 20 } // namespace base |
| 21 | 21 |
| 22 namespace ukm { | 22 namespace ukm { |
| 23 class UkmService; | 23 class UkmService; |
| 24 } // namespace ukm | 24 } // namespace ukm |
| 25 | 25 |
| 26 namespace internal { | 26 namespace internal { |
| 27 // Name constants are exposed here so they can be referenced from tests. | 27 // Name constants are exposed here so they can be referenced from tests. |
| 28 extern const char kUKMCardUploadDecisionEntryName[]; | 28 extern const char kUKMCardUploadDecisionEntryName[]; |
| 29 extern const char kUKMCardUploadDecisionMetricName[]; | 29 extern const char kUKMCardUploadDecisionMetricName[]; |
| 30 extern const char kUKMDeveloperEngagementEntryName[]; |
| 31 extern const char kUKMDeveloperEngagementMetricName[]; |
| 30 } // namespace internal | 32 } // namespace internal |
| 31 | 33 |
| 32 namespace autofill { | 34 namespace autofill { |
| 33 | 35 |
| 34 class AutofillMetrics { | 36 class AutofillMetrics { |
| 35 public: | 37 public: |
| 36 enum AutofillProfileAction { | 38 enum AutofillProfileAction { |
| 37 EXISTING_PROFILE_USED, | 39 EXISTING_PROFILE_USED, |
| 38 EXISTING_PROFILE_UPDATED, | 40 EXISTING_PROFILE_UPDATED, |
| 39 NEW_PROFILE_CREATED, | 41 NEW_PROFILE_CREATED, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED, | 79 UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED, |
| 78 // A CVC and one or more addresses were available but the names on the card | 80 // A CVC and one or more addresses were available but the names on the card |
| 79 // and/or the addresses didn't match. We don't know whether the address(es) | 81 // and/or the addresses didn't match. We don't know whether the address(es) |
| 80 // were otherwise valid nor whether we would have been able to get upload | 82 // were otherwise valid nor whether we would have been able to get upload |
| 81 // details. | 83 // details. |
| 82 UPLOAD_NOT_OFFERED_CONFLICTING_NAMES, | 84 UPLOAD_NOT_OFFERED_CONFLICTING_NAMES, |
| 83 NUM_CARD_UPLOAD_DECISION_METRICS, | 85 NUM_CARD_UPLOAD_DECISION_METRICS, |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 enum DeveloperEngagementMetric { | 88 enum DeveloperEngagementMetric { |
| 87 // Parsed a form that is potentially autofillable. | 89 // Parsed a form that is potentially autofillable and does not contain any |
| 88 FILLABLE_FORM_PARSED = 0, | 90 // web developer-specified field type hint. |
| 91 FILLABLE_FORM_PARSED_WITHOUT_TYPE_HINTS = 0, |
| 89 // Parsed a form that is potentially autofillable and contains at least one | 92 // Parsed a form that is potentially autofillable and contains at least one |
| 90 // web developer-specified field type hint, a la | 93 // web developer-specified field type hint, a la |
| 91 // http://is.gd/whatwg_autocomplete | 94 // http://is.gd/whatwg_autocomplete |
| 92 FILLABLE_FORM_CONTAINS_TYPE_HINTS, | 95 FILLABLE_FORM_PARSED_WITH_TYPE_HINTS, |
| 93 // Parsed a form that is potentially autofillable and contains at least one | 96 // Parsed a form that is potentially autofillable and contains at least one |
| 94 // UPI Virtual Payment Address hint (upi-vpa) | 97 // UPI Virtual Payment Address hint (upi-vpa) |
| 95 FORM_CONTAINS_UPI_VPA_HINT, | 98 FORM_CONTAINS_UPI_VPA_HINT, |
| 96 NUM_DEVELOPER_ENGAGEMENT_METRICS, | 99 NUM_DEVELOPER_ENGAGEMENT_METRICS, |
| 97 }; | 100 }; |
| 98 | 101 |
| 99 // The action the user took to dismiss a dialog. | 102 // The action the user took to dismiss a dialog. |
| 100 enum DialogDismissalAction { | 103 enum DialogDismissalAction { |
| 101 DIALOG_ACCEPTED = 0, // The user accepted, i.e. submitted, the dialog. | 104 DIALOG_ACCEPTED = 0, // The user accepted, i.e. submitted, the dialog. |
| 102 DIALOG_CANCELED, // The user canceled out of the dialog. | 105 DIALOG_CANCELED, // The user canceled out of the dialog. |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 // suggestion to show an explanation of the warning. | 696 // suggestion to show an explanation of the warning. |
| 694 static void LogShowedHttpNotSecureExplanation(); | 697 static void LogShowedHttpNotSecureExplanation(); |
| 695 | 698 |
| 696 // Logs the card upload decision ukm based on the specified |url| and | 699 // Logs the card upload decision ukm based on the specified |url| and |
| 697 // |upload_decision|. | 700 // |upload_decision|. |
| 698 static void LogCardUploadDecisionUkm( | 701 static void LogCardUploadDecisionUkm( |
| 699 ukm::UkmService* ukm_service, | 702 ukm::UkmService* ukm_service, |
| 700 const GURL& url, | 703 const GURL& url, |
| 701 AutofillMetrics::CardUploadDecisionMetric upload_decision); | 704 AutofillMetrics::CardUploadDecisionMetric upload_decision); |
| 702 | 705 |
| 706 // Logs the developer engagement ukm for the specified |url| and autofill |
| 707 // fields in the form structure. |
| 708 static void LogDeveloperEngagementUkm( |
| 709 ukm::UkmService* ukm_service, |
| 710 const GURL& url, |
| 711 AutofillMetrics::DeveloperEngagementMetric metric); |
| 712 |
| 703 // Logs the the |ukm_entry_name| with the specified |url| and the specified | 713 // Logs the the |ukm_entry_name| with the specified |url| and the specified |
| 704 // |metrics|. Returns whether the ukm was sucessfully logged. | 714 // |metrics|. Returns whether the ukm was sucessfully logged. |
| 705 static bool LogUkm(ukm::UkmService* ukm_service, | 715 static bool LogUkm(ukm::UkmService* ukm_service, |
| 706 const GURL& url, | 716 const GURL& url, |
| 707 const std::string& ukm_entry_name, | 717 const std::string& ukm_entry_name, |
| 708 const std::map<std::string, int>& metrics); | 718 const std::map<std::string, int>& metrics); |
| 709 | 719 |
| 710 // Utility to autofill form events in the relevant histograms depending on | 720 // Utility to autofill form events in the relevant histograms depending on |
| 711 // the presence of server and/or local data. | 721 // the presence of server and/or local data. |
| 712 class FormEventLogger { | 722 class FormEventLogger { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 FormFieldData last_polled_field_; | 773 FormFieldData last_polled_field_; |
| 764 }; | 774 }; |
| 765 | 775 |
| 766 private: | 776 private: |
| 767 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); | 777 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); |
| 768 }; | 778 }; |
| 769 | 779 |
| 770 } // namespace autofill | 780 } // namespace autofill |
| 771 | 781 |
| 772 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 782 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
| OLD | NEW |