| 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 // suggestion to show an explanation of the warning. | 692 // suggestion to show an explanation of the warning. |
| 691 static void LogShowedHttpNotSecureExplanation(); | 693 static void LogShowedHttpNotSecureExplanation(); |
| 692 | 694 |
| 693 // Logs the card upload decision ukm based on the specified |url| and | 695 // Logs the card upload decision ukm based on the specified |url| and |
| 694 // |upload_decision|. | 696 // |upload_decision|. |
| 695 static void LogCardUploadDecisionUkm( | 697 static void LogCardUploadDecisionUkm( |
| 696 ukm::UkmService* ukm_service, | 698 ukm::UkmService* ukm_service, |
| 697 const GURL& url, | 699 const GURL& url, |
| 698 AutofillMetrics::CardUploadDecisionMetric upload_decision); | 700 AutofillMetrics::CardUploadDecisionMetric upload_decision); |
| 699 | 701 |
| 702 // Logs the developer engagement ukm for the specified |url| and autofill |
| 703 // fields in the form structure. |
| 704 static void LogDeveloperEngagementUkm( |
| 705 ukm::UkmService* ukm_service, |
| 706 const GURL& url, |
| 707 AutofillMetrics::DeveloperEngagementMetric form_structure_metric); |
| 708 |
| 700 // Logs the the |ukm_entry_name| with the specified |url| and the specified | 709 // Logs the the |ukm_entry_name| with the specified |url| and the specified |
| 701 // |metrics|. Returns whether the ukm was sucessfully logged. | 710 // |metrics|. Returns whether the ukm was sucessfully logged. |
| 702 static bool LogUkm(ukm::UkmService* ukm_service, | 711 static bool LogUkm(ukm::UkmService* ukm_service, |
| 703 const GURL& url, | 712 const GURL& url, |
| 704 const std::string& ukm_entry_name, | 713 const std::string& ukm_entry_name, |
| 705 const std::map<std::string, int>& metrics); | 714 const std::map<std::string, int>& metrics); |
| 706 | 715 |
| 707 // Utility to autofill form events in the relevant histograms depending on | 716 // Utility to autofill form events in the relevant histograms depending on |
| 708 // the presence of server and/or local data. | 717 // the presence of server and/or local data. |
| 709 class FormEventLogger { | 718 class FormEventLogger { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 FormFieldData last_polled_field_; | 769 FormFieldData last_polled_field_; |
| 761 }; | 770 }; |
| 762 | 771 |
| 763 private: | 772 private: |
| 764 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); | 773 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); |
| 765 }; | 774 }; |
| 766 | 775 |
| 767 } // namespace autofill | 776 } // namespace autofill |
| 768 | 777 |
| 769 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 778 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
| OLD | NEW |