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

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: Created 5 years, 1 month 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..3750c2c56460e1f8598de28bc256530ae7de128c 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 false.
Mathieu 2015/11/27 16:14:33 false -> off
sebsg 2015/11/27 19:26:21 Done.
+ if (IsOnDesktop() && !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