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 { |