blob: 58572d7cb9bfe313eba3bb4da96c9d2ee107da4b [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 | 11 -----------
.../core/browser/browser_autofill_manager.cc | 13 +++++++++++++
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index 382710524cd30..0e80f8c6eb647 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -556,14 +556,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 dd2d3471406cd..f467d2993f5b3 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -1146,17 +1146,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 c87e797550ce2..1e741c34c8ce9 100644
--- a/components/autofill/core/browser/browser_autofill_manager.cc
+++ b/components/autofill/core/browser/browser_autofill_manager.cc
@@ -1114,6 +1114,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);