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

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

Issue 1059393002: Remove --respect-autocomplete-off-autofill flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix last 3 tests Created 5 years, 8 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 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(

Powered by Google App Engine
This is Rietveld 408576698