Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: components/autofill/core/browser/form_structure.cc

Issue 2800853004: UKM that threads together multiple form interaction events. (Closed)
Patch Set: Updates unit tests. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "components/autofill/core/browser/form_structure.h" 5 #include "components/autofill/core/browser/form_structure.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 UpdateAutofillCount(); 673 UpdateAutofillCount();
674 674
675 // The form signature should match between query and upload requests to the 675 // The form signature should match between query and upload requests to the
676 // server. On many websites, form elements are dynamically added, removed, or 676 // server. On many websites, form elements are dynamically added, removed, or
677 // rearranged via JavaScript between page load and form submission, so we 677 // rearranged via JavaScript between page load and form submission, so we
678 // copy over the |form_signature_field_names_| corresponding to the query 678 // copy over the |form_signature_field_names_| corresponding to the query
679 // request. 679 // request.
680 form_signature_ = cached_form.form_signature_; 680 form_signature_ = cached_form.form_signature_;
681 } 681 }
682 682
683 void FormStructure::LogQualityMetrics(const base::TimeTicks& load_time, 683 AutofillMetrics::AutofillFormSubmittedState FormStructure::LogQualityMetrics(
684 const base::TimeTicks& interaction_time, 684 const base::TimeTicks& load_time,
685 const base::TimeTicks& submission_time, 685 const base::TimeTicks& interaction_time,
686 rappor::RapporServiceImpl* rappor_service, 686 const base::TimeTicks& submission_time,
687 bool did_show_suggestions, 687 rappor::RapporServiceImpl* rappor_service,
688 bool observed_submission) const { 688 bool did_show_suggestions,
689 bool observed_submission) const {
689 size_t num_detected_field_types = 0; 690 size_t num_detected_field_types = 0;
690 size_t num_server_mismatches = 0; 691 size_t num_server_mismatches = 0;
691 size_t num_heuristic_mismatches = 0; 692 size_t num_heuristic_mismatches = 0;
692 size_t num_edited_autofilled_fields = 0; 693 size_t num_edited_autofilled_fields = 0;
693 bool did_autofill_all_possible_fields = true; 694 bool did_autofill_all_possible_fields = true;
694 bool did_autofill_some_possible_fields = false; 695 bool did_autofill_some_possible_fields = false;
695 for (size_t i = 0; i < field_count(); ++i) { 696 for (size_t i = 0; i < field_count(); ++i) {
696 auto* const field = this->field(i); 697 auto* const field = this->field(i);
697 698
698 // No further logging for password fields. Those are primarily related to a 699 // No further logging for password fields. Those are primarily related to a
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 AutofillMetrics::LogOverallTypePrediction(AutofillMetrics::TYPE_MISMATCH, 784 AutofillMetrics::LogOverallTypePrediction(AutofillMetrics::TYPE_MISMATCH,
784 field_type, metric_type); 785 field_type, metric_type);
785 } 786 }
786 } 787 }
787 788
788 AutofillMetrics::LogNumberOfEditedAutofilledFields( 789 AutofillMetrics::LogNumberOfEditedAutofilledFields(
789 num_edited_autofilled_fields, observed_submission); 790 num_edited_autofilled_fields, observed_submission);
790 791
791 // We log "submission" and duration metrics if we are here after observing a 792 // We log "submission" and duration metrics if we are here after observing a
792 // submission event. 793 // submission event.
794 AutofillMetrics::AutofillFormSubmittedState state =
sebsg 2017/04/10 19:20:19 I find it weird to return this value, but the func
csashi 2017/04/10 20:15:58 I noticed that LogQualityMetrics was already takin
795 AutofillMetrics::AUTOFILL_FORM_SUBMITTED_STATE_ENUM_SIZE;
793 if (observed_submission) { 796 if (observed_submission) {
794 if (num_detected_field_types < kRequiredFieldsForPredictionRoutines) { 797 if (num_detected_field_types < kRequiredFieldsForPredictionRoutines) {
795 AutofillMetrics::LogAutofillFormSubmittedState( 798 state = AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA;
796 AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA);
797 } else { 799 } else {
798 if (did_autofill_all_possible_fields) { 800 if (did_autofill_all_possible_fields) {
799 AutofillMetrics::LogAutofillFormSubmittedState( 801 state = AutofillMetrics::FILLABLE_FORM_AUTOFILLED_ALL;
800 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_ALL);
801 } else if (did_autofill_some_possible_fields) { 802 } else if (did_autofill_some_possible_fields) {
802 AutofillMetrics::LogAutofillFormSubmittedState( 803 state = AutofillMetrics::FILLABLE_FORM_AUTOFILLED_SOME;
803 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_SOME);
804 } else if (!did_show_suggestions) { 804 } else if (!did_show_suggestions) {
805 AutofillMetrics::LogAutofillFormSubmittedState( 805 state = AutofillMetrics::
806 AutofillMetrics:: 806 FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS;
807 FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS);
808 } else { 807 } else {
809 AutofillMetrics::LogAutofillFormSubmittedState( 808 state =
810 AutofillMetrics:: 809 AutofillMetrics::FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS;
811 FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS);
812 } 810 }
813 811
814 // Log some RAPPOR metrics for problematic cases. 812 // Log some RAPPOR metrics for problematic cases.
815 if (num_server_mismatches >= kNumberOfMismatchesThreshold) { 813 if (num_server_mismatches >= kNumberOfMismatchesThreshold) {
816 rappor::SampleDomainAndRegistryFromGURL( 814 rappor::SampleDomainAndRegistryFromGURL(
817 rappor_service, "Autofill.HighNumberOfServerMismatches", 815 rappor_service, "Autofill.HighNumberOfServerMismatches",
818 source_url_); 816 source_url_);
819 } 817 }
820 if (num_heuristic_mismatches >= kNumberOfMismatchesThreshold) { 818 if (num_heuristic_mismatches >= kNumberOfMismatchesThreshold) {
821 rappor::SampleDomainAndRegistryFromGURL( 819 rappor::SampleDomainAndRegistryFromGURL(
(...skipping 27 matching lines...) Expand all
849 if (did_autofill_some_possible_fields) { 847 if (did_autofill_some_possible_fields) {
850 AutofillMetrics::LogFormFillDurationFromInteractionWithAutofill( 848 AutofillMetrics::LogFormFillDurationFromInteractionWithAutofill(
851 elapsed); 849 elapsed);
852 } else { 850 } else {
853 AutofillMetrics::LogFormFillDurationFromInteractionWithoutAutofill( 851 AutofillMetrics::LogFormFillDurationFromInteractionWithoutAutofill(
854 elapsed); 852 elapsed);
855 } 853 }
856 } 854 }
857 } 855 }
858 } 856 }
857 return state;
859 } 858 }
860 859
861 void FormStructure::LogQualityMetricsBasedOnAutocomplete() const { 860 void FormStructure::LogQualityMetricsBasedOnAutocomplete() const {
862 for (const auto& field : fields_) { 861 for (const auto& field : fields_) {
863 if (field->html_type() != HTML_TYPE_UNSPECIFIED && 862 if (field->html_type() != HTML_TYPE_UNSPECIFIED &&
864 field->html_type() != HTML_TYPE_UNRECOGNIZED) { 863 field->html_type() != HTML_TYPE_UNRECOGNIZED) {
865 // The type inferred by the autocomplete attribute. 864 // The type inferred by the autocomplete attribute.
866 AutofillType type(field->html_type(), field->html_mode()); 865 AutofillType type(field->html_type(), field->html_mode());
867 ServerFieldType actual_field_type = type.GetStorableType(); 866 ServerFieldType actual_field_type = type.GetStorableType();
868 867
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 filtered_strings[0].at(prefix_len)) { 1337 filtered_strings[0].at(prefix_len)) {
1339 // Mismatch found. 1338 // Mismatch found.
1340 return filtered_strings[i].substr(0, prefix_len); 1339 return filtered_strings[i].substr(0, prefix_len);
1341 } 1340 }
1342 } 1341 }
1343 } 1342 }
1344 return filtered_strings[0]; 1343 return filtered_strings[0];
1345 } 1344 }
1346 1345
1347 } // namespace autofill 1346 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698