chore: cleanup autofill agent shutdown sequence (#36954)

This commit is contained in:
Shelley Vohr 2023-01-20 23:35:06 +01:00 committed by GitHub
parent 3b018143b4
commit c3f02d7df2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 48 deletions

View file

@ -33,8 +33,9 @@ class AutofillAgent : public content::RenderFrameObserver,
AutofillAgent(const AutofillAgent&) = delete;
AutofillAgent& operator=(const AutofillAgent&) = delete;
void BindReceiver(
mojo::PendingAssociatedReceiver<mojom::ElectronAutofillAgent> receiver);
void BindPendingReceiver(
mojo::PendingAssociatedReceiver<mojom::ElectronAutofillAgent>
pending_receiver);
// content::RenderFrameObserver:
void OnDestruct() override;
@ -47,11 +48,18 @@ class AutofillAgent : public content::RenderFrameObserver,
private:
struct ShowSuggestionsOptions {
ShowSuggestionsOptions();
bool autofill_on_empty_values;
bool requires_caret_at_end;
// Specifies that suggestions should be shown when |element| contains no
// text.
bool autofill_on_empty_values{false};
// Specifies that suggestions should be shown when the caret is not
// after the last character in the element.
bool requires_caret_at_end{false};
};
// Shuts the AutofillAgent down on RenderFrame deletion. Safe to call multiple
// times.
void Shutdown();
// blink::WebAutofillClient:
void TextFieldDidEndEditing(const blink::WebInputElement&) override;
void TextFieldDidChange(const blink::WebFormControlElement&) override;
@ -72,7 +80,7 @@ class AutofillAgent : public content::RenderFrameObserver,
void ShowSuggestions(const blink::WebFormControlElement& element,
const ShowSuggestionsOptions& options);
void DoFocusChangeComplete();
void HandleFocusChangeComplete();
const mojo::AssociatedRemote<mojom::ElectronAutofillDriver>&
GetAutofillDriver();