blob: 1609207a8bb1d6528bdf7cfb773e8b753f6afd95 [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 | 1 -
.../content/renderer/password_autofill_agent.cc | 11 -----------
.../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 193cdecccd425..2654381cae623 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -537,7 +537,6 @@ void AutofillAgent::OnTextFieldDidChange(const WebInputElement& element) {
if (password_autofill_agent_->TextDidChangeInTextField(element)) {
is_popup_possibly_visible_ = true;
last_queried_element_ = element;
- return;
}
ShowSuggestions(element,
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index 52b7c28a2a925..b039f5ee6441a 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -1155,17 +1155,6 @@ bool PasswordAutofillAgent::ShowSuggestions(const WebInputElement& element,
if (element.Value().length() > kMaximumTextSizeForAutocomplete)
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 a1bc6da4223f5..48d1c3133df48 100644
--- a/components/autofill/core/browser/browser_autofill_manager.cc
+++ b/components/autofill/core/browser/browser_autofill_manager.cc
@@ -1155,6 +1155,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;
+ }
+ }
SetDataList(field.datalist_values, field.datalist_labels);
external_delegate_->OnQuery(form, field, transformed_box);