Class Autocomplete
The API is split into two parts: 1. Storage-level delegates. 2. User-prompt delegates.
The storage-level delegates connect Gecko mechanics to the app's storage, e.g., retrieving and storing of login entries.
The user-prompt delegates propagate decisions to the app that could require user choice, e.g., saving or updating of login entries or the selection of a login entry out of multiple options.
Throughout the documentation, we will refer to the filling out of input forms using two terms: 1. Autofill: automatic filling without user interaction. 2. Autocomplete: semi-automatic filling that requires user prompting for the selection.
Examples
Autocomplete/Fetch API
GeckoView loads https://example.com which contains (for the purpose of this
example) elements resembling a login form, e.g.,
<form>
<input type="text" placeholder="username">
<input type="password" placeholder="password">
<input type="submit" value="submit">
</form>
With the document parsed and the login input fields identified, GeckoView dispatches a
StorageDelegate.onLoginFetch("example.com") request to fetch logins for the
given domain.
Based on the provided login entries, GeckoView will attempt to autofill the login input fields, if there is only one suitable login entry option.
In the case of multiple valid login entry options, GeckoView dispatches a
GeckoSession.PromptDelegate.onLoginSelect request, which allows for user-choice
delegation.
Based on the returned login entries, GeckoView will attempt to autofill/autocomplete the login input fields.
Update API
When the user submits some login input fields, GeckoView dispatches another
StorageDelegate.onLoginFetch("example.com") request to check whether the
submitted login exists or whether it's a new or updated login entry.
If the submitted login is already contained as-is in the collection returned by
onLoginFetch, then GeckoView dispatches StorageDelegate.onLoginUsed with the
submitted login entry.
If the submitted login is a new or updated entry, GeckoView dispatches a sequence of requests to save/update the login entry, see the Save API example.
Save API
The user enters new or updated (password) login credentials in some login input fields and
submits explicitely (submit action) or by navigation. GeckoView identifies the entered
credentials and dispatches a GeckoSession.PromptDelegate.onLoginSave(session, request)
with the provided credentials.
The app may dismiss the prompt request via
return GeckoResult.fromValue(prompt.dismiss()) which terminates this saving request, or
confirm it via return GeckoResult.fromValue(prompt.confirm(login)) where login
either holds the credentials originally provided by the prompt request (
prompt.logins[0]) or a new or modified login entry.
The login entry returned in a confirmed save prompt is used to request for saving in the
runtime delegate via StorageDelegate.onLoginSave(login). If the app has already
stored the entry during the prompt request handling, it may ignore this storage saving request.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHolds address information for a specific entry.static classHolds information required to process address saving requests.static classHolds information required to process address selection requests.static classAddress structure coordinates runtime messaging between the form autofill toolkit utils and GeckoView.static classHolds credit card information for a specific entry.static classHolds information required to process credit card saving requests.static classHolds information required to process credit card selection requests.static classHolds login information for a specific entry.static classHolds information required to process login saving requests.static classHolds information required to process login selection requests.static @interfaceLogin storage used field definitions for tracking which fields were used.static classAbstract base class for Autocomplete options.static classAbstract base class for saving options.static classAbstract base class for saving options.static interfaceImplement this interface to handle runtime login storage requests.static classPossible login entry field types forAutocomplete.StorageDelegate.onLoginUsed(org.mozilla.geckoview.Autocomplete.LoginEntry, int). -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Autocomplete
protected Autocomplete()Protected constructor for Autocomplete.
-