blob: 39aaea39f68f87ee4936a03fb3b207a42817cf2e [file] [log] [blame]
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: fgei <fgei@gmail.com>
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 | 10 ----------
.../core/browser/browser_autofill_manager.cc | 13 +++++++++++++
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index 21e0318be88f1..114990e514cbd 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -514,14 +514,12 @@ void AutofillAgent::OnTextFieldDidChange(const WebFormControlElement& element) {
if (password_generation_agent_ && !input_element.IsNull() &&
password_generation_agent_->TextDidChangeInTextField(input_element)) {
is_popup_possibly_visible_ = true;
- return;
}
if (!input_element.IsNull() &&
password_autofill_agent_->TextDidChangeInTextField(input_element)) {
is_popup_possibly_visible_ = true;
last_queried_element_ = FieldRef(element);
- return;
}
if (!input_element.IsNull()) {
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index 1372f3c440ff0..b6b2fa4780a65 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -1612,16 +1612,6 @@ bool PasswordAutofillAgent::ShowSuggestionsForDomain(
return false;
}
-#if BUILDFLAG(IS_ANDROID)
- // Don't call `ShowSuggestionPopup` if a keyboard replacing surface is
- // currently showing. Since a keyboard replacing surface 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 (keyboard_replacing_surface_state_ ==
- KeyboardReplacingSurfaceState::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 103dc76137de5..2e212d852f3b7 100644
--- a/components/autofill/core/browser/browser_autofill_manager.cc
+++ b/components/autofill/core/browser/browser_autofill_manager.cc
@@ -965,6 +965,19 @@ void BrowserAutofillManager::OnAskForValuesToFillImpl(
if (base::FeatureList::IsEnabled(features::kAutofillDisableFilling)) {
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;
+ }
+ }
external_delegate_->SetCurrentDataListValues(field.datalist_options);
external_delegate_->OnQuery(form, field, transformed_box, trigger_source);