| Index: components/autofill/core/browser/form_structure.cc
|
| diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc
|
| index 9a7b87dbe102964f05d94ce09d4d07375e59fc14..10a8380908cc2daec7c1ec7c999bd8b48794d84d 100644
|
| --- a/components/autofill/core/browser/form_structure.cc
|
| +++ b/components/autofill/core/browser/form_structure.cc
|
| @@ -47,10 +47,6 @@ const char kClientVersion[] = "6.1.1715.1442/en (GGLL)";
|
| const char kBillingMode[] = "billing";
|
| const char kShippingMode[] = "shipping";
|
|
|
| -// A form is considered to have a high prediction mismatch rate if the number of
|
| -// mismatches exceeds this threshold.
|
| -const int kNumberOfMismatchesThreshold = 3;
|
| -
|
| // Only removing common name prefixes if we have a minimum number of fields and
|
| // a minimum prefix length. These values are chosen to avoid cases such as two
|
| // fields with "address1" and "address2" and be effective against web frameworks
|
| @@ -701,8 +697,6 @@ void FormStructure::LogQualityMetrics(
|
| bool did_show_suggestions,
|
| bool observed_submission) const {
|
| size_t num_detected_field_types = 0;
|
| - size_t num_server_mismatches = 0;
|
| - size_t num_heuristic_mismatches = 0;
|
| size_t num_edited_autofilled_fields = 0;
|
| bool did_autofill_all_possible_fields = true;
|
| bool did_autofill_some_possible_fields = false;
|
| @@ -741,93 +735,21 @@ void FormStructure::LogQualityMetrics(
|
| const ServerFieldTypeSet& field_types = field->possible_types();
|
| DCHECK(!field_types.empty());
|
|
|
| - // If the field data is empty, or unrecognized, log whether or not autofill
|
| - // predicted that it would be populated with an autofillable data type.
|
| - bool has_empty_data = field_types.count(EMPTY_TYPE) != 0;
|
| - bool has_unrecognized_data = field_types.count(UNKNOWN_TYPE) != 0;
|
| - if (has_empty_data || has_unrecognized_data) {
|
| - AutofillMetrics::FieldTypeQualityMetric match_empty_or_unknown =
|
| - has_empty_data ? AutofillMetrics::TYPE_MATCH_EMPTY
|
| - : AutofillMetrics::TYPE_MATCH_UNKNOWN;
|
| - AutofillMetrics::FieldTypeQualityMetric mismatch_empty_or_unknown =
|
| - has_empty_data ? AutofillMetrics::TYPE_MISMATCH_EMPTY
|
| - : AutofillMetrics::TYPE_MISMATCH_UNKNOWN;
|
| - ServerFieldType field_type = has_empty_data ? EMPTY_TYPE : UNKNOWN_TYPE;
|
| - AutofillMetrics::LogHeuristicTypePrediction(
|
| - (heuristic_type == UNKNOWN_TYPE ? match_empty_or_unknown
|
| - : mismatch_empty_or_unknown),
|
| - field_type, metric_type);
|
| - AutofillMetrics::LogServerTypePrediction(
|
| - (server_type == NO_SERVER_DATA ? match_empty_or_unknown
|
| - : mismatch_empty_or_unknown),
|
| - field_type, metric_type);
|
| - AutofillMetrics::LogOverallTypePrediction(
|
| - (predicted_type == UNKNOWN_TYPE ? match_empty_or_unknown
|
| - : mismatch_empty_or_unknown),
|
| - field_type, metric_type);
|
| + AutofillMetrics::LogHeuristicPredictionQualityMetrics(
|
| + field_types, heuristic_type, metric_type);
|
| + AutofillMetrics::LogServerPredictionQualityMetrics(field_types, server_type,
|
| + metric_type);
|
| + AutofillMetrics::LogOverallPredictionQualityMetrics(
|
| + field_types, predicted_type, metric_type);
|
| +
|
| + if (field_types.count(EMPTY_TYPE) || field_types.count(UNKNOWN_TYPE))
|
| continue;
|
| - }
|
|
|
| ++num_detected_field_types;
|
| if (field->is_autofilled)
|
| did_autofill_some_possible_fields = true;
|
| else
|
| did_autofill_all_possible_fields = false;
|
| -
|
| - // Collapse field types that Chrome treats as identical, e.g. home and
|
| - // billing address fields.
|
| - ServerFieldTypeSet collapsed_field_types;
|
| - for (const auto& it : field_types) {
|
| - // Since we currently only support US phone numbers, the (city code + main
|
| - // digits) number is almost always identical to the whole phone number.
|
| - // TODO(isherman): Improve this logic once we add support for
|
| - // international numbers.
|
| - if (it == PHONE_HOME_CITY_AND_NUMBER)
|
| - collapsed_field_types.insert(PHONE_HOME_WHOLE_NUMBER);
|
| - else
|
| - collapsed_field_types.insert(AutofillType(it).GetStorableType());
|
| - }
|
| -
|
| - // Capture the field's type, if it is unambiguous.
|
| - ServerFieldType field_type = UNKNOWN_TYPE;
|
| - if (collapsed_field_types.size() == 1)
|
| - field_type = *collapsed_field_types.begin();
|
| -
|
| - // Log heuristic, server, and overall type quality metrics.
|
| - if (heuristic_type == UNKNOWN_TYPE) {
|
| - AutofillMetrics::LogHeuristicTypePrediction(AutofillMetrics::TYPE_UNKNOWN,
|
| - field_type, metric_type);
|
| - } else if (field_types.count(heuristic_type)) {
|
| - AutofillMetrics::LogHeuristicTypePrediction(AutofillMetrics::TYPE_MATCH,
|
| - field_type, metric_type);
|
| - } else {
|
| - ++num_heuristic_mismatches;
|
| - AutofillMetrics::LogHeuristicTypePrediction(
|
| - AutofillMetrics::TYPE_MISMATCH, field_type, metric_type);
|
| - }
|
| -
|
| - if (server_type == NO_SERVER_DATA) {
|
| - AutofillMetrics::LogServerTypePrediction(AutofillMetrics::TYPE_UNKNOWN,
|
| - field_type, metric_type);
|
| - } else if (field_types.count(server_type)) {
|
| - AutofillMetrics::LogServerTypePrediction(AutofillMetrics::TYPE_MATCH,
|
| - field_type, metric_type);
|
| - } else {
|
| - ++num_server_mismatches;
|
| - AutofillMetrics::LogServerTypePrediction(AutofillMetrics::TYPE_MISMATCH,
|
| - field_type, metric_type);
|
| - }
|
| -
|
| - if (predicted_type == UNKNOWN_TYPE) {
|
| - AutofillMetrics::LogOverallTypePrediction(AutofillMetrics::TYPE_UNKNOWN,
|
| - field_type, metric_type);
|
| - } else if (field_types.count(predicted_type)) {
|
| - AutofillMetrics::LogOverallTypePrediction(AutofillMetrics::TYPE_MATCH,
|
| - field_type, metric_type);
|
| - } else {
|
| - AutofillMetrics::LogOverallTypePrediction(AutofillMetrics::TYPE_MISMATCH,
|
| - field_type, metric_type);
|
| - }
|
| }
|
|
|
| AutofillMetrics::LogNumberOfEditedAutofilledFields(
|
| @@ -852,18 +774,6 @@ void FormStructure::LogQualityMetrics(
|
| AutofillMetrics::FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS;
|
| }
|
|
|
| - // Log some RAPPOR metrics for problematic cases.
|
| - if (num_server_mismatches >= kNumberOfMismatchesThreshold) {
|
| - rappor::SampleDomainAndRegistryFromGURL(
|
| - rappor_service, "Autofill.HighNumberOfServerMismatches",
|
| - source_url_);
|
| - }
|
| - if (num_heuristic_mismatches >= kNumberOfMismatchesThreshold) {
|
| - rappor::SampleDomainAndRegistryFromGURL(
|
| - rappor_service, "Autofill.HighNumberOfHeuristicMismatches",
|
| - source_url_);
|
| - }
|
| -
|
| // Unlike the other times, the |submission_time| should always be
|
| // available.
|
| DCHECK(!submission_time.is_null());
|
| @@ -904,38 +814,20 @@ void FormStructure::LogQualityMetrics(
|
| }
|
|
|
| void FormStructure::LogQualityMetricsBasedOnAutocomplete() const {
|
| + const AutofillMetrics::QualityMetricType metric_type =
|
| + AutofillMetrics::TYPE_AUTOCOMPLETE_BASED;
|
| for (const auto& field : fields_) {
|
| if (field->html_type() != HTML_TYPE_UNSPECIFIED &&
|
| field->html_type() != HTML_TYPE_UNRECOGNIZED) {
|
| // The type inferred by the autocomplete attribute.
|
| - AutofillType type(field->html_type(), field->html_mode());
|
| - ServerFieldType actual_field_type = type.GetStorableType();
|
| -
|
| - const AutofillMetrics::QualityMetricType metric_type =
|
| - AutofillMetrics::TYPE_AUTOCOMPLETE_BASED;
|
| - // Log the quality of our heuristics predictions.
|
| - if (field->heuristic_type() == UNKNOWN_TYPE) {
|
| - AutofillMetrics::LogHeuristicTypePrediction(
|
| - AutofillMetrics::TYPE_UNKNOWN, actual_field_type, metric_type);
|
| - } else if (field->heuristic_type() == actual_field_type) {
|
| - AutofillMetrics::LogHeuristicTypePrediction(
|
| - AutofillMetrics::TYPE_MATCH, actual_field_type, metric_type);
|
| - } else {
|
| - AutofillMetrics::LogHeuristicTypePrediction(
|
| - AutofillMetrics::TYPE_MISMATCH, actual_field_type, metric_type);
|
| - }
|
| -
|
| - // Log the quality of our server predictions.
|
| - if (field->server_type() == NO_SERVER_DATA) {
|
| - AutofillMetrics::LogServerTypePrediction(
|
| - AutofillMetrics::TYPE_UNKNOWN, actual_field_type, metric_type);
|
| - } else if (field->server_type() == actual_field_type) {
|
| - AutofillMetrics::LogServerTypePrediction(
|
| - AutofillMetrics::TYPE_MATCH, actual_field_type, metric_type);
|
| - } else {
|
| - AutofillMetrics::LogServerTypePrediction(
|
| - AutofillMetrics::TYPE_MISMATCH, actual_field_type, metric_type);
|
| - }
|
| + ServerFieldTypeSet actual_field_type_set{
|
| + AutofillType(field->html_type(), field->html_mode())
|
| + .GetStorableType()};
|
| +
|
| + AutofillMetrics::LogHeuristicPredictionQualityMetrics(
|
| + actual_field_type_set, field->heuristic_type(), metric_type);
|
| + AutofillMetrics::LogServerPredictionQualityMetrics(
|
| + actual_field_type_set, field->server_type(), metric_type);
|
| }
|
| }
|
| }
|
|
|