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 f600b6522481a43f9b2492e74336b7b8e0b770a0..021dfc5c2cfb2d878790f338e1b432a82f035fb1 100644 |
--- a/components/autofill/core/browser/autofill_external_delegate.cc |
+++ b/components/autofill/core/browser/autofill_external_delegate.cc |
@@ -47,22 +47,11 @@ void EmitHistogram(AccessAddressBookEventType type) { |
namespace autofill { |
-namespace { |
- |
-bool ShouldAutofill(const FormFieldData& form_field) { |
- return form_field.should_autocomplete || |
- !base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kRespectAutocompleteOffForAutofill); |
-} |
- |
-} // namespace |
- |
AutofillExternalDelegate::AutofillExternalDelegate(AutofillManager* manager, |
AutofillDriver* driver) |
: manager_(manager), |
driver_(driver), |
query_id_(0), |
- display_warning_if_disabled_(false), |
has_suggestion_(false), |
has_shown_popup_for_current_edit_(false), |
should_show_scan_credit_card_(false), |
@@ -76,14 +65,12 @@ AutofillExternalDelegate::~AutofillExternalDelegate() {} |
void AutofillExternalDelegate::OnQuery(int query_id, |
const FormData& form, |
const FormFieldData& field, |
- const gfx::RectF& element_bounds, |
- bool display_warning_if_disabled) { |
+ const gfx::RectF& element_bounds) { |
if (!query_form_.SameFormAs(form)) |
has_shown_address_book_prompt = false; |
query_form_ = form; |
query_field_ = field; |
- display_warning_if_disabled_ = display_warning_if_disabled; |
query_id_ = query_id; |
element_bounds_ = element_bounds; |
should_show_scan_credit_card_ = |
@@ -300,11 +287,8 @@ void AutofillExternalDelegate::Reset() { |
void AutofillExternalDelegate::OnPingAck() { |
// Reissue the most recent query, which will reopen the Autofill popup. |
- manager_->OnQueryFormFieldAutofill(query_id_, |
- query_form_, |
- query_field_, |
- element_bounds_, |
- display_warning_if_disabled_); |
+ manager_->OnQueryFormFieldAutofill(query_id_, query_form_, query_field_, |
+ element_bounds_); |
} |
base::WeakPtr<AutofillExternalDelegate> AutofillExternalDelegate::GetWeakPtr() { |
@@ -341,31 +325,12 @@ void AutofillExternalDelegate::FillAutofillFormData(int unique_id, |
void AutofillExternalDelegate::ApplyAutofillWarnings( |
std::vector<Suggestion>* suggestions) { |
- 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. |
- if (!suggestions->empty() && (*suggestions)[0].frontend_id > 0) { |
- // If Autofill is disabled and we had suggestions, show a warning instead. |
- suggestions->assign(1, Suggestion( |
- l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED))); |
- (*suggestions)[0].frontend_id = POPUP_ITEM_ID_WARNING_MESSAGE; |
- } else { |
- suggestions->clear(); |
- } |
- } else if (suggestions->size() > 1 && |
- (*suggestions)[0].frontend_id == POPUP_ITEM_ID_WARNING_MESSAGE) { |
+ if (suggestions->size() > 1 && |
+ (*suggestions)[0].frontend_id == POPUP_ITEM_ID_WARNING_MESSAGE) { |
// If we received a warning instead of suggestions from Autofill but regular |
// suggestions from autocomplete, don't show the Autofill warning. |
suggestions->erase(suggestions->begin()); |
} |
- |
- // If we were about to show a warning and we shouldn't, don't. |
- if (!suggestions->empty() && |
- (*suggestions)[0].frontend_id == POPUP_ITEM_ID_WARNING_MESSAGE && |
- !display_warning_if_disabled_) { |
- suggestions->clear(); |
- } |
} |
void AutofillExternalDelegate::ApplyAutofillOptions( |