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

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

Issue 1473733008: [Autofill] Respect the autocomplete=off attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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 e3c5e3c66c9fc84f24197da1106f06db992fd77a..dca717dd0bfe205c8592bb557630c099d9c673a0 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -49,6 +49,7 @@
#include "components/autofill/core/common/autofill_data_validation.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/autofill/core/common/autofill_switches.h"
+#include "components/autofill/core/common/autofill_util.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_data_predictions.h"
#include "components/autofill/core/common/form_field_data.h"
@@ -407,6 +408,12 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id,
got_autofillable_form) {
AutofillType type = autofill_field->Type();
bool is_filling_credit_card = (type.group() == CREDIT_CARD);
+ // On desktop, don't return non credit card related suggestions for forms or
+ // fields that have the "autocomplete" attribute set to off.
+ if (IsDesktopPlatform() && !is_filling_credit_card &&
+ !field.should_autocomplete) {
+ return;
+ }
if (is_filling_credit_card) {
suggestions = GetCreditCardSuggestions(field, type);
} else {

Powered by Google App Engine
This is Rietveld 408576698