[Passwords] Move checks before ShowSuggestionPopup
(This CL should not have any user-visible impact.)
Currently, ShowSuggestionPopup can fail and not show the popup.
Additionally, it also requires FillingData to show a popup which is not
necessarily correct for popups with the main purpose to display a button
to unlock account-stored credentials.
This CL ensures that ShowSuggestionPopup always shows the popup when
called by moving the failure conditions up.
By handling focused username elements early, it simplifies some cases.
Bug: 1052783
Change-Id: Ibe4ac9b8d23277325291e144f3db242a6c7774ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2061254
Reviewed-by: Christos Froussios <[email protected]>
Reviewed-by: Vasilii Sukhanov <[email protected]>
Commit-Queue: Friedrich [CET] <[email protected]>
Cr-Commit-Position: refs/heads/master@{#742627}
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index b3e5148..3c6fa39 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -88,6 +88,8 @@
using form_util::FindFormAndFieldForFormControlElement;
using form_util::UnownedCheckoutFormElementsAndFieldSetsToFormData;
using mojom::SubmissionSource;
+using ShowAll = PasswordAutofillAgent::ShowAll;
+using GenerationShowing = PasswordAutofillAgent::GenerationShowing;
namespace {
@@ -654,8 +656,8 @@
element_ = element;
if (form_util::IsAutofillableInputElement(input_element) &&
password_autofill_agent_->ShowSuggestions(
- *input_element, options.show_full_suggestion_list,
- is_generation_popup_possibly_visible_)) {
+ *input_element, ShowAll(options.show_full_suggestion_list),
+ GenerationShowing(is_generation_popup_possibly_visible_))) {
is_popup_possibly_visible_ = true;
return;
}