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

Unified Diff: components/autofill/core/browser/form_structure.cc

Issue 2003563003: [Autofill] Quality metric based on autocomplete attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: histograms.xml Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
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 fe9c5607362d70d9ffbb7083e6fa25a8e5280ef1..16369662768730d96f6c70c6512de5e57733f53e 100644
--- a/components/autofill/core/browser/form_structure.cc
+++ b/components/autofill/core/browser/form_structure.cc
@@ -500,21 +500,16 @@ void FormStructure::ParseQueryResponse(std::string payload,
static_cast<ServerFieldType>(current_field->autofill_type());
query_response_has_no_server_data &= field_type == NO_SERVER_DATA;
- // If |form->has_author_specified_types| only password fields should be
- // updated.
- if (!form->has_author_specified_types_ ||
- field->form_control_type == "password") {
- // UNKNOWN_TYPE is reserved for use by the client.
- DCHECK_NE(field_type, UNKNOWN_TYPE);
-
- ServerFieldType heuristic_type = field->heuristic_type();
- if (heuristic_type != UNKNOWN_TYPE)
- heuristics_detected_fillable_field = true;
-
- field->set_server_type(field_type);
- if (heuristic_type != field->Type().GetStorableType())
- query_response_overrode_heuristics = true;
- }
+ // UNKNOWN_TYPE is reserved for use by the client.
+ DCHECK_NE(field_type, UNKNOWN_TYPE);
+
+ ServerFieldType heuristic_type = field->heuristic_type();
+ if (heuristic_type != UNKNOWN_TYPE)
+ heuristics_detected_fillable_field = true;
+
+ field->set_server_type(field_type);
+ if (heuristic_type != field->Type().GetStorableType())
+ query_response_overrode_heuristics = true;
++current_field;
}
@@ -734,39 +729,42 @@ void FormStructure::LogQualityMetrics(const base::TimeTicks& load_time,
// Log heuristic, server, and overall type quality metrics, independently of
// whether the field was autofilled.
+ const AutofillMetrics::QualityMetricType metric_type =
+ observed_submission ? AutofillMetrics::TYPE_SUBMISSION
+ : AutofillMetrics::TYPE_NO_SUBMISSION;
if (heuristic_type == UNKNOWN_TYPE) {
- AutofillMetrics::LogHeuristicTypePrediction(
- AutofillMetrics::TYPE_UNKNOWN, field_type, observed_submission);
+ AutofillMetrics::LogHeuristicTypePrediction(AutofillMetrics::TYPE_UNKNOWN,
+ field_type, metric_type);
} else if (field_types.count(heuristic_type)) {
- AutofillMetrics::LogHeuristicTypePrediction(
- AutofillMetrics::TYPE_MATCH, field_type, observed_submission);
+ AutofillMetrics::LogHeuristicTypePrediction(AutofillMetrics::TYPE_MATCH,
+ field_type, metric_type);
} else {
++num_heuristic_mismatches;
AutofillMetrics::LogHeuristicTypePrediction(
- AutofillMetrics::TYPE_MISMATCH, field_type, observed_submission);
+ AutofillMetrics::TYPE_MISMATCH, field_type, metric_type);
}
if (server_type == NO_SERVER_DATA) {
AutofillMetrics::LogServerTypePrediction(AutofillMetrics::TYPE_UNKNOWN,
- field_type, observed_submission);
+ field_type, metric_type);
} else if (field_types.count(server_type)) {
AutofillMetrics::LogServerTypePrediction(AutofillMetrics::TYPE_MATCH,
- field_type, observed_submission);
+ field_type, metric_type);
} else {
++num_server_mismatches;
AutofillMetrics::LogServerTypePrediction(AutofillMetrics::TYPE_MISMATCH,
- field_type, observed_submission);
+ field_type, metric_type);
}
if (predicted_type == UNKNOWN_TYPE) {
- AutofillMetrics::LogOverallTypePrediction(
- AutofillMetrics::TYPE_UNKNOWN, field_type, observed_submission);
+ AutofillMetrics::LogOverallTypePrediction(AutofillMetrics::TYPE_UNKNOWN,
+ field_type, metric_type);
} else if (field_types.count(predicted_type)) {
- AutofillMetrics::LogOverallTypePrediction(
- AutofillMetrics::TYPE_MATCH, field_type, observed_submission);
+ AutofillMetrics::LogOverallTypePrediction(AutofillMetrics::TYPE_MATCH,
+ field_type, metric_type);
} else {
- AutofillMetrics::LogOverallTypePrediction(
- AutofillMetrics::TYPE_MISMATCH, field_type, observed_submission);
+ AutofillMetrics::LogOverallTypePrediction(AutofillMetrics::TYPE_MISMATCH,
+ field_type, metric_type);
}
}
@@ -843,6 +841,43 @@ void FormStructure::LogQualityMetrics(const base::TimeTicks& load_time,
}
}
+void FormStructure::LogQualityMetricsBasedOnAutocomplete() const {
+ for (const AutofillField* 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);
+ }
+ }
+ }
+}
+
void FormStructure::ParseFieldTypesFromAutocompleteAttributes() {
const std::string kDefaultSection = "-default";
« no previous file with comments | « components/autofill/core/browser/form_structure.h ('k') | components/autofill/core/browser/form_structure_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698