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

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

Issue 667043002: Add a flag to ignore autocomplete="off" for Autofill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: fix MSVC error C4373 Created 6 years, 2 months 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_external_delegate.cc
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc
index ff145154575bd8a900dee1d74213a1986ba83285..7cc913947eca844d76d4507eb3686cf4c97ea988 100644
--- a/components/autofill/core/browser/autofill_external_delegate.cc
+++ b/components/autofill/core/browser/autofill_external_delegate.cc
@@ -4,6 +4,7 @@
#include "components/autofill/core/browser/autofill_external_delegate.h"
+#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
@@ -12,6 +13,7 @@
#include "components/autofill/core/browser/autofill_driver.h"
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/popup_item_ids.h"
+#include "components/autofill/core/common/autofill_switches.h"
#include "grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
@@ -42,6 +44,16 @@ void EmitHistogram(AccessAddressBookEventType type) {
namespace autofill {
+namespace {
+
+bool ShouldAutofill(const FormFieldData& form_field) {
+ return form_field.should_autocomplete ||
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kIgnoreAutocompleteOffForAutofill);
+}
+
+} // namespace
+
AutofillExternalDelegate::AutofillExternalDelegate(AutofillManager* manager,
AutofillDriver* driver)
: manager_(manager),
@@ -307,7 +319,7 @@ void AutofillExternalDelegate::ApplyAutofillWarnings(
std::vector<base::string16>* labels,
std::vector<base::string16>* icons,
std::vector<int>* unique_ids) {
- if (!query_field_.should_autocomplete) {
+ if (!ShouldAutofill(query_field_)) {
// Autofill is disabled. If there were some profile or credit card
// suggestions to show, show a warning instead. Otherwise, clear out the
// list of suggestions.

Powered by Google App Engine
This is Rietveld 408576698