Chromium Code Reviews| 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 } | 20 } // namespace base |
| 21 | |
| 22 namespace ukm { | |
| 23 class UkmService; | |
| 24 } // namespace ukm | |
| 25 | |
| 26 namespace internal { | |
| 27 // Name constants are exposed here so they can be referenced from tests. | |
| 28 extern const char kUKMCardUploadDecisionEntryName[]; | |
| 29 extern const char kUKMCardUploadDecisionMetricName[]; | |
| 30 } // namespace internal | |
| 21 | 31 |
| 22 namespace autofill { | 32 namespace autofill { |
| 23 | 33 |
| 24 class AutofillMetrics { | 34 class AutofillMetrics { |
| 25 public: | 35 public: |
| 26 enum AutofillProfileAction { | 36 enum AutofillProfileAction { |
| 27 EXISTING_PROFILE_USED, | 37 EXISTING_PROFILE_USED, |
| 28 EXISTING_PROFILE_UPDATED, | 38 EXISTING_PROFILE_UPDATED, |
| 29 NEW_PROFILE_CREATED, | 39 NEW_PROFILE_CREATED, |
| 30 AUTOFILL_PROFILE_ACTION_ENUM_SIZE, | 40 AUTOFILL_PROFILE_ACTION_ENUM_SIZE, |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 673 static void LogIsQueriedCreditCardFormSecure(bool is_secure); | 683 static void LogIsQueriedCreditCardFormSecure(bool is_secure); |
| 674 | 684 |
| 675 // Log how the converted wallet address was added to the local autofill | 685 // Log how the converted wallet address was added to the local autofill |
| 676 // profiles. | 686 // profiles. |
| 677 static void LogWalletAddressConversionType(WalletAddressConversionType type); | 687 static void LogWalletAddressConversionType(WalletAddressConversionType type); |
| 678 | 688 |
| 679 // This should be called when the user selects the Form-Not-Secure warning | 689 // This should be called when the user selects the Form-Not-Secure warning |
| 680 // suggestion to show an explanation of the warning. | 690 // suggestion to show an explanation of the warning. |
| 681 static void LogShowedHttpNotSecureExplanation(); | 691 static void LogShowedHttpNotSecureExplanation(); |
| 682 | 692 |
| 693 // Logs the card upload decision ukm based on the specified |url| and | |
| 694 // |upload_decision|. | |
| 695 static void LogCardUploadDecisionMetricUkm( | |
| 696 ukm::UkmService* ukm_service, | |
| 697 const GURL& url, | |
| 698 AutofillMetrics::CardUploadDecisionMetric upload_decision); | |
| 699 | |
| 700 // Logs the the |ukm| with the specified |url| and the specified |metrics|. | |
|
rkaplow
2017/03/10 19:00:27
ukm as as a string isn't super clear. Ukm Entry?
sebsg
2017/03/10 19:25:33
Done.
rkaplow
2017/03/10 20:26:16
please adjust the comment too
sebsg
2017/03/10 20:38:07
Done.
| |
| 701 // Returns whether the ukm was sucessfully logged. | |
| 702 static bool LogUkm(ukm::UkmService* ukm_service, | |
| 703 const GURL& url, | |
| 704 const std::string& ukm, | |
| 705 const std::map<std::string, int>& metrics); | |
| 706 | |
| 683 // Utility to autofill form events in the relevant histograms depending on | 707 // Utility to autofill form events in the relevant histograms depending on |
| 684 // the presence of server and/or local data. | 708 // the presence of server and/or local data. |
| 685 class FormEventLogger { | 709 class FormEventLogger { |
| 686 public: | 710 public: |
| 687 FormEventLogger(bool is_for_credit_card); | 711 FormEventLogger(bool is_for_credit_card); |
| 688 | 712 |
| 689 inline void set_is_server_data_available(bool is_server_data_available) { | 713 inline void set_is_server_data_available(bool is_server_data_available) { |
| 690 is_server_data_available_ = is_server_data_available; | 714 is_server_data_available_ = is_server_data_available; |
| 691 } | 715 } |
| 692 | 716 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 FormFieldData last_polled_field_; | 760 FormFieldData last_polled_field_; |
| 737 }; | 761 }; |
| 738 | 762 |
| 739 private: | 763 private: |
| 740 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); | 764 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); |
| 741 }; | 765 }; |
| 742 | 766 |
| 743 } // namespace autofill | 767 } // namespace autofill |
| 744 | 768 |
| 745 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 769 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
| OLD | NEW |