Index: components/autofill/core/browser/autofill_field.cc |
diff --git a/components/autofill/core/browser/autofill_field.cc b/components/autofill/core/browser/autofill_field.cc |
index 5fd597d1d07141a1863d67355e30123c69896ab4..41bc2fc075870540bd2d522fb0e9d9e8b23fc99a 100644 |
--- a/components/autofill/core/browser/autofill_field.cc |
+++ b/components/autofill/core/browser/autofill_field.cc |
@@ -20,6 +20,7 @@ |
#include "components/autofill/core/browser/state_names.h" |
#include "components/autofill/core/common/autofill_l10n_util.h" |
#include "components/autofill/core/common/autofill_switches.h" |
+#include "components/autofill/core/common/autofill_util.h" |
#include "grit/components_strings.h" |
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h" |
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_formatter.h" |
@@ -500,6 +501,13 @@ bool AutofillField::FillFormField(const AutofillField& field, |
FormFieldData* field_data) { |
AutofillType type = field.Type(); |
+ // Don't fill if autocomplete=off is set on |field| on desktop for non credit |
+ // card related fields. |
+ if (!field.should_autocomplete && IsDesktopPlatform() && |
+ (type.group() != CREDIT_CARD)) { |
+ return false; |
+ } |
+ |
if (type.GetStorableType() == PHONE_HOME_NUMBER) { |
FillPhoneNumberField(field, value, field_data); |
return true; |