| 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 #include <utility> |
| 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "components/autofill/core/browser/autofill_client.h" | 14 #include "components/autofill/core/browser/autofill_client.h" |
| 13 #include "components/autofill/core/browser/autofill_profile.h" | 15 #include "components/autofill/core/browser/autofill_profile.h" |
| 14 #include "components/autofill/core/browser/credit_card.h" | 16 #include "components/autofill/core/browser/credit_card.h" |
| 15 #include "components/autofill/core/browser/field_types.h" | 17 #include "components/autofill/core/browser/field_types.h" |
| 16 #include "components/autofill/core/common/form_field_data.h" | 18 #include "components/autofill/core/common/form_field_data.h" |
| 17 | 19 |
| 18 namespace base { | 20 namespace base { |
| 19 class TimeDelta; | 21 class TimeDelta; |
| 20 } // namespace base | 22 } // namespace base |
| 21 | 23 |
| 22 namespace ukm { | 24 namespace ukm { |
| 23 class UkmService; | 25 class UkmService; |
| 24 } // namespace ukm | 26 } // namespace ukm |
| 25 | 27 |
| 26 namespace internal { | 28 namespace internal { |
| 27 // Name constants are exposed here so they can be referenced from tests. | 29 // Name constants are exposed here so they can be referenced from tests. |
| 28 extern const char kUKMCardUploadDecisionEntryName[]; | 30 extern const char kUKMCardUploadDecisionEntryName[]; |
| 29 extern const char kUKMCardUploadDecisionMetricName[]; | 31 extern const char kUKMCardUploadDecisionMetricName[]; |
| 32 extern const char kUKMDeveloperEngagementEntryName[]; |
| 33 extern const char kUKMDeveloperEngagementMetricName[]; |
| 30 } // namespace internal | 34 } // namespace internal |
| 31 | 35 |
| 32 namespace autofill { | 36 namespace autofill { |
| 33 | 37 |
| 34 class AutofillMetrics { | 38 class AutofillMetrics { |
| 35 public: | 39 public: |
| 36 enum AutofillProfileAction { | 40 enum AutofillProfileAction { |
| 37 EXISTING_PROFILE_USED, | 41 EXISTING_PROFILE_USED, |
| 38 EXISTING_PROFILE_UPDATED, | 42 EXISTING_PROFILE_UPDATED, |
| 39 NEW_PROFILE_CREATED, | 43 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. | 694 // suggestion to show an explanation of the warning. |
| 691 static void LogShowedHttpNotSecureExplanation(); | 695 static void LogShowedHttpNotSecureExplanation(); |
| 692 | 696 |
| 693 // Logs the card upload decision ukm based on the specified |url| and | 697 // Logs the card upload decision ukm based on the specified |url| and |
| 694 // |upload_decision|. | 698 // |upload_decision|. |
| 695 static void LogCardUploadDecisionUkm( | 699 static void LogCardUploadDecisionUkm( |
| 696 ukm::UkmService* ukm_service, | 700 ukm::UkmService* ukm_service, |
| 697 const GURL& url, | 701 const GURL& url, |
| 698 AutofillMetrics::CardUploadDecisionMetric upload_decision); | 702 AutofillMetrics::CardUploadDecisionMetric upload_decision); |
| 699 | 703 |
| 704 // Logs the developer engagement ukm for the specified |url| and autofill |
| 705 // fields in the form structure. |
| 706 static void LogDeveloperEngagementUkm( |
| 707 ukm::UkmService* ukm_service, |
| 708 const GURL& url, |
| 709 const std::vector<AutofillMetrics::DeveloperEngagementMetric>& metrics); |
| 710 |
| 700 // Logs the the |ukm_entry_name| with the specified |url| and the specified | 711 // Logs the the |ukm_entry_name| with the specified |url| and the specified |
| 701 // |metrics|. Returns whether the ukm was sucessfully logged. | 712 // |metrics|. Returns whether the ukm was sucessfully logged. |
| 702 static bool LogUkm(ukm::UkmService* ukm_service, | 713 static bool LogUkm(ukm::UkmService* ukm_service, |
| 703 const GURL& url, | 714 const GURL& url, |
| 704 const std::string& ukm_entry_name, | 715 const std::string& ukm_entry_name, |
| 705 const std::map<std::string, int>& metrics); | 716 const std::vector<std::pair<const char*, int>>& metrics); |
| 706 | 717 |
| 707 // Utility to autofill form events in the relevant histograms depending on | 718 // Utility to autofill form events in the relevant histograms depending on |
| 708 // the presence of server and/or local data. | 719 // the presence of server and/or local data. |
| 709 class FormEventLogger { | 720 class FormEventLogger { |
| 710 public: | 721 public: |
| 711 FormEventLogger(bool is_for_credit_card); | 722 FormEventLogger(bool is_for_credit_card); |
| 712 | 723 |
| 713 inline void set_is_server_data_available(bool is_server_data_available) { | 724 inline void set_is_server_data_available(bool is_server_data_available) { |
| 714 is_server_data_available_ = is_server_data_available; | 725 is_server_data_available_ = is_server_data_available; |
| 715 } | 726 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 FormFieldData last_polled_field_; | 771 FormFieldData last_polled_field_; |
| 761 }; | 772 }; |
| 762 | 773 |
| 763 private: | 774 private: |
| 764 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); | 775 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); |
| 765 }; | 776 }; |
| 766 | 777 |
| 767 } // namespace autofill | 778 } // namespace autofill |
| 768 | 779 |
| 769 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 780 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
| OLD | NEW |