From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: fgei Date: Mon, 20 Feb 2023 07:06:53 +0000 Subject: [PATCH] Support both password manager and android autofill functionality --- .../autofill/content/renderer/autofill_agent.cc | 2 -- .../content/renderer/password_autofill_agent.cc | 9 --------- .../core/browser/browser_autofill_manager.cc | 13 +++++++++++++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index a663c48414a08..dc752712b1cb5 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc @@ -509,7 +509,6 @@ void AutofillAgent::OnTextFieldDidChange(const WebInputElement& element) { if (password_autofill_agent_->TextDidChangeInTextField(element)) { is_popup_possibly_visible_ = true; element_ = element; - return; } ShowSuggestions(element, {.requires_caret_at_end = true}); @@ -878,7 +877,6 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element, input_element, ShowAll(options.show_full_suggestion_list), GenerationShowing(is_generation_popup_possibly_visible_))) { is_popup_possibly_visible_ = true; - return; } if (is_generation_popup_possibly_visible_) diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index f1877135d198a..f0e623b9cf9d2 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc @@ -1102,15 +1102,6 @@ bool PasswordAutofillAgent::ShowSuggestions( if (generation_popup_showing) return false; -#if BUILDFLAG(IS_ANDROID) - // Don't call ShowSuggestionPopup if Touch To Fill is currently showing. Since - // Touch To Fill in spirit is very similar to a suggestion pop-up, return true - // so that the AutofillAgent does not try to show other autofill suggestions - // instead. - if (touch_to_fill_state_ == TouchToFillState::kIsShowing) - return true; -#endif - if (!HasDocumentWithValidFrame(element)) return false; diff --git a/components/autofill/core/browser/browser_autofill_manager.cc b/components/autofill/core/browser/browser_autofill_manager.cc index b89394fa35f3d..73776acad6ae0 100644 --- a/components/autofill/core/browser/browser_autofill_manager.cc +++ b/components/autofill/core/browser/browser_autofill_manager.cc @@ -1107,6 +1107,19 @@ void BrowserAutofillManager::OnAskForValuesToFillImpl( return; } + if (AutofillField* _autofill_field = GetAutofillField(form, field)) { + switch (_autofill_field->Type().group()) { + // Do not override password manager prompt on these fields + case FieldTypeGroup::kNoGroup: + case FieldTypeGroup::kPasswordField: + case FieldTypeGroup::kUsernameField: + case FieldTypeGroup::kEmail: + return; + default: + break; + } + } + SetDataList(field.datalist_values, field.datalist_labels); external_delegate_->OnQuery(form, field, transformed_box);