File: autofill_agent.mojom

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (212 lines) | stat: -rw-r--r-- 10,348 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module autofill.mojom;

import "components/autofill/core/common/mojom/autofill_types.mojom";
import "mojo/public/mojom/base/string16.mojom";

// There is one instance of this interface per render frame in the render
// process. All methods are called by browser on renderer.
interface AutofillAgent {
  // Triggers form re-extraction the new forms. This is done when a form is seen
  // in a subframe and it is not known which form is its parent.
  TriggerFormExtraction();

  // Triggers form re-extraction the new forms and notifies the caller when
  // it's done.
  // If `success == false`, TriggerFormExtractionWithResponse() was triggered
  // while another TriggerFormExtractionWithResponse() was ongoing.
  TriggerFormExtractionWithResponse() => (bool success);

  // Fills or previews the form identified by `form` with the data of its
  // fields. `action_type` denotes if the action is a Fill or Undo.
  // `action_persistence` denotes if the operation is a Fill or Preview.
  ApplyFieldsAction(FormActionType action_type,
                    ActionPersistence action_persistence,
                    array<FormFieldData_FillData> fields);

  // Fills or previews the field identified by `field` with `value`.
  // `action_persistence` denotes if the operation is a Fill or Preview.
  // `action_type` indicates whether to replace the field's entire value
  // or only the current selection or select all text inside the field.
  // For non-text fields, this parameter has no effect. This must not be
  // `kReplaceSelection` if `action_persistence` is `kPreview`.
  // Enabling this is desirable but not implemented, yet.
  // If `action_type` is `kSelectAll`, then the `value` must be empty.
  ApplyFieldAction(FieldActionType action_type,
                   ActionPersistence action_persistence,
                   FieldRendererId field,
                   mojo_base.mojom.String16 value);

  // Extracts the given form and responds with the FormData if that form can
  // be found and extracted.
  ExtractForm(FormRendererId form) => (FormData? form);

  // Tries to extract the node value from the DOM and returns the extracted
  // value back to the browser process. The response string contains the
  // node value if present. If the string is empty, it means no node value
  // was found.
  // See `form_util::ExtractFinalCheckoutAmountFromDom()` for details.
  ExtractLabeledTextNodeValue(mojo_base.mojom.String16 value_regex,
                        mojo_base.mojom.String16 label_regex,
                        uint32 number_of_ancestor_levels_to_search) =>
      (string value);

  // Sends the heuristic and server field type predictions to the renderer.
  FieldTypePredictionsAvailable(array<FormDataPredictions> forms);

  // For all elements the DOM Node ID will be exposed on the DOM
  // as attribute "dom-node-id".This is done for data collection purposes.
  ExposeDomNodeIDs();

  // Tells the renderer that the Autofill previewed form should be cleared.
  ClearPreviewedForm();

  // Tells the renderer to trigger Autofill suggestions on the `field`, as if
  // triggered through the provided `trigger_source`.
  // For the most part, suggestions are triggered through Blink events on the
  // renderer-side. However, manual fallbacks from the context menu are
  // triggered from the browser processes. They need to make another round-trip
  // to the renderer, since rendering suggestions relies on the `field`'s
  // position. Since the browser process doesn't have up-to-date coordinates,
  // suggestions are triggered through the renderer, which causes the field and
  // its coordinates to be re-extracted.
  // Assuming the `field` is found, the driver's `AskForValuesToFill()` will be
  // called.
  TriggerSuggestions(
      FieldRendererId field, AutofillSuggestionTriggerSource trigger_source);

  // Sets the autofill/autocomplete suggestion availability of `field` (if it is
  // still the currently selected node).
  SetSuggestionAvailability(
      FieldRendererId field,
      AutofillSuggestionAvailability suggestion_availability);

  // Sets the value of `field` (if it is still the currently selected node).
  // to the given data list value.
  AcceptDataListSuggestion(
      FieldRendererId field, mojo_base.mojom.String16 value);

  // Tells the renderer to preview the username and password with the given
  // values.
  PreviewPasswordSuggestion(
      mojo_base.mojom.String16 username, mojo_base.mojom.String16 password);

  // Tells the renderer to preview the generated password.
  PreviewPasswordGenerationSuggestion(mojo_base.mojom.String16 password);

  // Returns a vector of four digit combinations present in the DOM of a
  // webpage. Used to check for the presence of the virtual card last four in
  // the DOM prior to offering CVC autofill for a virtual card saved on a
  // merchant website.
  GetPotentialLastFourCombinationsForStandaloneCvc()
      => (array<string> potential_matches);
};

// There is one instance of this interface per render frame in the render
// process. This renderer interface is called by the browser.
interface PasswordAutofillAgent {
  // Provides fill information for a password form, which can fill the form and
  // prepare field autocomplete for multiple matching logins. Lets the renderer
  // know if it should disable the popup because the browser process will own
  // the popup UI.
  ApplyFillDataOnParsingCompletion(PasswordFormFillData form_data);

  // Fills the username and password with with given values.
  FillPasswordSuggestion(
      mojo_base.mojom.String16 username, mojo_base.mojom.String16 password)
         => (bool success);

  // Similar to FillPasswordSuggestion, but is also provided the
  // FieldRendererIds of the elements to be filled.
  // `suggestion_source` specified how the user has interacted with
  // PWM suggestions, such as manual fallback. Used to update the
  // `FieldPropertiesMask` of the filled fields.
  FillPasswordSuggestionById(FieldRendererId username_element_id,
                             FieldRendererId password_element_id,
                             mojo_base.mojom.String16 username,
                             mojo_base.mojom.String16 password,
                             AutofillSuggestionTriggerSource suggestion_source);

  // Previews the username and password, determined from the given
  // FieldRendererIds, with the given values.
  PreviewPasswordSuggestionById(FieldRendererId username_element_id,
                                FieldRendererId password_element_id,
                                mojo_base.mojom.String16 username,
                                mojo_base.mojom.String16 password);

  // Informs that there are no saved credentials for filling.
  // This is the "no results" equivalent of ApplyFillDataOnParsingCompletion. In
  // certain cases the password manager shows popups (e.g. promo UIs) even if
  // there are no saved credentials.
 InformNoSavedCredentials(bool should_show_popup_without_passwords);

  // Fills the given `credential` into the last focused text input.
  FillIntoFocusedField(
      bool is_password, mojo_base.mojom.String16 credential);

  // Previews the given `value` into the field identified by `field_id`.
  PreviewField(FieldRendererId field_id, mojo_base.mojom.String16 value);

  // Fills the given `value` into the field identified by `field_id`.
  // `suggestion_source` specified how the user has interacted with
  // PWM suggestions, such as manual fallback. Used to update the
  // `FieldPropertiesMask` of the filled fields.
  FillField(FieldRendererId field_id, mojo_base.mojom.String16 value,
    AutofillSuggestionTriggerSource suggestion_source);

  // Fills a given change password form, specifically `password_element_id` with
  // `old_password` and `new_password_element_id`, `confirm_password_element_id`
  // with `new_password`. Upon completion asynchronously returns `form_data`
  // with filled values if the form was successfully filled.
  FillChangePasswordForm(FieldRendererId password_element_id,
                         FieldRendererId new_password_element_id,
                         FieldRendererId confirm_password_element_id,
                         mojo_base.mojom.String16 old_password,
                         mojo_base.mojom.String16 new_password)
      => (FormData? form_data);

  // Submits a form based on field id if all conditions for submission with
  // Enter are satisfied, i.e. the form exists, there is a submit element
  // inside a form, the submit element is not disabled.
  SubmitFormWithEnter(FieldRendererId field_id) => (bool success);

  // Notification to start (`active` == true) or stop (`active` == false)
  // logging the decisions made about saving the password.
  SetLoggingState(bool active);

  // Triggers a form submission on the last interacted element.
  [EnableIf=is_android]
  TriggerFormSubmission();

  // Annotate password related (username, password) DOM input elements with
  // corresponding HTML attributes. It is used only for debugging.
  AnnotateFieldsWithParsingResult(ParsingResult parsing_result);
};

// There is one instance of this interface per render frame in the render
// process.
interface PasswordGenerationAgent {
  // Tells the renderer to populate the correct password fields with this
  // generated password.
  GeneratedPasswordAccepted(mojo_base.mojom.String16 generated_password);

  // Tells the renderer that the generated password was rejected by the user
  // and should not be shown again in the same generation flow.
  GeneratedPasswordRejected();

  // Tells the renderer to find a focused element, and if it is a password field
  // eligible for generation then to trigger generation by returning
  // non-empty PasswordGenerationUIData.
  TriggeredGeneratePassword() => (PasswordGenerationUIData? data);

  // Tells the renderer that a password can be generated on the fields
  // identified by `form`.
  FoundFormEligibleForGeneration(PasswordFormGenerationData form);

  // Tells the renderer to advance focus to the next field after password fields
  // (assuming that password fields are adjacent in account creation).
  FocusNextFieldAfterPasswords();
};