Commit 58398d43 authored by Matthias Körber's avatar Matthias Körber Committed by Commit Bot

[Autofill] Give heuristic types precedence for new address tokens.

Moves the place in the code where the precedence is granted to mitigate
that overall predictions are not cached.

Change-Id: Ib768918d2e0267b02846da534d904fa53df5ffbe
Bug: 1148782
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537835Reviewed-by: default avatarChristoph Schwering <schwering@google.com>
Commit-Queue: Matthias Körber <koerber@google.com>
Cr-Commit-Position: refs/heads/master@{#827269}
parent 796e72ef
......@@ -143,6 +143,27 @@ AutofillType AutofillField::ComputedType() const {
believe_server = believe_server &&
!(AutofillType(server_type_).group() == PASSWORD_FIELD &&
heuristic_type_ == CREDIT_CARD_VERIFICATION_CODE);
// For new name tokens the heuristic predictions get precedence over the
// server predictions.
// TODO(crbug.com/1098943): Remove feature check once launched.
believe_server =
believe_server &&
!(base::FeatureList::IsEnabled(
features::kAutofillEnableSupportForMoreStructureInNames) &&
(heuristic_type_ == NAME_LAST_SECOND ||
heuristic_type_ == NAME_LAST_FIRST));
// For new address tokens the heuristic predictions get precedence over the
// server predictions.
// TODO(crbug.com/1098943): Remove feature check once launched.
believe_server =
believe_server &&
!(base::FeatureList::IsEnabled(
features::kAutofillEnableSupportForMoreStructureInAddresses) &&
(heuristic_type_ == ADDRESS_HOME_STREET_NAME ||
heuristic_type_ == ADDRESS_HOME_HOUSE_NUMBER));
if (believe_server)
return AutofillType(server_type_);
}
......
......@@ -890,7 +890,6 @@ void FormStructure::ProcessQueryResponse(
form->UpdateAutofillCount();
form->RationalizeRepeatedFields(form_interactions_ukm_logger);
form->RationalizeFieldTypePredictions();
form->OverrideServerPredictionsWithHeuristics();
form->IdentifySections(false);
}
......@@ -1862,27 +1861,6 @@ void FormStructure::RationalizeAddressStateCountry(
}
}
void FormStructure::OverrideServerPredictionsWithHeuristics() {
if (!base::FeatureList::IsEnabled(
features::kAutofillEnableSupportForMoreStructureInNames) &&
!base::FeatureList::IsEnabled(
features::kAutofillEnableSupportForMoreStructureInAddresses)) {
return;
}
for (const auto& field : fields_) {
switch (field->heuristic_type()) {
case NAME_LAST_SECOND:
case NAME_LAST_FIRST:
case ADDRESS_HOME_STREET_NAME:
case ADDRESS_HOME_HOUSE_NUMBER:
field->SetTypeTo(AutofillType(field->heuristic_type()));
break;
default: {
};
}
}
}
void FormStructure::RationalizeRepeatedFields(
AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger) {
// The type of every field whose index is in
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment