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

Unified Diff: components/autofill/core/browser/autofill_field.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_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;

Powered by Google App Engine
This is Rietveld 408576698