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 #include <utility> | 10 #include <utility> |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 | 31 |
| 32 // Each form interaction event has a separate |UkmEntry|. | 32 // Each form interaction event has a separate |UkmEntry|. |
| 33 | 33 |
| 34 // The first form event |UkmEntry| contains metrics for metadata that apply | 34 // The first form event |UkmEntry| contains metrics for metadata that apply |
| 35 // to all subsequent events. | 35 // to all subsequent events. |
| 36 extern const char kUKMInteractedWithFormEntryName[]; | 36 extern const char kUKMInteractedWithFormEntryName[]; |
| 37 extern const char kUKMIsForCreditCardMetricName[]; | 37 extern const char kUKMIsForCreditCardMetricName[]; |
| 38 extern const char kUKMLocalRecordTypeCountMetricName[]; | 38 extern const char kUKMLocalRecordTypeCountMetricName[]; |
| 39 extern const char kUKMServerRecordTypeCountMetricName[]; | 39 extern const char kUKMServerRecordTypeCountMetricName[]; |
| 40 | 40 |
| 41 // |UkmEntry| when user polls suggestions. Metrics for field type. | |
|
csashi
2017/04/27 18:41:17
Can we not add the metrics to "Suggestions shown"
jiahuiguo
2017/05/24 18:00:00
Done.
| |
| 42 extern const char kUKMPollSuggestionsEntryName[]; | |
| 43 extern const char kUKMHeuristicTypeMetricName[]; | |
| 44 extern const char kUKMHtmlFieldTypeMetricName[]; | |
| 45 extern const char kUKMServerTypeMetricName[]; | |
| 46 | |
| 41 // |UkmEntry| when we show suggestions. | 47 // |UkmEntry| when we show suggestions. |
| 42 extern const char kUKMSuggestionsShownEntryName[]; | 48 extern const char kUKMSuggestionsShownEntryName[]; |
| 43 | 49 |
| 44 // |UkmEntry| when user selects a masked server credit card. | 50 // |UkmEntry| when user selects a masked server credit card. |
| 45 extern const char kUKMSelectedMaskedServerCardEntryName[]; | 51 extern const char kUKMSelectedMaskedServerCardEntryName[]; |
| 46 | 52 |
| 47 // Each |UkmEntry|, except the first interaction with the form, has a metric for | 53 // Each |UkmEntry|, except the first interaction with the form, has a metric for |
| 48 // time elapsed, in milliseconds, since we loaded the form. | 54 // time elapsed, in milliseconds, since we loaded the form. |
| 49 extern const char kUKMMillisecondsSinceFormLoadedMetricName[]; | 55 extern const char kUKMMillisecondsSinceFormLoadedMetricName[]; |
| 50 | 56 |
| 51 // |FormEvent| for FORM_EVENT_*_SUGGESTION_FILLED in credit card forms include a | 57 // |FormEvent| for FORM_EVENT_*_SUGGESTION_FILLED in credit card forms include a |
| 52 // |CreditCard| |record_type()| to indicate if the suggestion was for a local | 58 // |CreditCard| |record_type()| to indicate if the suggestion was for a local |
| 53 // card, masked server card or full server card. Similarly, address/profile | 59 // card, masked server card or full server card. Similarly, address/profile |
| 54 // forms include a |AutofillProfile| |record_type()| to indicate if the | 60 // forms include a |AutofillProfile| |record_type()| to indicate if the |
| 55 // profile was a local profile or server profile. | 61 // profile was a local profile or server profile. |
| 56 extern const char kUKMSuggestionFilledEntryName[]; | 62 extern const char kUKMSuggestionFilledEntryName[]; |
| 57 extern const char kUKMRecordTypeMetricName[]; | 63 extern const char kUKMRecordTypeMetricName[]; |
| 58 | 64 |
| 59 // |UkmEntry| for user editing text field. Metrics contain field's attributes. | 65 // |UkmEntry| for user editing text field. Metrics contain field's attributes. |
| 60 extern const char kUKMTextFieldDidChangeEntryName[]; | 66 extern const char kUKMTextFieldDidChangeEntryName[]; |
| 61 extern const char kUKMFieldTypeGroupMetricName[]; | 67 extern const char kUKMFieldTypeGroupMetricName[]; |
| 62 extern const char kUKMHeuristicTypeMetricName[]; | |
| 63 extern const char kUKMServerTypeMetricName[]; | |
| 64 extern const char kUKMHtmlFieldTypeMetricName[]; | |
| 65 extern const char kUKMHtmlFieldModeMetricName[]; | 68 extern const char kUKMHtmlFieldModeMetricName[]; |
| 66 extern const char kUKMIsAutofilledMetricName[]; | 69 extern const char kUKMIsAutofilledMetricName[]; |
| 67 extern const char kUKMIsEmptyMetricName[]; | 70 extern const char kUKMIsEmptyMetricName[]; |
| 68 | 71 |
| 69 // |UkmEntry| for |AutofillFormSubmittedState|. | 72 // |UkmEntry| for |AutofillFormSubmittedState|. |
| 70 extern const char kUKMFormSubmittedEntryName[]; | 73 extern const char kUKMFormSubmittedEntryName[]; |
| 71 extern const char kUKMAutofillFormSubmittedStateMetricName[]; | 74 extern const char kUKMAutofillFormSubmittedStateMetricName[]; |
| 72 } // namespace internal | 75 } // namespace internal |
| 73 | 76 |
| 74 namespace autofill { | 77 namespace autofill { |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 class FormInteractionsUkmLogger { | 618 class FormInteractionsUkmLogger { |
| 616 public: | 619 public: |
| 617 explicit FormInteractionsUkmLogger(ukm::UkmService* ukm_service); | 620 explicit FormInteractionsUkmLogger(ukm::UkmService* ukm_service); |
| 618 | 621 |
| 619 const GURL& url() const { return url_; } | 622 const GURL& url() const { return url_; } |
| 620 | 623 |
| 621 void OnFormsLoaded(const GURL& url); | 624 void OnFormsLoaded(const GURL& url); |
| 622 void LogInteractedWithForm(bool is_for_credit_card, | 625 void LogInteractedWithForm(bool is_for_credit_card, |
| 623 size_t local_record_type_count, | 626 size_t local_record_type_count, |
| 624 size_t server_record_type_count); | 627 size_t server_record_type_count); |
| 628 void LogPollSuggestions(const AutofillField& field); | |
| 625 void LogSuggestionsShown(); | 629 void LogSuggestionsShown(); |
| 626 void LogSelectedMaskedServerCard(); | 630 void LogSelectedMaskedServerCard(); |
| 627 void LogDidFillSuggestion(int record_type); | 631 void LogDidFillSuggestion(int record_type); |
| 628 void LogTextFieldDidChange(const AutofillField& field); | 632 void LogTextFieldDidChange(const AutofillField& field); |
| 629 void LogFormSubmitted(AutofillFormSubmittedState state); | 633 void LogFormSubmitted(AutofillFormSubmittedState state); |
| 630 | 634 |
| 631 // We initialize |url_| with the form's URL when we log the first form | 635 // We initialize |url_| with the form's URL when we log the first form |
| 632 // interaction. Later, we may update |url_| with the |source_url()| for the | 636 // interaction. Later, we may update |url_| with the |source_url()| for the |
| 633 // submitted form. | 637 // submitted form. |
| 634 void UpdateSourceURL(const GURL& url); | 638 void UpdateSourceURL(const GURL& url); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 inline void set_local_record_type_count(size_t local_record_type_count) { | 838 inline void set_local_record_type_count(size_t local_record_type_count) { |
| 835 local_record_type_count_ = local_record_type_count; | 839 local_record_type_count_ = local_record_type_count; |
| 836 } | 840 } |
| 837 | 841 |
| 838 inline void set_is_context_secure(bool is_context_secure) { | 842 inline void set_is_context_secure(bool is_context_secure) { |
| 839 is_context_secure_ = is_context_secure; | 843 is_context_secure_ = is_context_secure; |
| 840 } | 844 } |
| 841 | 845 |
| 842 void OnDidInteractWithAutofillableForm(); | 846 void OnDidInteractWithAutofillableForm(); |
| 843 | 847 |
| 844 void OnDidPollSuggestions(const FormFieldData& field); | 848 void OnDidPollSuggestions(const FormFieldData& field, |
| 849 const AutofillField& autofill_field); | |
| 845 | 850 |
| 846 void OnDidShowSuggestions(); | 851 void OnDidShowSuggestions(); |
| 847 | 852 |
| 848 void OnDidSelectMaskedServerCardSuggestion(); | 853 void OnDidSelectMaskedServerCardSuggestion(); |
| 849 | 854 |
| 850 // In case of masked cards, caller must make sure this gets called before | 855 // In case of masked cards, caller must make sure this gets called before |
| 851 // the card is upgraded to a full card. | 856 // the card is upgraded to a full card. |
| 852 void OnDidFillSuggestion(const CreditCard& credit_card); | 857 void OnDidFillSuggestion(const CreditCard& credit_card); |
| 853 | 858 |
| 854 void OnDidFillSuggestion(const AutofillProfile& profile); | 859 void OnDidFillSuggestion(const AutofillProfile& profile); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 880 form_interactions_ukm_logger_; // Weak reference. | 885 form_interactions_ukm_logger_; // Weak reference. |
| 881 }; | 886 }; |
| 882 | 887 |
| 883 private: | 888 private: |
| 884 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); | 889 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); |
| 885 }; | 890 }; |
| 886 | 891 |
| 887 } // namespace autofill | 892 } // namespace autofill |
| 888 | 893 |
| 889 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 894 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
| OLD | NEW |