File: autofill_driver.mojom

package info (click to toggle)
chromium 139.0.7258.138-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,120,676 kB
  • sloc: cpp: 35,100,869; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (259 lines) | stat: -rw-r--r-- 11,703 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
// 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";
import "mojo/public/mojom/base/text_direction.mojom";
import "mojo/public/mojom/base/time.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "url/mojom/url.mojom";

// There is one instance of this interface per RenderFrameHost in the browser
// process. All methods are called by renderer on browser.
interface AutofillDriver {
  // Notification that changes of the forms have been detected: the forms in
  // `updated_forms` are either new or have changed, and the forms in
  // `removed_forms` have been removed from the DOM (but may be re-added to the
  // DOM later).
  FormsSeen(array<FormData> updated_forms, array<FormRendererId> removed_forms);

  // Notification that a form has been submitted.
  FormSubmitted(FormData form,
                SubmissionSource source);

  // Notification that a form field's caret moved or selection has changed.
  //
  // `field_id` must identify a field of `form`. This is enforced by
  // ContentAutofillDriver.
  //
  // `caret_bounds` is the bounds of the caret if the selection is empty and
  // otherwise the bounds of the focus
  // (https://w3c.github.io/selection-api/#dfn-focus). That is, its width is
  // typically zero or near-zero, and its height is about one line. It is not
  // validated in any way; in particular, the coordinates may be negative or
  // otherwise outside of the bounds of the viewport.
  CaretMovedInFormField(FormData form,
                        FieldRendererId field_id,
                        gfx.mojom.Rect caret_bounds);

  // Notification that a form field's value has changed by a user edit only
  // (meaning that JavaScript-triggered changes of values of text fields do not
  // result in calling this method).
  //
  // Similarly to JavaScript's "input" event, and unlike JavaScript's "change"
  // event, it's fired for each individual alteration of the field.
  //
  // Fired on text-type input elements and textareas. Additionally it is fired
  // on contenteditables for all non-IOS platforms.
  //
  // `field_id` must identify a field of `form`. This is enforced by
  // ContentAutofillDriver.
  TextFieldValueChanged(FormData form,
                        FieldRendererId field_id,
                        mojo_base.mojom.TimeTicks timestamp);

  // Notification that editing a text-type input element ended.
  //
  // Fired (only) on element blur or document unload events.
  //
  // TODO(crbug.com/339820079): Eliminate in favour of FocusNoLongerOnForm()?
  DidEndTextFieldEditing();

  // Notification that a form field has scrolled.
  //
  // `field_id` must identify a field of `form`. This is enforced by
  // ContentAutofillDriver.
  TextFieldDidScroll(FormData form,
                     FieldRendererId field_id);

  // Notification that a form select control has changed.
  //
  // Fired when the selection in a select control changes because either:
  // - A user selected a different option.
  // - JavaScript changed the selected option in a frame with transient user
  //   activation (see blink::LocalFrame::HasTransientUserActivation).
  //
  // `field_id` must identify a field of `form`. This is enforced by
  // ContentAutofillDriver.
  SelectControlSelectionChanged(FormData form,
                                FieldRendererId field_id);

  // Notification that a select element's options were modified.
  SelectFieldOptionsDidChange(FormData form);

  // `FocusOnFormField()` xor `FocusOnNonFormField()` is fired when the focused
  // element changes (https://html.spec.whatwg.org/#focused):
  //
  // - `FocusOnFormField()` iff the newly focused element is a non-null form
  //   control element or contenteditable whose `FormData` can be extracted.
  // - `FocusOnNonFormField()` iff it does not call `FocusOnFormField()`.
  //
  // `field_id` must identify a field of `form`. This is enforced by
  // ContentAutofillDriver.
  FocusOnFormField(FormData form, FieldRendererId field_id);
  FocusOnNonFormField();

  // Queries the browser for Autofill suggestions for a form input field.
  // For autofill this means asking the user which values to fill.
  //
  // `field_id` must identify a field of `form`. This is enforced by
  // ContentAutofillDriver.
  //
  // `caret_bounds` is the bounds of the caret if the selection is empty and
  // otherwise the bounds of the focus
  // (https://w3c.github.io/selection-api/#dfn-focus). That is, its width is
  // typically zero or near-zero, and its height is about one line. It is not
  // validated in any way; in particular, the coordinates may be negative or
  // otherwise outside of the bounds of the viewport.
  AskForValuesToFill(FormData form,
                     FieldRendererId field_id,
                     gfx.mojom.Rect caret_bounds,
                     AutofillSuggestionTriggerSource trigger_source,
                     PasswordSuggestionRequest? password_request);

  // Instructs the browser to hide the Autofill popup if it is open.
  HidePopup();

  // Sent when a form is filled with Autofill suggestions.
  DidFillAutofillFormData(FormData form, mojo_base.mojom.TimeTicks timestamp);

  // Sent when a field was in autofilled state but JavaScript modified the
  // value.
  //
  // Note that from a renderer's perspective, modifying the value with
  // JavaScript leads to a state where the field is not considered autofilled
  // anymore. So this notification won't be sent again until the field gets
  // autofilled again.
  //
  // `field_id` must identify a field of `form`. This is enforced by
  // ContentAutofillDriver.
  JavaScriptChangedAutofilledValue(FormData form,
                                   FieldRendererId field_id,
                                   mojo_base.mojom.String16 old_value);
};

// There is one instance of this interface per web contents in the browser
// process that handles all the frames. The motivation was to make the interface
// associated with PasswordGenerationDriver.
interface PasswordManagerDriver {
  // Notification that password forms have been seen that are candidates for
  // filling/submitting by the password manager.
  PasswordFormsParsed(array<FormData> forms_data);

  // Notification that initial layout has occurred and the following password
  // forms are visible on the page (e.g. not set to display:none.).
  PasswordFormsRendered(array<FormData> visible_forms_data);

  // Notification that this password form was submitted by the user.
  PasswordFormSubmitted(FormData form_data);

  // Notification that a user has modified a password field. This is fired both
  // when typing new characters and deleting characters, so the password field
  // in `form_data` may or may not be empty
  InformAboutUserInput(FormData form_data);

  // Notification that a dynamic form submission was observed. This could be due
  // to a same-document navigation, detaching a frame, or hiding / removing a
  // form after an XHR.
  DynamicFormSubmission(SubmissionIndicatorEvent submission_indication_event);

  // Notification that password form was cleared. This is used as a signal of
  // a successful submission for change password forms.
  PasswordFormCleared(FormData form_data);

  // Sends `log` to browser for displaying to the user. Only strings passed as
  // an argument to methods overriding SavePasswordProgressLogger::SendLog may
  // become `log`, because those are guaranteed to be sanitized.
  // Never pass a free-form string as `log`.
  RecordSavePasswordProgress(string log);

  // Notification that the user (not JavaScript) modified the value of a
  // password field.
  UserModifiedPasswordField();

  // Notification that the user (not JavaScript) modified the value of a
  // non-password field with `renderer_id`, and `value` is the current value.
  UserModifiedNonPasswordField(
    FieldRendererId renderer_id,
    mojo_base.mojom.String16 value,
    bool autocomplete_attribute_has_username,
    bool is_likely_otp);

  // Instructs the browser to show a popup or accessory with password
  // suggestions. The popup will use `request.text_direction` for displaying
  // text. The accessory uses the `request.form` and the indices of username and
  // password elements in the form (`request.username_field_index` and
  // `request.password_field_index` respectively) to calculate submission
  // readiness for the `request.form`. If the username field is not found,
  // `request.username_field_index` is set to `request.form.fields.size()`.
  // Similar for the password field.
  ShowPasswordSuggestions(PasswordSuggestionRequest request);

  // Checks the safe browsing reputation of the website where the focused
  // username/password field is on.
  CheckSafeBrowsingReputation(
      url.mojom.Url form_action, url.mojom.Url frame_url);

  // The focus changed to a different input in the same frame (e.g. tabbed from
  // email to password field).
  FocusedInputChanged(FieldRendererId focused_field_id,
                      FocusedFieldType focused_field_type);

  // Sends the success state of filling credentials into a form. This happens
  // only if the form being filled has a renderer_id. `result` is an
  // integer serialization of autofill::FillingResult. It is passed as an
  // integer as no further interpretation of the value is necessary in the
  // browser.
  LogFirstFillingResult(FormRendererId form_renderer_id, int32 result);
};

// There is one instance of this interface per web contents in the browser
// process.
interface PasswordGenerationDriver {
  // Notifies the browser when automatic generation becomes available
  // and provides data needed by the UI.
  AutomaticGenerationAvailable(
    PasswordGenerationUIData password_generation_ui_data);

  // Instructs the browser to presave the form with generated password.
  PresaveGeneratedPassword(FormData form_data,
                           mojo_base.mojom.String16 password_value);

  // Instructs the browser that form no longer contains a generated password and
  // the presaved form should be removed.
  PasswordNoLongerGenerated(FormData form_data);

  // Instructs the browser to show the popup for editing a generated password.
  // The location should be specified in the renderers coordinate system. Form
  // is the form associated with the password field. `field_renderer_id` is the
  // ID of the password field triggering generation. On Android bottom sheet is
  // displayed instead of the editing popup.
  [EnableIfNot=is_android]
  ShowPasswordEditingPopup(
    gfx.mojom.RectF bounds,
    FormData form_data,
    FieldRendererId field_renderer_id,
    mojo_base.mojom.String16 password_value);

  // Informs the browser that the password generation option was rejected
  // by the user typing more characters than the maximum offer size into the
  // password field. Obsolete for Android since it's only a signal to hide
  // generation popup.
  [EnableIfNot=is_android]
  PasswordGenerationRejectedByTyping();

  // Communicates to the browser that a scroll event happened on the frame. This
  // event affects the password generation popup position. On Android bottom
  // sheet is displayed instead of generation popup.
  [EnableIfNot=is_android]
  FrameWasScrolled();

  // Informs the browser that the generation element lost focus, so the browser
  // might hide the generation popup. On Android bottom sheet is displayed
  // instead of generation popup.
  [EnableIfNot=is_android]
  GenerationElementLostFocus();
};