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

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

Issue 1920863006: [Autofill] Do not show Autocomplete suggestions for credit card fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no autocomplete on cc number, exp or cvc Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index c1e219eeb455e198b60b6cd2b0ceed66acb72bde..77ae77e4f6f293cf2a9abf4b5f6318e778e40fa7 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -550,10 +550,18 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id,
}
}
- if (suggestions.empty() && field.should_autocomplete) {
- // Show autocomplete. Suggestions come back asynchronously, so the
- // autocomplete manager will handle sending the results back to the
- // renderer.
+ // If there are no Autofill suggestions, consider showing Autocomplete
+ // suggestions. We will not show Autocomplete suggestions for a field that
+ // specifies autocomplete=off or a field that we think is a credit card
+ // expiration, cvc or number.
+ if (suggestions.empty() && field.should_autocomplete &&
+ !(autofill_field &&
+ (IsCreditCardExpirationType(autofill_field->Type().GetStorableType()) ||
+ autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER ||
+ autofill_field->Type().GetStorableType() ==
+ CREDIT_CARD_VERIFICATION_CODE))) {
+ // Suggestions come back asynchronously, so the Autocomplete manager will
+ // handle sending the results back to the renderer.
autocomplete_history_manager_->OnGetAutocompleteSuggestions(
query_id, field.name, field.value, field.form_control_type);
return;
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | components/autofill/core/browser/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698