1// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto2";
6
7option optimize_for = LITE_RUNTIME;
8option java_package = "org.chromium.chrome.browser.autofill_assistant.proto";
9option java_multiple_files = true;
10
11package autofill_assistant;
12
13import "generic_ui.proto";
14import "model.proto";
15import "view_layout.proto";
16
17// A field trial containing the name of the trial and the name of the
18// randomly selected trial group.
19message FieldTrialProto {
20  optional string trial_name = 1;
21  optional string group_name = 2;
22}
23
24// Context contains client environment details.
25message ClientContextProto {
26  message Chrome {
27    optional string chrome_version = 1;
28    repeated FieldTrialProto active_field_trials = 2;
29  }
30  oneof client { Chrome chrome = 1; }
31
32  // locale will be the language tag of the default locale. The tag should
33  // be a well-formed IETF BCP 47 language tag with language and country code
34  // (e.g., "en-US").
35  // The intent is to communicate the client language preferences to the server.
36  optional string locale = 5;
37
38  // country should be a country code as defined by ISO 3166-1-alpha-2.
39  // The intent is to communicate the client's location to the server.
40  optional string country = 6;
41
42  // Experiment ids string provided by the 'caller'.
43  optional string experiment_ids = 7;
44
45  // True if the script is called from a Chrome Custom Tab created for Autofill
46  // Assistant.
47  optional bool is_cct = 8;
48
49  // True if the onboarding screen was shown to the user.
50  optional bool is_onboarding_shown = 10;
51
52  // True if the script was triggered by a direct action.
53  optional bool is_direct_action = 9;
54
55  message DeviceContextProto {
56    message VersionProto {
57      // The Android SDK version of the device.
58      optional int32 sdk_int = 1;
59    }
60    optional VersionProto version = 1;
61
62    // The manufacturer of the device.
63    optional string manufacturer = 2;
64
65    // The model of the device.
66    optional string model = 3;
67  }
68  optional DeviceContextProto device_context = 11;
69
70  enum AccountsMatchingStatus {
71    // The account was not present in the intent.
72    UNKNOWN = 0;
73
74    // The account in the intent and the current chrome account match.
75    ACCOUNTS_MATCHING = 1;
76
77    // The account in the intent and the current chrome account DON'T match.
78    ACCOUNTS_NOT_MATCHING = 2;
79  }
80  // Whether the account from the intent and the chrome account match.
81  optional AccountsMatchingStatus accounts_matching_status = 12;
82
83  // Whether a11y (talkback and touch exploration) is enabled or not.
84  optional bool accessibility_enabled = 13;
85
86  enum SignedIntoChromeStatus {
87    UNDEFINED = 0;
88
89    // There is no account signed into Chrome.
90    NOT_SIGNED_IN = 1;
91
92    // An account is signed into Chrome.
93    SIGNED_IN = 2;
94  }
95  optional SignedIntoChromeStatus signed_into_chrome_status = 14;
96}
97
98// Get the list of scripts that can potentially be run on a url.
99message SupportsScriptRequestProto {
100  optional string url = 1;
101
102  // Parameters that can be used to filter the scripts suitable for execution.
103  repeated ScriptParameterProto script_parameters = 2;
104
105  optional ClientContextProto client_context = 3;
106}
107
108message ScriptParameterProto {
109  // Parameter name, as found in the Intent, without prefix.
110  optional string name = 3;
111  optional string value = 2;
112}
113
114// Response of the list of supported scripts.
115message SupportsScriptResponseProto {
116  repeated SupportedScriptProto scripts = 1;
117
118  // Defines what should happen if no scripts in [scripts] becomes runnable,
119  // because of preconditions.
120  optional ScriptTimeoutError script_timeout_error = 2;
121
122  optional ClientSettingsProto client_settings = 3;
123}
124
125// Overlay image to be drawn on top of full overlays.
126message OverlayImageProto {
127  // TODO(b/170202574): Remove legacy |image_url|.
128  // If set, |image_size| is mandatory.
129  oneof image {
130    // Deprecated, but currently still supported. The image to display.
131    string image_url = 1;
132    // The image to display.
133    DrawableProto image_drawable = 8;
134  }
135  // The size of the image to display.
136  optional ClientDimensionProto image_size = 2;
137  // The margin between the top of the page (anchor) and the image.
138  optional ClientDimensionProto image_top_margin = 3;
139  // The margin between the bottom of the image and the baseline of the text.
140  optional ClientDimensionProto image_bottom_margin = 4;
141  // The text to display beneath the image. If set, |text_color| and |text_size|
142  // are mandatory.
143  optional string text = 5;
144  // Supported formats: #RRGGBB or #AARRGGBB.
145  optional string text_color = 6;
146  // The size of the text to display.
147  optional ClientDimensionProto text_size = 7;
148}
149
150message ClientSettingsProto {
151  message IntegrationTestSettings {
152    // Disables animations for the poodle and the progress bar.
153    optional bool disable_header_animations = 1;
154    // Disables change animations in the actions carousel.
155    optional bool disable_carousel_change_animations = 2;
156  }
157
158  // Time between two periodic script precondition checks.
159  optional int32 periodic_script_check_interval_ms = 1;
160
161  // Time between two element checks in the script executor.
162  optional int32 periodic_element_check_interval_ms = 2;
163
164  // Run that many periodic checks before giving up unless something happens to
165  // wake it up, such as the user touching the screen.
166  optional int32 periodic_script_check_count = 3;
167
168  // Time between two element position refreshes, when displaying highlighted
169  // areas in prompt state.
170  optional int32 element_position_update_interval_ms = 4;
171
172  // Maximum amount of time normal actions should implicitly wait for a selector
173  // to show up.
174  optional int32 short_wait_for_element_deadline_ms = 5;
175
176  // Time to wait between two checks of the box model, when waiting for an
177  // element to become stable, such as before clicking.
178  optional int32 box_model_check_interval_ms = 6;
179
180  // Maximum number of checks to run while waiting for the element position to
181  // become stable.
182  optional int32 box_model_check_count = 7;
183
184  // Maximum time to wait until document has reached "ready" state.
185  optional int32 document_ready_check_timeout_ms = 20;
186
187  // How much time to give users to tap undo when they tap a cancel button.
188  optional int32 cancel_delay_ms = 12;
189
190  // If the user taps the overlay that many time within |tap_duration| turn the
191  // UI off and give them |tap_shutdown_delay| to undo. If 0, unexpected taps
192  // are ignored.
193  optional int32 tap_count = 13;
194
195  // Reset the unexpected tap counter after that time.
196  optional int32 tap_tracking_duration_ms = 14;
197
198  // How much time to give users to tap undo when after |tap_count| unexpected
199  // taps where
200  optional int32 tap_shutdown_delay_ms = 15;
201
202  // Optional image drawn on top of overlays.
203  optional OverlayImageProto overlay_image = 16;
204
205  // Optional settings intended for integration tests.
206  optional IntegrationTestSettings integration_test_settings = 17;
207
208  // Optional setting defining the size of the bottom sheet when Talkback is
209  // enabled as a fraction of the available height. When set, the bottomsheet
210  // will stop resizing automatically in talkback mode. It will always have the
211  // specified size instead.
212  optional float talkback_sheet_size_fraction = 18;
213
214  // Strings to define the back button behaviour. This will show the user a
215  // message with an Undo button. If this setting is not present, the back
216  // button will show a Snackbar with Undo option.
217  message BackButtonSettings {
218    // The message being shown in the header.
219    optional string message = 1;
220
221    // The label of the highlighted "Undo" action.
222    optional string undo_label = 2;
223  }
224  optional BackButtonSettings back_button_settings = 19;
225
226  reserved 8 to 11;
227}
228
229message ScriptTimeoutError {
230  // Wait for that long before considering that scripts preconditions have timed
231  // out and executing the script specified in script_path.
232  //
233  // The script might be called more than once if the script terminates
234  // successfully and again still nothing is found after timeout_ms.
235  optional int32 timeout_ms = 1;
236
237  // The script to execute when the error happens.
238  optional string script_path = 2;
239}
240
241// Supported script.
242message SupportedScriptProto {
243  // This is the internal name of the script.
244  optional string path = 1;
245
246  message PresentationProto {
247    // Precondition contains a set of conditions that must hold for a script to
248    // be executed. No precondition means that a script can run in any case.
249    optional ScriptPreconditionProto precondition = 3;
250
251    // Text display at the same time as the script is proposed. If more than one
252    // script has an initial prompt, the prompt of the highest-priority script
253    // wins.
254    optional string initial_prompt = 4;
255
256    // Display priority of the script. Lowest number has highest priority, which
257    // means a script with priority 0 should be displayed before a script with
258    // priority 1.
259    optional int32 priority = 5;
260
261    // An optional chip to display.
262    optional ChipProto chip = 12;
263
264    // Optionally map this script to a direct action.
265    optional DirectActionProto direct_action = 13;
266
267    // When set to true this script can be run in 'autostart mode'.
268    optional bool autostart = 8;
269
270    // When set to true this script will be run from WaitForDom actions with
271    // allow_interrupt=true.
272    optional bool interrupt = 9;
273
274    // Message to show once the script has been started. This is shown while
275    // loading the actions.
276    optional string start_message = 14;
277
278    // Show the UI if it's not shown yet. Setting this to false is useful for
279    // scripts started by direct actions.
280    optional bool needs_ui = 15 [default = true];
281  }
282  optional PresentationProto presentation = 2;
283}
284
285enum ScriptStatusProto {
286  // Never explicitly set. Reading this value means the enum field is either
287  // not set or set to a value not listed here.
288  UNKNOWN_SCRIPT_STATUS = 0;
289  // The script finished successfully.
290  SCRIPT_STATUS_SUCCESS = 1;
291  // The script failed.
292  SCRIPT_STATUS_FAILURE = 2;
293  // The user cancelled the script.
294  SCRIPT_STATUS_CANCELLED = 3;
295  // The script is currently running.
296  SCRIPT_STATUS_RUNNING = 4;
297  // The script was not run.
298  SCRIPT_STATUS_NOT_RUN = 5;
299}
300
301// Condition on the status of a previous script run.
302message ScriptStatusMatchProto {
303  enum Comparator {
304    UNSPECIFIED = 0;
305    EQUAL = 1;
306    DIFFERENT = 2;
307  }
308
309  // Required. Path of the script whose status should be checked.
310  optional string script = 1;
311
312  // Required. The status the script should have for the condition to hold.
313  optional ScriptStatusProto status = 2;
314
315  // Optional. The comparison performed when checking the status. It will be
316  // interpreted as EQUAL if not set.
317  optional Comparator comparator = 3;
318}
319
320message ScriptPreconditionProto {
321  // Pattern of the path parts of the URL, including query and '#''.
322  repeated string path_pattern = 5;
323  // Domain (exact match) excluding the last '/' character.
324  repeated string domain = 6;
325
326  // Combined with AND: all matches must be true for precondition to hold.
327  repeated ScriptParameterMatchProto script_parameter_match = 7;
328  repeated ScriptStatusMatchProto script_status_match = 8;
329
330  // Script can only run if the given condition match.
331  optional ElementConditionProto element_condition = 10;
332
333  reserved 3, 9;
334}
335
336message ScriptParameterMatchProto {
337  // Parameter name, as found in the Intent, without prefix.
338  optional string name = 4;
339
340  // Checks whether the script parameter is present.
341  optional bool exists = 2 [default = true];
342
343  // Checks whether the script parameter has exact value. Empty or missing value
344  // is treated as wildcard - any value will pass.
345  optional string value_equals = 3;
346}
347
348enum PolicyType {
349  UNKNOWN_POLICY = 0;
350  SCRIPT = 1;
351}
352
353message ScriptActionRequestProto {
354  optional ClientContextProto client_context = 7;
355
356  // Global payload from the previous response, possibly for another script.
357  optional bytes global_payload = 8;
358
359  // Script payload from the previous response, for the same script.
360  //
361  // For backward compatibility, for initial requests, forward the last returned
362  // script_payload.
363  optional bytes script_payload = 2;
364
365  oneof request {
366    InitialScriptActionsRequestProto initial_request = 4;
367    NextScriptActionsRequestProto next_request = 5;
368  }
369}
370
371// Initial request to get a script's actions.
372message InitialScriptActionsRequestProto {
373  message QueryProto {
374    // The backend expects the |script_path| to be a repeated field. This field
375    // is expected to contain only one element.
376    repeated string script_path = 1;
377    // The exact URL on which the script was initially started.
378    optional string url = 2;
379    optional PolicyType policy = 3;
380  }
381  optional QueryProto query = 3;
382
383  repeated ScriptParameterProto script_parameters = 2;
384}
385
386message RoundtripTimingStats {
387  // Reports how long it took for the previous roundtrip to the backend to
388  // complete.
389  optional int64 roundtrip_time_ms = 1;
390  // Reports the total client processing time for the executed batch of actions.
391  optional int64 client_time_ms = 2;
392}
393
394// Next request to get a script's actions.
395message NextScriptActionsRequestProto {
396  // The result of processing each ActionProto from the previous response. This
397  // field must be in the same order as the actions in the original response.
398  // It may have less actions in case of failure.
399  repeated ProcessedActionProto processed_actions = 1;
400  // Contains all roundtrip level (as opposed to action level) timing stats.
401  optional RoundtripTimingStats timing_stats = 2;
402}
403
404// Response of a script's actions.
405message ActionsResponseProto {
406  // Opaque data to send to the next ScriptActionRequestProto.
407  optional bytes global_payload = 4;
408
409  // Opaque data to send to the next ScriptActionRequestProto for the same
410  // script.
411  optional bytes script_payload = 2;
412
413  // Actions to be performed in order.
414  // Should stop processing as soon as an action fails.
415  repeated ActionProto actions = 3;
416
417  // List of scripts to update.
418  //
419  // The client is expected to update the cache of scripts with this new
420  // information. No action is needed when this field is not set. If the field
421  // is set with an empty list of scripts, then no script is eligible to run
422  // anymore.
423  //
424  // Note: This is an intermediate solution and the logic associated with this
425  // field will eventually be absorbed into the supports script response from
426  // the backend.
427  message UpdateScriptListProto { repeated SupportedScriptProto scripts = 1; }
428  optional UpdateScriptListProto update_script_list = 5;
429}
430
431// Can be used to indicate the presence of a field, without the ambiguity that
432// a boolean field would have.
433message Empty {}
434
435// RPC request to fetch the available trigger scripts for a particular domain.
436message GetTriggerScriptsRequestProto {
437  // The exact url for which to fetch the trigger scripts.
438  optional string url = 1;
439  // The client context.
440  // NOTE: Currently, this will only contain the Chrome version number for
441  // privacy reasons.
442  optional ClientContextProto client_context = 2;
443  // Optional debug script parameters.
444  repeated ScriptParameterProto debug_script_parameters = 3;
445}
446
447// The RPC response to a |GetTriggerScriptsRequestProto|.
448message GetTriggerScriptsResponseProto {
449  // The available trigger scripts, if any.
450  repeated TriggerScriptProto trigger_scripts = 1;
451
452  // A list of additional domains and subdomains. Trigger scripts will
453  // automatically cancel the ongoing session if the user navigates away from
454  // the original domain or any of the additional domains.
455  repeated string additional_allowed_domains = 2;
456
457  // The amount of time a trigger script may evaluate trigger conditions while
458  // invisible. If a trigger script is invisible for this amount of time, it
459  // will automatically finish with LITE_SCRIPT_TRIGGER_CONDITION_TIMEOUT.
460  // If not specified, there is no automatic timeout.
461  //
462  // This is only counted while no trigger script is shown, and the time is
463  // reset on tab switch and whenever a trigger script is hidden. Note that this
464  // only counts the time in-between checks, so the actual timeout will be
465  // slightly longer.
466  optional int32 timeout_ms = 3;
467
468  // The amount of time between consecutive checks of trigger conditions. Should
469  // not be too small to limit performance impact.
470  optional int32 trigger_condition_check_interval_ms = 4 [default = 1000];
471}
472
473// A trigger script contains the full specification for a trigger script that is
474// run when a specific condition is true, prior to the full run.
475message TriggerScriptProto {
476  enum TriggerScriptAction {
477    UNDEFINED = 0;
478    // The current trigger script is cancelled. If the prompt is not currently
479    // being shown, this has no effect. If the prompt is currently being shown,
480    // the prompt is hidden and the trigger script is restarted once the trigger
481    // condition has become false again.
482    NOT_NOW = 1;
483    // Cancels the current trigger script and does not restart it for this
484    // session.
485    CANCEL_SESSION = 2;
486    // Cancels the current trigger script and prevents trigger scripts from ever
487    // running again. TODO(b/172039582): allow a per-domain opt-out.
488    CANCEL_FOREVER = 3;
489    // Displays a popup to give users additional cancel options.
490    SHOW_CANCEL_POPUP = 4;
491    // Stop the trigger script and start the regular script.
492    ACCEPT = 5;
493  }
494
495  // The |trigger_condition| must be true for the script to trigger.
496  optional TriggerScriptConditionProto trigger_condition = 1;
497
498  // The user interface to show.
499  optional TriggerScriptUIProto user_interface = 3;
500
501  // What should happen if the user swipe-dismisses the bottom sheet.
502  optional TriggerScriptAction on_swipe_to_dismiss = 4
503      [default = CANCEL_SESSION];
504
505  reserved 2;
506}
507
508message TriggerScriptConditionProto {
509  oneof type {
510    // The condition matches if all of these conditions match.
511    TriggerScriptConditionsProto all_of = 1;
512    // The condition matches if at least one of these conditions matches.
513    TriggerScriptConditionsProto any_of = 2;
514    // The condition matches if none of these conditions match.
515    TriggerScriptConditionsProto none_of = 3;
516
517    // The condition matches if the specified selector matches the current DOM..
518    SelectorProto selector = 8;
519    // The condition matches if the user has stored login credentials for the
520    // domain.
521    Empty stored_login_credentials = 5;
522    // The condition matches if the user has never seen a trigger script before.
523    Empty is_first_time_user = 6;
524    // The condition matches if the client is in the specified experiment.
525    int32 experiment_id = 7;
526    // The condition matches if the keyboard is hidden.
527    Empty keyboard_hidden = 9;
528  }
529
530  reserved 4;
531}
532
533message TriggerScriptConditionsProto {
534  repeated TriggerScriptConditionProto conditions = 1;
535}
536
537message TriggerScriptUIProto {
538  message ProgressBar {
539    repeated DrawableProto step_icons = 1;
540    optional int32 active_step = 2;
541  }
542
543  message TriggerChip {
544    optional ChipProto chip = 1;
545    optional TriggerScriptProto.TriggerScriptAction action = 2;
546  }
547  message Popup {
548    message Choice {
549      // The text to display.
550      optional string text = 1;
551      // The action to execute if this popup item is selected.
552      optional TriggerScriptProto.TriggerScriptAction action = 2;
553    }
554    // The available popup items.
555    repeated Choice choices = 1;
556  }
557
558  // The status message to display.
559  optional string status_message = 1;
560  // The callout to display. If not specified, no callout will be shown.
561  optional string callout_message = 2;
562  // The progress bar to display. If not specified, no progress bar will be
563  // shown.
564  optional ProgressBar progress_bar = 3;
565  // The cancel popup, usually associated with a particular chip.
566  optional Popup cancel_popup = 4;
567  // The available left-aligned chips, specified in order from left to right.
568  repeated TriggerChip left_aligned_chips = 5;
569  // The available right-aligned chips, specified in order from left to right.
570  repeated TriggerChip right_aligned_chips = 6;
571  // The status message to display when transitioning from this trigger script
572  // to the regular script.
573  optional string regular_script_loading_status_message = 7;
574  // Whether the visual viewport should be resized to allow scrolling to the
575  // bottom of the page while the trigger script is being displayed.
576  optional bool resize_visual_viewport = 8;
577  // Whether the bottom sheet should temporarily disappear when scrolling down
578  // the website, to move out of the way.
579  //
580  // The value of resize_visual_viewport is ignored when scroll_to_hide is true.
581  // This allows the backend setting both to true and letting chrome choose
582  // scroll_to_hide if it is supported.
583  optional bool scroll_to_hide = 9;
584}
585
586enum KeyboardValueFillStrategy {
587  UNSPECIFIED_KEYBAORD_STRATEGY = 0;
588
589  // Send a `node.value = "<value>"` JS command.
590  SET_VALUE = 1;
591
592  // Send a `node.value = ""` JS command to clear the field, then click the
593  // field to focus it and send single key strokes.
594  SIMULATE_KEY_PRESSES = 2;
595
596  // Send a `node.select()` JS command to select the current field value, then
597  // send single key strokes overwriting the current value.
598  SIMULATE_KEY_PRESSES_SELECT_VALUE = 3;
599
600  // Send a `node.value = ""` JS command to clear the field, then send a
601  // `node.focus()` JS command to focus the field and send single key strokes.
602  SIMULATE_KEY_PRESSES_FOCUS = 4;
603}
604
605// Note: On multiple matches, the first one will be selected.
606enum DropdownSelectStrategy {
607  UNSPECIFIED_SELECT_STRATEGY = 0;
608
609  // Match by the option's value, case insensitive.
610  VALUE_MATCH = 1;
611
612  // Match by the option's label, case insensitive.
613  LABEL_MATCH = 2;
614
615  // Match by the option's label by `label.startsWith`, case insensitive.
616  LABEL_STARTS_WITH = 3;
617}
618
619// This type disambiguates the term "clicking" on a node in the DOM by defining
620// what strategy should be used to execute the "click".
621enum ClickType {
622  NOT_SET = 0;
623
624  // Send a tap event to the node.
625  TAP = 1;
626
627  // Use JavaScript's `node.click()` to click the element.
628  JAVASCRIPT = 2;
629
630  // Send a click event to the node.
631  CLICK = 3;
632}
633
634message AutofillValue {
635  message Profile { optional string identifier = 1; }
636
637  // The profile to be used. This has to be requested with a
638  // |CollectUserDataAction| first.
639  optional Profile profile = 1;
640
641  // A string containing any number of "${key}" placeholders, where the key is
642  // an integer corresponding to entries from field_types.h or
643  // |AutofillFormatProto::AutofillAssistantCustomField|.
644  // Note that the set of actually available fields are outside of our
645  // control and are retrieved automatically from the provided profile.
646  optional string value_expression = 2;
647}
648
649// An action could be performed.
650message ActionProto {
651  // Wait these many milliseconds before executing the action, if set.
652  optional int32 action_delay_ms = 3;
653
654  // Opaque data that should not be interpreted by the client. The client must
655  // pass this back unchanged in the next request
656  optional bytes server_payload = 4;
657
658  oneof action_info {
659    ClickProto click = 5;
660    SetFormFieldValueProto set_form_value = 6;
661    SelectOptionProto select_option = 7;
662    NavigateProto navigate = 9;
663    PromptProto prompt = 10;
664    TellProto tell = 11;
665    ShowCastProto show_cast = 12;
666    WaitForDomProto wait_for_dom = 19;
667    UseCreditCardProto use_card = 28;
668    UseAddressProto use_address = 29;
669    UploadDomProto upload_dom = 18;
670    ShowProgressBarProto show_progress_bar = 24;
671    HighlightElementProto highlight_element = 31;
672    ShowDetailsProto show_details = 32;
673    StopProto stop = 35;
674    CollectUserDataProto collect_user_data = 36;
675    SetAttributeProto set_attribute = 37;
676    ShowInfoBoxProto show_info_box = 39;
677    ExpectNavigationProto expect_navigation = 40;
678    WaitForNavigationProto wait_for_navigation = 41;
679    ConfigureBottomSheetProto configure_bottom_sheet = 42;
680    ShowFormProto show_form = 43;
681    PopupMessageProto popup_message = 44;
682    WaitForDocumentProto wait_for_document = 45;
683    ShowGenericUiProto show_generic_ui = 49;
684    GeneratePasswordForFormFieldProto generate_password_for_form_field = 52;
685    SaveGeneratedPasswordProto save_generated_password = 53;
686    ConfigureUiStateProto configure_ui_state = 54;
687    PresaveGeneratedPasswordProto presave_generated_password = 55;
688    GetElementStatusProto get_element_status = 56;
689  }
690
691  // Set to true to make the client remove any contextual information if the
692  // script finishes with this action. It has no effect if there is any other
693  // action sent to the client after this one. Default is false.
694  optional bool clean_contextual_ui = 33;
695
696  reserved 8, 13 to 17, 20 to 23, 25 to 27, 30, 34, 38, 46 to 48, 50, 51;
697}
698
699// Result of |CollectUserDataProto| to be sent to the server.
700message CollectUserDataResultProto {
701  optional string card_issuer_network = 1;
702  // Whether the integrated terms and conditions approval checkbox was checked.
703  optional bool is_terms_and_conditions_accepted = 2;
704  // The email address of the payer.
705  optional string payer_email = 3;
706  // If set, this means that the user triggered the action in
707  // |CollectUserDataProto.additional_actions| that has index
708  // |additional_action_index|.
709  optional int32 additional_action_index = 4;
710  // If set, this means that the user clicked on one of the terms and conditions
711  // links.
712  optional int32 terms_link = 5;
713  // The payload of the chosen login option.
714  optional bytes login_payload = 6;
715  // The values obtained by the generic user interface.
716  optional ModelProto model = 9;
717  // The memory keys of all non-empty text inputs, corresponding to the memory
718  // keys specified in |TextInputProto|. The values themselves are stored in the
719  // client and do not leave the device.
720  repeated string set_text_input_memory_keys = 10;
721  // The start date of the date/time range, if requested.
722  optional DateProto date_range_start_date = 11;
723  // The index of the selected timeslot for the start of the date/time range.
724  optional int32 date_range_start_timeslot = 12;
725  // The end date of the date/time range, if requested.
726  optional DateProto date_range_end_date = 13;
727  // The index of the selected timeslot for the end of the date/time range.
728  optional int32 date_range_end_timeslot = 14;
729  // The values obtained from the additional sections.
730  repeated ModelProto.ModelValue additional_sections_values = 15;
731  // Indicates whether the UI was shown to the user. This can be false if
732  // only the login section was requested and the choice was implicitly made.
733  optional bool shown_to_user = 16;
734  // Indicates that the chosen login option was missing the username.
735  optional bool login_missing_username = 17;
736  // Indicates what profile data is available for the Contact.
737  repeated string non_empty_contact_field = 18;
738  // Indicates what profile data is available for the Shipping address.
739  repeated string non_empty_shipping_address_field = 19;
740  // Indicates what profile data is available for the Billing address.
741  repeated string non_empty_billing_address_field = 20;
742
743  reserved 7, 8;
744}
745
746message ActionTimingStats {
747  // Requested delay before executing the action.
748  optional int64 delay_ms = 1;
749  // Time actively spent by the client to execute the action.
750  optional int64 active_time_ms = 2;
751  // Time spent waiting for users to complete a task and/or for website
752  // loading/navigation.
753  optional int64 wait_time_ms = 3;
754}
755
756message ProcessedActionProto {
757  // The action that was processed.
758  optional ActionProto action = 1;
759
760  optional ProcessedActionStatusProto status = 2;
761
762  optional ProcessedActionStatusDetailsProto status_details = 19;
763
764  oneof result_data {
765    PromptProto.Result prompt_choice = 5;
766    // Should be set as a result of CollectUserDataAction.
767    CollectUserDataResultProto collect_user_data_result = 15;
768    // Should be set as a result of SetFormFieldValueAction.
769    SetFormFieldValueProto.Result set_form_field_value_result = 17;
770    // May be set as a result of WaitForDomProto.
771    WaitForDomProto.Result wait_for_dom_result = 22;
772    // Should be set as a result of FormAction.
773    FormProto.Result form_result = 21;
774    WaitForDocumentProto.Result wait_for_document_result = 25;
775    // Should be set as a result of ShowGenericUiProto.
776    ShowGenericUiProto.Result show_generic_ui_result = 28;
777    // Should be set as a result of GetElementStatusProto.
778    GetElementStatusProto.Result get_element_status_result = 31;
779    // Should be set as a result of UploadDomProto.
780    UploadDomProto.Result upload_dom_result = 33;
781  }
782
783  // Reports information about navigation that happened while
784  // processing the action. This is meant for debugging.
785  optional NavigationInfoProto navigation_info = 20;
786
787  // Reports how long it took for the client to run the action. This does not
788  // include the delay specified in action.delay_ms.
789  optional int64 run_time_ms = 23;
790
791  // Collects the timing stats related to the action execution.
792  optional ActionTimingStats timing_stats = 32;
793
794  // If true, the user triggered, during the client action, at least one user
795  // action, such as a prompt choice, through a direct action instead of
796  // selecting a chip on the UI. This is meant for monitoring and debugging.
797  optional bool direct_action = 24;
798
799  reserved 3, 4, 6 to 14, 16, 18, 26, 27, 29, 30;
800}
801
802// Extended information about the action status, which provides more details
803// about what happened than a simple ProcessedActionStatusProto can.
804message ProcessedActionStatusDetailsProto {
805  // More information included for unexpected errors.
806  //
807  // Only set for action whose status are OTHER_ACTION_STATUS or
808  // UNEXPECTED_JS_ERROR.
809  optional UnexpectedErrorInfoProto unexpected_error_info = 1;
810
811  // In some case, such as USER_ABORTED_ACTION and NAVIGATION_ERROR, the status
812  // reported by the action is overridden after the action failed, to report a
813  // more appropriate error. When that happens, this field contains the original
814  // status, to help debugging.
815  optional ProcessedActionStatusProto original_status = 2;
816
817  // More information included for autofill related errors.
818  optional AutofillErrorInfoProto autofill_error_info = 3;
819
820  // More information included for |SetFormFieldValueProto| related errors.
821  optional SetFormFieldErrorInfoProto form_field_error_info = 4;
822
823  // Additional information from the |WebController|.
824  optional WebControllerErrorInfoProto web_controller_error_info = 5;
825}
826
827message NavigationInfoProto {
828  // Navigation started while processing the current action.
829  optional bool started = 1;
830
831  // Navigation ended while processing the current action.
832  optional bool ended = 2;
833
834  // Navigation failed before or during the processing of the current action.
835  optional bool has_error = 3;
836
837  // Unexpected navigation started while processing the current action. This
838  // will happen during some actions, such as PROMPT action but it should
839  // normally not happen during scripts that have been updated to use
840  // expect_navigation.
841  optional bool unexpected = 4;
842}
843
844// Extra debugging information included in case of unexpected errors.
845//
846// Presence of this element is usually the sign of a bug in the client code and
847// is always the sign that the client code needs to be updated: such issues
848// should be either fixed or reported as proper, expected error with a useful
849// status code.
850message UnexpectedErrorInfoProto {
851  // Source file, within the client code, where an unexpected error was detected
852  // and reported.
853  //
854  // Only filled for unexpected errors OTHER_ACTION_STATUS and
855  // UNEXPECTED_JS_ERROR.
856  //
857  // This and source_line are only meaningful for the exact version reported in
858  // the client context.
859  optional string source_file = 1;
860
861  // Line number, within the client's source file, where the error was detected.
862  optional int32 source_line_number = 2;
863
864  // JavaScript exception class name, if reporting a JavaScript error.
865  optional string js_exception_classname = 3;
866
867  // JavaScript exception line number, within the js snippet that was sent to
868  // devtools runtime by the client, if reporting a JavaScript error.
869  optional int32 js_exception_line_number = 4;
870
871  // JavaScript exception column number, within the js snippet that was sent to
872  // devtools runtime by the client, if reporting a JavaScript error.
873  optional int32 js_exception_column_number = 5;
874
875  // Error code returned by devtools, if any. 0 is considered a success.
876  optional int32 devtools_error_code = 6;
877
878  // Error message returned by devtools, if any.
879  optional string devtools_error_message = 7;
880}
881
882// Message to report autofill related errors for debugging purposes.
883message AutofillErrorInfoProto {
884  message AutofillFieldError {
885    // The field the error occurred for.
886    optional SelectorProto field = 1;
887
888    // The value expression associated with the field that caused the error.
889    optional string value_expression = 5;
890
891    oneof error_type {
892      // No fallback value for this field.
893      bool no_fallback_value = 3;
894
895      // The status of the action.
896      ProcessedActionStatusProto status = 4;
897
898      // The field was required and expected to be filled during the fallback
899      // flow but was empty in the end.
900      bool empty_after_fallback = 6;
901
902      // The field was expected to be cleared during the fallback flow but
903      // still had a value in the end.
904      bool filled_after_clear = 7;
905    }
906
907    reserved 2;
908  }
909
910  // Comma separated list of address keys in the client memory when the
911  // unexpected error occurred. Memory values are never reported this way since
912  // they may contain PII. Only the address key names!
913  optional string client_memory_address_key_names = 1;
914
915  // Name of the address key requested in the list of keys in
916  // |client_memory_address_key_names|.
917  optional string address_key_requested = 2;
918
919  // Whether the client memory at |address_key_requested| pointed to null.
920  optional bool address_pointee_was_null = 3;
921
922  // Error status of the Chrome autofill attempt.
923  optional ProcessedActionStatusProto autofill_error_status = 4;
924
925  // Errors that occurred during fallback filling of autofill fields.
926  repeated AutofillFieldError autofill_field_error = 5;
927}
928
929// Message to report |SetFormFieldValueProto| related errors for debugging
930// purposes.
931message SetFormFieldErrorInfoProto {
932  // The index of |keypress| that caused the action to be invalid.
933  optional int32 invalid_keypress_index = 1;
934}
935
936// Message to report errors related to WebController execution.
937message WebControllerErrorInfoProto {
938  enum WebAction {
939    UNSPECIFIED_WEB_ACTION = 0;
940
941    // Scroll an element into view by centering it on the page. This uses
942    // native JS functionality.
943    SCROLL_INTO_VIEW = 1;
944
945    // Waiting for the document ready state to be interactive.
946    WAIT_FOR_DOCUMENT_TO_BECOME_INTERACTIVE = 2;
947
948    // Send a click or tap event to an element.
949    CLICK_OR_TAP_ELEMENT = 3;
950
951    // Select an option from an HTML dropdown.
952    SELECT_OPTION = 4;
953
954    // Set the element's style to be highlighted by adding a BoxShadow to the
955    // element.
956    HIGHLIGHT_ELEMENT = 5;
957
958    // Scroll the element into view with padding. This does not use native JS
959    // functionality but calculates the scrolling manually.
960    SCROLL_INTO_VIEW_WITH_PADDING = 6;
961
962    // Get the |value| attribute of an element.
963    GET_FIELD_VALUE = 7;
964
965    // Get any attribute of an element.
966    GET_STRING_ATTRIBUTE = 8;
967
968    // Select an element's value. This does only work for text elements.
969    SELECT_FIELD_VALUE = 9;
970
971    // Set the |value| attribute of an element.
972    SET_VALUE_ATTRIBUTE = 10;
973
974    // Set any attribute of an element.
975    SET_ATTRIBUTE = 11;
976
977    // Send a series of keystroke inputs. This requires an element to have
978    // focus to receive them.
979    SEND_KEYBOARD_INPUT = 12;
980
981    // Get the outer HTML of an element.
982    GET_OUTER_HTML = 13;
983
984    // Get the tag of an element.
985    GET_ELEMENT_TAG = 14;
986
987    // Set active focus on a field.
988    FOCUS_FIELD = 15;
989
990    // Wait for an element position to stabilize before clicking or a tapping.
991    // Fails with ELEMENT_UNSTABLE.
992    WAIT_UNTIL_ELEMENT_IS_STABLE = 16;
993
994    // Check that the element is on top, usually as part of clicking.
995    // Fails with ELEMENT_NOT_ON_TOP.
996    ON_TOP = 17;
997
998    // Waiting for a certain document ready state failed.
999    WAIT_FOR_DOCUMENT_READY_STATE = 18;
1000  }
1001
1002  // The web-action that failed. This is usually a step in an execution chain
1003  // for an action.
1004  optional WebAction failed_web_action = 1;
1005}
1006
1007// The pseudo type values come from
1008// https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-PseudoType.
1009enum PseudoType {
1010  UNDEFINED = 0;
1011  FIRST_LINE = 1;
1012  FIRST_LETTER = 2;
1013  BEFORE = 3;
1014  AFTER = 4;
1015  BACKDROP = 5;
1016  SELECTION = 6;
1017  FIRST_LINE_INHERITED = 7;
1018  SCROLLBAR = 8;
1019  SCROLLBAR_THUMB = 9;
1020  SCROLLBAR_BUTTON = 10;
1021  SCROLLBAR_TRACK = 11;
1022  SCROLLBAR_TRACK_PIECE = 12;
1023  SCROLLBAR_CORNER = 13;
1024  RESIZER = 14;
1025  INPUT_LIST_BUTTON = 15;
1026}
1027
1028// A reference to one or more elements on the page, possibly nested in frames.
1029message SelectorProto {
1030  // Filters for the element on the page. Filter are applied sequentially, using
1031  // the output of the previous filter as input. The root of these filters is
1032  // the main frame's document.
1033  repeated Filter filters = 9;
1034
1035  // A filter that starts with one or more elements and returns one on more
1036  // elements. Filters are meant to be applied sequentially.
1037  //
1038  // The returned elements will be sorted by their order in the document.
1039  // Elements that were matched via the labelled filter will have the same order
1040  // as their label.
1041  message Filter {
1042    oneof filter {
1043      // Enter the document of an iframe or shadow root. The next filters apply
1044      // to the document inside of the iframe(s) or on the shadow element.
1045      //
1046      // Fails if there are more than one match.
1047      EmptyFilter enter_frame = 1;
1048
1049      // Evaluate the given CSS selector on all start elements and use
1050      // the result as end elements.
1051      string css_selector = 2;
1052
1053      // Check the inner text of all start elements, using the Javascript
1054      // innerText property. Keep only the element whose innerText match the
1055      // given regular expression.
1056      TextFilter inner_text = 3;
1057
1058      // Check the value of all start elements, using the Javascript value
1059      // property. Keep only the element whose value property match the given
1060      // regular expression.
1061      TextFilter value = 4;
1062
1063      // Select the pseudo-element of the given type associated with the current
1064      // elements.
1065      PseudoType pseudo_type = 5;
1066
1067      // Only keep elements that have a box model, even if it is empty.
1068      //
1069      // This is the equivalent of the old MUST_BE_VISIBLE flag. It's been
1070      // renamed as having a bounding box is not enough to imply visibility.
1071      BoundingBoxFilter bounding_box = 6;
1072
1073      // Take the nth match. Fails with ELEMENT_RESOLUTION_FAILED if there are
1074      // not enough matches.
1075      NthMatchFilter nth_match = 7;
1076
1077      // Only keep elements that have a pseudo-element with the given content.
1078      //
1079      // This only works with BEFORE and AFTER.
1080      //
1081      // Note that this just filters out elements. It doesn't select the
1082      // pseudo-element; use pseudo_type for that.
1083      //
1084      // Deprecated: prefer css_style. This should be removed in Chrome M89.
1085      PseudoElementContent pseudo_element_content = 8;
1086
1087      // Go from label to the labelled control. Only works starting with current
1088      // elements that are LABEL.
1089      //
1090      // For example if we have:
1091      //  <label for="someid">First Name</label>...<input id="someid" ...>
1092      // then labelled, goes from the label to the form element.
1093      //
1094      // So, the form element can be accessed as "label~=/FirstName/ labelled".
1095      // This is especially useful in situations where someid can change.
1096      //
1097      // The same selector also works in the case where the element is inside of
1098      // the label, so we don't need to worry which implementation is used when
1099      // building the selector:
1100      //   <label>First Name <input ...></label>
1101      EmptyFilter labelled = 9;
1102
1103      // Filter elements by their position on the page, relative to a given
1104      // target element.
1105      //
1106      // The distance between two elements is the shortest euclidean distance
1107      // between their borders. The distance between two overlapping elements is
1108      // always 0. If there are multiple elements at exactly the same distance,
1109      // an arbitrary one is returned.
1110      ProximityFilter closest = 10;
1111
1112      // Only keep results that match the given CSS selector.
1113      string match_css_selector = 11;
1114
1115      // Only keep elements whose computed style match the given filter. This is
1116      // based on Window.computedStyle()
1117      CssStyleFilter css_style = 12;
1118
1119      // Filter out elements whose center point are covered by another element.
1120      //
1121      // This first calls Element.scrollIntoViewIfNeeded to make sure the
1122      // element can be moved to the viewport, then calls
1123      // DocumentOrShadowDom.getElementFromPoint and compares the result with
1124      // the expected element. If the element at point is not the element, a
1125      // descendant of the element or a label of the element, there is an
1126      // overlay.
1127      //
1128      // Note that:
1129      //
1130      // - this filter will also weed out elements with no bounding box. Check
1131      // with bounding_box { } first.
1132      //
1133      // - this filter will also weed out elements that cannot be scrolled into
1134      // the viewport.
1135      //
1136      // - an element might be covered by an overlay and still be visible if the
1137      // overlay is transparent. An element might be covered by an overlay and
1138      // still be clickable, if the overlay intercepts and forwards events.
1139      // Overlays with pointer-events set to none are ignored.
1140      //
1141      // - an element might be only partially covered by an overlay. This filter
1142      // only checks the center of the element, since this is where the click
1143      // action sends its clicks or taps.
1144      //
1145      // - this filter only detects overlays in the current frame. To detect
1146      // overlays that cover the frame element itself, apply this filter on the
1147      // frame element before calling enter_frame.
1148      OnTopFilter on_top = 13;
1149    }
1150  }
1151
1152  // A way of filtering elements by their text.
1153  message TextFilter {
1154    // Javascript RE2 regular expression to apply to the text. This is evaluated
1155    // with Regexp.test, so it's a "find" and will be satisfied whenever the
1156    // text contains at least one substring that matches the given regular
1157    // expression.
1158    optional string re2 = 1;
1159
1160    // If true, the regular expression is case-sensitive.
1161    optional bool case_sensitive = 2;
1162  }
1163
1164  // A way of filtering elements by their pseudo-element content.
1165  message PseudoElementContent {
1166    optional PseudoType pseudo_type = 1;
1167    optional TextFilter content = 2;
1168  }
1169
1170  // Only keep elements whose computed style match the given filter. This is
1171  // based on Window.computedStyle()
1172  //
1173  // See
1174  // https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
1175  message CssStyleFilter {
1176    // CSS property name.
1177    optional string property = 3;
1178
1179    // Name of the pseudo-element whose style should be checked. Leave it unset
1180    // or set to the empty string to check the style of the real element.
1181    //
1182    // This is the pseudoElt argument of JavaScript's
1183    // window.getComputedStyle(element, [, pseudoElt]).
1184    optional string pseudo_element = 4;
1185
1186    // By default the text filter in |value| must match. Set this to false to
1187    // require the text condition not to match.
1188    optional bool should_match = 5 [default = true];
1189
1190    // CSS property value match.
1191    //
1192    // Valid computed CSS properties always have a value, even if it's a default
1193    // value. The default value depends on the property.
1194    optional TextFilter value = 6;
1195
1196    reserved 1, 2;
1197  }
1198
1199  // Filter elements by their position on the page, relative to a given target
1200  // element.
1201  message ProximityFilter {
1202    // From the set of potential matches, choose the one closest to the given
1203    // target. The target filters are evaluated relative to the current frame
1204    // and must select an element in the current frame.
1205    //
1206    // If there is no target the whole selector matches nothing.
1207    //
1208    // This element cannot include enter_frame filters.
1209    repeated Filter target = 1;
1210
1211    // If true, the element and targets must be aligned either
1212    // horizontally or vertically.
1213    //
1214    // This is usually what we want, as elements close, but in diagonal position
1215    // relative to each other are usually not considered part of the same group.
1216    optional bool in_alignment = 3;
1217
1218    // Require the target and element to have a specific relative position.
1219    //
1220    // If unspecified, the target and element be in any position relative to
1221    // each other.
1222    //
1223    // If necessary, this can be combined with in_alignment, so in_aligment=true
1224    // relative_position=LEFT requires the element to be strictly to the left or
1225    // target.
1226    optional RelativePosition relative_position = 4;
1227
1228    enum RelativePosition {
1229      // Unspecified relative position.
1230      UNSPECIFIED_POSITION = 0;
1231
1232      // Element is above target.
1233      ABOVE = 1;
1234
1235      // Element is below target.
1236      BELOW = 2;
1237
1238      // Element is left of target.
1239      LEFT = 3;
1240
1241      // Element is right of target.
1242      RIGHT = 4;
1243    }
1244
1245    // Maximum number of pairs the client is allowed to compare.
1246    //
1247    // If there are too many pairs to compare, the client bails out and returns
1248    // the status TOO_MANY_CANDIDATES to the server.
1249    //
1250    // The maximum number of pairs is limited, to avoid clients being slowed
1251    // down by overly expensive selectors, as the current algorithm is not
1252    // optimized for large number of pairs. Authors of selectors must take care
1253    // to keep the number of pairs reasonable.
1254    //
1255    // For example, avoid looking for "a div near label X". This will be too
1256    // slow to process. Look instead for "a button near label X" or "a clickable
1257    // div near label X".
1258    //
1259    // This setting must not be exposed to scripts. It must not be increased
1260    // just to allow that one slow selector. This is a value that must be
1261    // maintained by the team responsible for keeping clients running properly.
1262    optional int32 max_pairs = 5 [default = 50];
1263  }
1264
1265  // Only keep elements that have a bounding box.
1266  message BoundingBoxFilter {
1267    // If require_nonempty=false, which is the default, require elements to have
1268    // at least one bounding rect returned by Element.getClientRects()
1269    //
1270    // If require_nonempty=true, additionally require the element's bounding
1271    // client rect to have a nonzero width and height.
1272    optional bool require_nonempty = 1;
1273  }
1274
1275  // Filter out elements covered by other elements, such as overlays.
1276  message OnTopFilter {
1277    // If true, scroll the element into view before checking whether
1278    // it's on top.
1279    //
1280    // The logic for checking whether an element is on top only works on
1281    // elements that are positioned within the current viewport. Setting it to
1282    // false turns off automatic scrolling to make the element visible, so the
1283    // caller must make sure it's already the case.
1284    optional bool scroll_into_view_if_needed = 1 [default = true];
1285
1286    // If true and the element cannot be scrolled into view, so the filter
1287    // cannot check whether the element is on top, keep the element in the match
1288    // set.
1289    //
1290    // This can be combined with scroll_into_view_if_needed=false to make
1291    // this filter best effort and only check elements that are already in view.
1292    optional bool accept_element_if_not_in_view = 2;
1293  }
1294
1295  message EmptyFilter {}
1296
1297  message NthMatchFilter {
1298    // Take the match at the given |index|.
1299    optional int32 index = 1;
1300  }
1301
1302  reserved 1 to 8;
1303}
1304
1305// Contain all arguments to perform a click.
1306message ClickProto {
1307  optional SelectorProto element_to_click = 1;
1308  optional ClickType click_type = 2;
1309
1310  // Configure whether click should check whether the element is the topmost
1311  // element before clicking on it.
1312  //
1313  // If set to REQUIRE_STEP_SUCCESS, click might fail with ELEMENT_NOT_ON_TOP.
1314  optional OptionalStep on_top = 3;
1315}
1316
1317enum OptionalStep {
1318  STEP_UNSPECIFIED = 0;
1319  SKIP_STEP = 1;
1320  REPORT_STEP_RESULT = 2;
1321  REQUIRE_STEP_SUCCESS = 3;
1322}
1323
1324// Contain all arguments to perform a select option action.
1325message SelectOptionProto {
1326  // The drop down element on which to select an option.
1327  optional SelectorProto element = 2;
1328
1329  oneof value {
1330    // Value of the option to use.
1331    string selected_option = 3;
1332    // A value from an Autofill source. Note that this must be proceeded by a
1333    // |CollectUserDataAction|.
1334    AutofillValue autofill_value = 5;
1335  }
1336
1337  // The strategy used to select a value option. This defaults to
1338  // |LABEL_STARTS_WITH| for the legacy case.
1339  optional DropdownSelectStrategy select_strategy = 4
1340      [default = LABEL_STARTS_WITH];
1341
1342  reserved 1;
1343}
1344
1345// Contain a localized text message from the server.
1346message TellProto {
1347  // The message to show in the status bar. The behavior is now the following
1348  //
1349  //  * If the field is set, the status bar is updated (explicitly setting an
1350  //    empty string clears the status bar).
1351  //  * If the field is not set, the status bar is not updated.
1352  optional string message = 1;
1353
1354  // Show the UI if it's not shown yet, such as when a script has been started
1355  // by a direct action.
1356  optional bool needs_ui = 2 [default = true];
1357}
1358
1359// Contain all arguments to show cast on an element.
1360message ShowCastProto {
1361  message TopPadding {
1362    oneof top_padding {
1363      // Padding in CSS pixels. Eg. 20.
1364      int32 pixels = 1;
1365      // Ratio in relation to the window.innerHeight. Eg. 0.25.
1366      float ratio = 2;
1367    }
1368  }
1369
1370  // Element to scroll to.
1371  optional SelectorProto element_to_present = 1;
1372
1373  // Optional title to show in the status bar.
1374  optional string title = 2;
1375
1376  // Restrict interaction to the area spanned by the given elements.
1377  //
1378  // Deprecated: use touchable_element_area instead. Ignored if
1379  // touchable_element_area is non-empty.
1380  repeated SelectorProto deprecated_touchable_elements = 5;
1381
1382  // Restrict interaction to a series of rectangular areas.
1383  optional ElementAreaProto touchable_element_area = 6;
1384
1385  // The padding that will be added between the focused element and the top.
1386  optional TopPadding top_padding = 7;
1387
1388  // Configure whether the scrolling should wait for the element to be stable
1389  // before scrolling.
1390  //
1391  // If set to REQUIRE_STEP_SUCCESS, scrolling may fail with ELEMENT_UNSTABLE.
1392  optional OptionalStep wait_for_stable_element = 9;
1393
1394  // Maximum rounds to stable check.
1395  optional int32 stable_check_max_rounds = 10 [default = 50];
1396
1397  // Interval for stable check in ms.
1398  optional int32 stable_check_interval_ms = 11 [default = 200];
1399
1400  reserved 3, 4, 8;
1401}
1402
1403// An area made up of rectangles whole border are made defined by the position
1404// of a given set of elements.
1405message ElementAreaProto {
1406  // A rectangle, drawn by one or more elements.
1407  //
1408  // The rectangle is the smallest rectangle that includes all listed elements.
1409  message Rectangle {
1410    repeated SelectorProto elements = 1;
1411
1412    // If true, the width of the rectangle always corresponds to the width of
1413    // the screen.
1414    optional bool full_width = 2;
1415  }
1416
1417  // The rectangles that will be highlighted and touchable.
1418  repeated Rectangle touchable = 1;
1419
1420  // The rectangles that should be neither highlighted nor touchable. Those
1421  // rectangles have precedence over the |touchable| rectangles.
1422  repeated Rectangle restricted = 2;
1423}
1424
1425// Fill a form with an address if there is, otherwise fail this action.
1426message UseAddressProto {
1427  // Message used to indicate what form fields should be filled with what
1428  // information coming from the address.
1429  message RequiredField {
1430    // A string containing any number of "${key}" placeholders, where the key
1431    // is an integer corresponding to entries from field_types.h or
1432    // |AutofillFormatProto::AutofillAssistantCustomField|.
1433    // Example:
1434    // * "3" -> First name.
1435    // * "${3}" -> First name.
1436    // * "(+${12}) (${11}) ${10}" -> phone country code, city code, number,
1437    //   e.g., (+41) (79) (1234567)
1438    // Note that the set of actually available fields are outside of our
1439    // control and are retrieved automatically from the provided profile.
1440    // An value expression set to an empty string will clear the field.
1441    optional string value_expression = 6;
1442
1443    optional SelectorProto element = 2;
1444
1445    // The strategy used to execute filling the value.
1446    optional KeyboardValueFillStrategy fill_strategy = 7;
1447
1448    // The strategy used to select a value option.
1449    optional DropdownSelectStrategy select_strategy = 8;
1450
1451    // Delay between two key presses when simlulating.
1452    optional int32 delay_in_millisecond = 4 [default = 20];
1453
1454    // Fill in the fill even if it's non-empty. This is useful to work around
1455    // cases where the way autofill sets the field doesn't work on the website.
1456    // Usually used together with simulate_key_presses.
1457    optional bool forced = 5;
1458
1459    // For JavaScript implemented dropdowns. This first clicks on the |element|,
1460    // then waits for |option_element_to_click| to appear and clicks it. The
1461    // selector must match a generic option, an |inner_text_pattern| will be
1462    // added to this element reference to match a single option.
1463    // Both clicks use the same |click_type|.
1464    optional SelectorProto option_element_to_click = 9;
1465    optional ClickType click_type = 10;
1466
1467    reserved 1, 3;
1468  }
1469
1470  oneof address_source {
1471    // The client memory key from which to retrieve the address.
1472    string name = 1;
1473    // The client model identifier from which to retrieve the address.
1474    string model_identifier = 9;
1475  }
1476
1477  // Reference to an element in the form that should be filled.
1478  optional SelectorProto form_field_element = 4;
1479
1480  // An optional list of fields that should be filled by this action.
1481  repeated RequiredField required_fields = 6;
1482
1483  // If true, this skips the Autofill step jumping straight to the
1484  // |required_fields|.
1485  optional bool skip_autofill = 10;
1486
1487  reserved 2, 7, 8;
1488}
1489
1490// Fill a form with a credit card if there is one stored in client memory,
1491// otherwise fail this action.
1492message UseCreditCardProto {
1493  // Message used to indicate what form fields should be filled with what
1494  // information.
1495  message RequiredField {
1496    // A string containing any number of "${key}" placeholders, where the key
1497    // is an integer corresponding to entries from field_types.h or
1498    // |AutofillFormatProto::AutofillAssistantCustomField|.
1499    // Example:
1500    // * "51" -> Full name.
1501    // * "${51}" -> Full Name.
1502    // * "${53}/${55}" -> expiration month / expiration year
1503    // Note that the set of actually available fields are outside of our
1504    // control and are retrieved automatically from the provided credit card.
1505    // An value expression set to an empty string will clear the field.
1506    optional string value_expression = 6;
1507
1508    optional SelectorProto element = 2;
1509
1510    // The strategy used to execute filling the value.
1511    optional KeyboardValueFillStrategy fill_strategy = 7;
1512
1513    // The strategy used to select a value option.
1514    optional DropdownSelectStrategy select_strategy = 8;
1515
1516    // Delay between two key presses when simlulating.
1517    optional int32 delay_in_millisecond = 4 [default = 20];
1518
1519    // Fill in the fill even if it's non-empty. This is useful to work around
1520    // cases where the way autofill sets the field doesn't work on the website.
1521    // Usually used together with simulate_key_presses.
1522    optional bool forced = 5;
1523
1524    // For JavaScript implemented dropdowns. This first clicks on the |element|,
1525    // then waits for |option_element_to_click| to appear and clicks it. The
1526    // selector must match a generic option, an |inner_text_pattern| will be
1527    // added to this element reference to match a single option.
1528    // Both clicks use the same |click_type|.
1529    optional SelectorProto option_element_to_click = 9;
1530    optional ClickType click_type = 10;
1531
1532    reserved 1, 3;
1533  }
1534
1535  // The client model identifier from which to retrieve the credit card.
1536  // If not specified, will use the card stored in client memory instead.
1537  optional string model_identifier = 4;
1538
1539  // A reference to the card number field in the form that should be filled.
1540  optional SelectorProto form_field_element = 3;
1541
1542  repeated RequiredField required_fields = 7;
1543
1544  // If true, this skips the Autofill step jumping straight to the
1545  // |required_fields|.
1546  optional bool skip_autofill = 8;
1547
1548  reserved 1, 5, 6;
1549}
1550
1551// Ask Chrome to wait for an element in the DOM. This can be used to only
1552// proceed to the next action once the page is ready.
1553message WaitForDomProto {
1554  // Fail after waiting this amount of time.
1555  optional int32 timeout_ms = 1;
1556
1557  // Wait until this condition becomes true. If, at the end of the timeout, the
1558  // condition is not true, returns ELEMENT_RESOLUTION_FAILED.
1559  optional ElementConditionProto wait_condition = 9;
1560
1561  // If true, run scripts flagged with 'interrupt=true' as soon as their
1562  // preconditions match.
1563  optional bool allow_interrupt = 3;
1564
1565  reserved 4 to 8;
1566
1567  // Result to include into ProcessedActionProto.
1568  message Result {
1569    // Payload of all matching conditions, if one is set.
1570    repeated bytes matching_condition_payloads = 1;
1571  }
1572}
1573
1574// A condition that expects a specific combination of elements. An empty
1575// condition is true.
1576message ElementConditionProto {
1577  oneof type {
1578    // The condition matches if all of these conditions match.
1579    ElementConditionsProto all_of = 1;
1580
1581    // The condition matches if at least one of these conditions matches.
1582    ElementConditionsProto any_of = 2;
1583
1584    // The condition matches if none of these conditions match.
1585    ElementConditionsProto none_of = 3;
1586
1587    // The condition matches if the given element exists. An empty
1588    // ElementReference never match.
1589    SelectorProto match = 4;
1590  }
1591
1592  // A payload that identifies this condition. WaitForDom puts this payload
1593  // into the result. This is ignored outside of WaitForDom.
1594  optional bytes payload = 5;
1595}
1596
1597message ElementConditionsProto {
1598  repeated ElementConditionProto conditions = 1;
1599}
1600
1601// Volatile upload of a portion of the dom for backend analysis, does not store
1602// anything.
1603message UploadDomProto {
1604  message Result {
1605    // The outer HTML of the element(s) matched by |tree_root|.
1606    repeated string outer_htmls = 1;
1607  }
1608
1609  // The element that should be a root of uploaded DOM. If empty then the whole
1610  // page is returned.
1611  optional SelectorProto tree_root = 1;
1612
1613  // Whether |tree_root| can match multiple elements. If false and multiple
1614  // elements are matched, this action will fail with TOO_MANY_MATCHES.
1615  optional bool can_match_multiple_elements = 2;
1616}
1617
1618// Shows the progress bar.
1619message ShowProgressBarProto {
1620  // Message to show on the progress bar while loading.
1621  optional string message = 3;
1622
1623  oneof progress_indicator {
1624    // Value between 0 and 100 indicating the current progress. Values above 100
1625    // will be capped to 100, values below 0 will be capped to 0 by the client.
1626    int32 progress = 6;
1627
1628    // Value between 0 and |N| (where N is the size of the initial
1629    // |step_icons|) indicating the current step the flow is in, marking
1630    // all previous steps as complete. The active step will not be marked as
1631    // complete but instead be marked as active with a pulsating animation.
1632    // Setting the value to |N| or -1 will mark all steps as complete with no
1633    // step being active anymore.
1634    int32 active_step = 8;
1635
1636    // The string reference of an icon defined in the
1637    // |StepProgressBarConfiguration|. This sets the |active_step| to that icon
1638    // with the same logic as |active_step| itself.
1639    string active_step_identifier = 11;
1640
1641    // Completes the progress in whichever progress bar is active.
1642    bool complete_progress = 12;
1643  }
1644
1645  // Whether the step progress bar should go into an error state.
1646  // If the active step is smaller than |N|, this will simply mark the last icon
1647  // as failed. If the active step is |N|, meaning that all steps have been
1648  // completed, this will mark the entire progress bar as failed.
1649  optional bool error_state = 10;
1650
1651  // Hide the progress bar in the UI.
1652  optional bool hide = 7;
1653
1654  message StepProgressBarIcon {
1655    optional DrawableProto icon = 1;
1656
1657    // The reference identifier of this step.
1658    optional string identifier = 2;
1659  }
1660
1661  // The configuration of the step progress bar. Only has an impact if the new
1662  // progress bar is being used. This configuration should only be sent once in
1663  // the initial call of the progress bar, as each appearance may cause the
1664  // progress bar being rerendered. The previous configuration will be carried
1665  // over in each new progress |ShowProgressBarAction|.
1666  message StepProgressBarConfiguration {
1667    // This boolean should always be true, unless you wish to switch to the
1668    // old progress bar during the flow. This is not recommended!
1669    optional bool use_step_progress_bar = 1;
1670
1671    // Set the icons for the new progress bar. The size of the |step_icons|
1672    // gives the length of the progress bar. As such an empty list is not
1673    // supported. The list needs to be at least 2 items long.
1674    repeated StepProgressBarIcon annotated_step_icons = 3;
1675
1676    reserved 2;
1677  }
1678  optional StepProgressBarConfiguration step_progress_bar_configuration = 9;
1679
1680  reserved 1, 2, 4, 5;
1681}
1682
1683// Contain all arguments to perform a highlight element action.
1684message HighlightElementProto {
1685  // The element to highlight.
1686  optional SelectorProto element = 1;
1687}
1688
1689// Controls the browser navigation.
1690message NavigateProto {
1691  oneof value {
1692    // Navigate to the given URL.
1693    string url = 1;
1694    // Navigate backward in the history. Action will return PRECONDITION_FAILED
1695    // if it is not possible.
1696    bool go_backward = 2;
1697    // Navigate forward in the history. Action will return PRECONDITION_FAILED
1698    // if it is not possible.
1699    bool go_forward = 3;
1700  }
1701}
1702
1703// Specify from which point in the script navigation is expected for the next
1704// call to WaitForNavigation.
1705message ExpectNavigationProto {}
1706
1707// Wait for the browser to have navigated to a new page since the last
1708// ExpectNavigation or Navigate. This returns as soon as an HTTP response that's
1709// not a redirect was received for the new page, possibly before even loading
1710// the page content.
1711//
1712// Will return immediately if navigation already happened.
1713//
1714// Client errors:
1715//   NAVIGATION_ERROR if navigation failed
1716//   TIMED_OUT if timed out waiting for navigation to start
1717//   INVALID_ACTION no ExpectNavigation or Navigate action was executed in the
1718//     current script.
1719message WaitForNavigationProto {
1720  // How long to wait for navigation to start before failing with client status
1721  // TIMED_OUT. The action waits 20s by default.
1722  //
1723  // This is usually used to track cases where expected navigation doesn't
1724  // happen, because, for example, a click wasn't registered.
1725  optional int32 timeout_ms = 1;
1726}
1727
1728// Chrome document.readyState values.
1729//
1730// Number is significant, as the document goes through these state in order,
1731// from initialized to complete.
1732enum DocumentReadyState {
1733  option allow_alias = true;
1734
1735  DOCUMENT_UNKNOWN_READY_STATE = 0;
1736  DOCUMENT_UNINITIALIZED = 1;
1737  DOCUMENT_LOADING = 2;
1738  DOCUMENT_LOADED = 3;
1739  DOCUMENT_INTERACTIVE = 4;
1740  DOCUMENT_COMPLETE = 5;
1741
1742  // Maximum value above.
1743  DOCUMENT_MAX_READY_STATE = 5;
1744}
1745
1746// Wait for the document to be ready before proceeding.
1747//
1748// Client errors:
1749//   TIMED_OUT if timed out waiting for an acceptable state.
1750//   ELEMENT_RESOLUTION_FAILED if the specified frame selector could not be
1751//   found.
1752message WaitForDocumentProto {
1753  // Maximum amount of time to wait for the state to change. Set it to 0 to
1754  // check once and report the result immediately, without waiting.
1755  optional int32 timeout_ms = 1 [default = 5000];
1756
1757  // If specified, check the document in the given frame, instead
1758  // of the main document.
1759  optional SelectorProto frame = 2;
1760
1761  // The minimum ready state needed to satisfy the requirement.
1762  optional DocumentReadyState min_ready_state = 3
1763      [default = DOCUMENT_INTERACTIVE];
1764
1765  message Result {
1766    // The ready state found when the action started.
1767    optional DocumentReadyState start_ready_state = 1;
1768
1769    // The ready state found when the action ended.
1770    //
1771    // This is filled even when the action fails, so it is not guaranteed to
1772    // match min_ready_state.
1773    optional DocumentReadyState end_ready_state = 2;
1774  }
1775}
1776
1777// Show backend-specified user interface elements to the user.
1778//
1779// Note that this action will behave similar to a prompt, i.e., it requires a
1780// specific EndAction interaction (usually tied to tapping a Chip) to end.
1781//
1782// Client errors:
1783//   INVALID_ACTION if |generic_user_interface| was ill-defined or incomplete,
1784//   or if the client failed to instantiate the UI for some reason. The Chrome
1785//   log should contain additional information about the issue, if verbose
1786//   logging is enabled (suggested level: 2 or 3).
1787message ShowGenericUiProto {
1788  message RequestAutofillCreditCards { optional string model_identifier = 1; }
1789  message RequestAutofillProfiles { optional string model_identifier = 1; }
1790  message RequestLoginOptions {
1791    message PasswordManagerLogins {
1792      optional string sublabel = 1;
1793      optional bytes payload = 2;
1794    }
1795    message LoginOption {
1796      oneof type {
1797        LoginOptionProto custom_login_option = 1;
1798        PasswordManagerLogins password_manager_logins = 2;
1799      }
1800    }
1801
1802    repeated LoginOption login_options = 1;
1803    optional string model_identifier = 2;
1804  }
1805  message RequestUserData {
1806    message AdditionalValue {
1807      // The client memory identifier (from |UserData|).
1808      optional string source_identifier = 1;
1809      // The model identifier to write the value to (to |UserModel|).
1810      optional string model_identifier = 2;
1811    }
1812    // Additional values to write from |UserData| to |UserModel|.
1813    repeated AdditionalValue additional_values = 1;
1814  }
1815  message Result {
1816    // The model containing the values for all keys specified in
1817    // |output_model_identifiers|.
1818    optional ModelProto model = 1;
1819    // Set to true if the action was interrupted by a navigation event.
1820    optional bool navigation_ended = 2;
1821  }
1822
1823  // The generic user interface to show.
1824  optional GenericUserInterfaceProto generic_user_interface = 1;
1825
1826  // The set of model identifiers to write to the result. Note: this must be a
1827  // subset of the input model identifiers!
1828  repeated string output_model_identifiers = 2;
1829
1830  // If specified, available autofill credit cards will be provided and
1831  // auto-updated in the specified |model_identifier|.
1832  optional RequestAutofillCreditCards request_credit_cards = 3;
1833
1834  // If specified, available autofill profiles will be provided and auto-updated
1835  // in the specified |model_identifier|.
1836  optional RequestAutofillProfiles request_profiles = 4;
1837
1838  // If specified, available login options (including those provided by password
1839  // manager) will be provided and auto-updated in the specified
1840  // |model_identifier|.
1841  optional RequestLoginOptions request_login_options = 5;
1842
1843  message PeriodicElementChecks {
1844    message ElementCheck {
1845      // The element condition to be checked during the action.
1846      optional ElementConditionProto element_condition = 1;
1847      // The model identifier to write the result to.
1848      optional string model_identifier = 2;
1849    }
1850    repeated ElementCheck element_checks = 1;
1851  }
1852  optional PeriodicElementChecks periodic_element_checks = 6;
1853  // When set to true, end this action on navigation events. The result will
1854  // have |navigation_ended| set to true.
1855  optional bool end_on_navigation = 7;
1856  // If true, run scripts flagged with |interrupt=true| as soon as their
1857  // preconditions match, then go back to the parent action.
1858  optional bool allow_interrupt = 8;
1859  // If specified, will write the requested values from |UserData| to
1860  // |UserModel|. Will fail the action with PRECONDITION_FAILED if any of the
1861  // requested values is missing. Note that all values will have
1862  // |is_client_side_only| set to true.
1863  optional RequestUserData request_user_data = 9;
1864
1865  reserved 10;
1866}
1867
1868// Allow choosing one or more possibility. If ShowCast was called just
1869// before, allow interaction with the touchable element area, otherwise don't
1870// allow any interactions.
1871message PromptProto {
1872  // Display this message to the user.
1873  optional string message = 1;
1874
1875  // A choice that can be triggered:
1876  // - by clicking on a chip, if a chip is set
1877  // - by triggering a direct action, if direct action names are set
1878  // - indirectly, DOM change, if auto_select_when if set
1879  //
1880  // One of these protos must is transmitted as-is back to the server as part of
1881  // ProcessedActionProto.
1882  message Choice {
1883    // The chip to display to the UI.
1884    optional ChipProto chip = 11;
1885
1886    // Map this choice to a direct action.
1887    optional DirectActionProto direct_action = 12;
1888
1889    // Auto-select this choice when the condition is met.
1890    optional ElementConditionProto auto_select_when = 15;
1891
1892    // This chip is only visible or enabled if this condition is met.
1893    optional ElementConditionProto show_only_when = 16;
1894
1895    // Disable the chip instead of hiding it completely, if the preconditions
1896    // don't match.
1897    optional bool allow_disabling = 9;
1898
1899    // Server payload originally sent by the server. This should
1900    // be transmitted as-is by the client without interpreting.
1901    optional bytes server_payload = 5;
1902
1903    reserved 4, 6, 8, 13, 14, 17;
1904  }
1905  repeated Choice choices = 4;
1906
1907  // If true, run scripts flagged with 'interrupt=true' as soon as their
1908  // preconditions match, then go back to the prompt.
1909  optional bool allow_interrupt = 5;
1910
1911  // If this is true, then we do not force expand the sheet when entering the
1912  // prompt state. When false or not set, this keeps the default behavior.
1913  optional bool disable_force_expand_sheet = 6;
1914
1915  // If this is true, go into browse mode where navigation and user gestures
1916  // like go_back do not shut down autofill assistant.
1917  // TODO(marianfe): Consider introducing a BrowseAction instead.
1918  optional bool browse_mode = 7;
1919
1920  // EXPERIMENTAL.
1921  // Only relevant if |browse_mode| is true. If set, the bottom sheet will
1922  // completely disappear when the action starts, and re-appear when the action
1923  // ends.
1924  //
1925  // Note: invisible prompts can't show chips to the user. This flag is intended
1926  // to be used with prompts that exclusively use choices which are
1927  // auto-selected based on DOM state, i.e., |auto_select_when|.
1928  optional bool browse_mode_invisible = 10;
1929
1930  // When set to true, end prompt on navigation events happening during a prompt
1931  // action. The result sent back to the server in
1932  // ProcessedActionProto.prompt_choice will have |navigation_ended| set to
1933  // true.
1934  optional bool end_on_navigation = 8;
1935
1936  // A list of domains and subdomains to allow users to navigate to when in
1937  // browse mode.
1938  repeated string browse_domains_allowlist = 9;
1939
1940  // Result to pass to ProcessedActionProto.
1941  message Result {
1942    // This field is only used when crafting a response Choice for the server
1943    // when the |end_on_navigation| option is set. It means there was a
1944    // navigation event while in prompt mode that ended the action.
1945    optional bool navigation_ended = 2;
1946
1947    // Server payload originally found in Choice.server_payload. This should be
1948    // transmitted as-is by the client without interpreting.
1949    optional bytes server_payload = 5;
1950
1951    reserved 1;
1952  }
1953}
1954
1955message ContactDetailsProto {
1956  // A subset of fields available for autofill profiles. See
1957  // |components/autofill/code/browser/field_types.h|.
1958  enum AutofillContactField {
1959    NAME_FULL = 7;
1960    EMAIL_ADDRESS = 9;
1961    PHONE_HOME_WHOLE_NUMBER = 14;
1962  }
1963
1964  // Data saved under this name can be reused by UseAddressAction.
1965  optional string contact_details_name = 1;
1966  // If true asks user for full name.
1967  optional bool request_payer_name = 2;
1968  // If true asks user for email.
1969  optional bool request_payer_email = 3;
1970  // If true asks user for phone.
1971  optional bool request_payer_phone = 4;
1972  // This controls the summary of the selected contact in the collapsed contact
1973  // section (one line per field, in the order specified, up to and including
1974  // |max_number_summary_fields| lines).
1975  repeated AutofillContactField summary_fields = 5;
1976  // The maximum number of lines for the selected contact in the collapsed
1977  // contact section.
1978  optional int32 max_number_summary_lines = 6;
1979  // This controls the full description of contacts in the expanded contact
1980  // section (one line per field, in the order specified, up to and including
1981  // |max_number_full_lines| lines).
1982  repeated AutofillContactField full_fields = 7;
1983  // The maximum number of lines for contacts in the expanded contact section.
1984  optional int32 max_number_full_lines = 8;
1985  // If present, it will be used as the title to be displayed for the contact
1986  // details section instead of the default one.
1987  optional string contact_details_section_title = 9;
1988}
1989
1990message LoginDetailsProto {
1991  // A custom login option which will be handled by the backend, e.g.,
1992  // 'Guest checkout' or 'Log in with Google'.
1993  message LoginOptionCustomProto {
1994    // The label to display to the user.
1995    optional string label = 1;
1996  }
1997
1998  // Offers all matching Chrome password manager logins for the current website.
1999  message LoginOptionPasswordManagerProto {}
2000
2001  message LoginOptionProto {
2002    // If set, an info icon will be shown that displays a popup when tapped.
2003    optional InfoPopupProto info_popup = 6;
2004
2005    // The optional sublabel to display beneath the label.
2006    optional string sublabel = 7;
2007    optional string sublabel_accessibility_hint = 8;
2008
2009    // If the option was chosen, this payload will be returned to the server.
2010    optional bytes payload = 1;
2011
2012    // Whether the UI should automatically choose this login option if no
2013    // password manager login options are available.
2014    optional bool choose_automatically_if_no_stored_login = 2;
2015
2016    // Determines the priority with which to pre-select this login choice.
2017    // The lower the value, the higher the priority.
2018    optional int32 preselection_priority = 3;
2019    oneof type {
2020      LoginOptionCustomProto custom = 4;
2021      LoginOptionPasswordManagerProto password_manager = 5;
2022    }
2023  }
2024  // The title for the login selection (e.g., 'Login details for <domain>').
2025  optional string section_title = 1;
2026  // The list of available login options.
2027  repeated LoginOptionProto login_options = 2;
2028}
2029
2030message DateTimeRangeProto {
2031  message TimeSlot {
2032    // The label to display.
2033    optional string label = 1;
2034    // The comparison value to be used to compare this timeslot
2035    // to others. Smaller values indicate earlier times. This will be used to
2036    // prevent start > end and vice-versa.
2037    optional int32 comparison_value = 2;
2038  }
2039
2040  // The initial start date of the date/time range.
2041  optional DateProto start_date = 15;
2042  // The index of the initial start time slot to select.
2043  optional int32 start_time_slot = 13;
2044  // The initial end date of the date/time range.
2045  optional DateProto end_date = 16;
2046  // The index of the initial end time slot to select.
2047  optional int32 end_time_slot = 14;
2048  // The minimum allowed date of the date/time range.
2049  optional DateProto min_date = 3;
2050  // The maximum allowed date of the date/time range.
2051  optional DateProto max_date = 4;
2052  // The label for the start date (e.g., 'Pick up date').
2053  optional string start_date_label = 8;
2054  // The label for the start time (e.g., 'Pick up time').
2055  optional string start_time_label = 9;
2056  // The label for the end date (e.g., 'Drop off date').
2057  optional string end_date_label = 10;
2058  // The label for the end time (e.g., 'Drop off time').
2059  optional string end_time_label = 11;
2060  // The time slots to offer (e.g., 08:00 AM, 08:30 AM, ...)
2061  repeated TimeSlot time_slots = 12;
2062  // The error message to display if the date is not set.
2063  optional string date_not_set_error = 17;
2064  // The error message to display if the time is not set.
2065  optional string time_not_set_error = 18;
2066
2067  reserved 1, 2, 5, 6, 7;
2068}
2069
2070// A section showing a simple text message.
2071message StaticTextSectionProto {
2072  // The text to display. Can contain markup tags like <b>.
2073  optional string text = 1;
2074}
2075
2076// A single text input.
2077message TextInputProto {
2078  optional string hint = 1;
2079  enum InputType {
2080    UNDEFINED = 0;
2081    // Regular text, no special formatting rules.
2082    INPUT_TEXT = 1;
2083    // An alphanumeric input, e.g. postal code or discount code.
2084    INPUT_ALPHANUMERIC = 2;
2085  }
2086  optional InputType input_type = 2;
2087
2088  // The client memory key to store the result in.
2089  optional string client_memory_key = 3;
2090
2091  // The initial value of the text input.
2092  optional string value = 4;
2093}
2094
2095// A section containing one or multiple text inputs.
2096message TextInputSectionProto {
2097  repeated TextInputProto input_fields = 1;
2098}
2099
2100message UserFormSectionProto {
2101  optional string title = 1;
2102
2103  oneof section {
2104    StaticTextSectionProto static_text_section = 2;
2105    TextInputSectionProto text_input_section = 3;
2106    PopupListSectionProto popup_list_section = 4;
2107  }
2108  // Whether to send the result values to the backend.
2109  optional bool send_result_to_backend = 5;
2110}
2111
2112// A section that when tapped presents the user a popup with a list of options.
2113// The selected option is displayed in the section.
2114message PopupListSectionProto {
2115  // The key used to store the selection in CollectUserDataResultProto
2116  optional string additional_value_key = 1;
2117
2118  // The name of the items to be displayed
2119  repeated string item_names = 2;
2120
2121  // The list of the indexes of the items to be initially selected.
2122  repeated int32 initial_selection = 3;
2123
2124  // Whether to allow the selection of multiple items or just one.
2125  optional bool allow_multiselect = 4;
2126
2127  // Whether the selection of this section is required to proceed.
2128  optional bool selection_mandatory = 5 [default = true];
2129
2130  // The error message displayed when the selection is mandatory and missing.
2131  // Ignored if |selection_mandatory| is false.
2132  optional string no_selection_error_message = 6;
2133}
2134
2135// Asks to provide the data used by UseAddressAction and
2136// UseCreditCardAction.
2137// Next: 34
2138message CollectUserDataProto {
2139  enum TermsAndConditionsState {
2140    // No choice has been made yet.
2141    NOT_SELECTED = 0;
2142    // The 'accept' radio button is toggled.
2143    ACCEPTED = 1;
2144    // The 'review' radio button is toggled.
2145    REVIEW_REQUIRED = 2;
2146  }
2147
2148  optional string prompt = 1;
2149  // NOTE: The action does not ask separately for billing address.
2150  // The billing address is associated with the credit card that was picked.
2151  optional string billing_address_name = 2;
2152  // If present will save the shipping address inside the memory under the
2153  // specified name. If empty we won't ask for the shipping address. Data saved
2154  // under this name can be reused by UseAddressAction.
2155  optional string shipping_address_name = 3;
2156  // If present, it will be used as the title to be displayed for the shipping
2157  // address section instead of the default one.
2158  optional string shipping_address_section_title = 32;
2159  // When 'true' will ask for the credit card.
2160  optional bool request_payment_method = 4;
2161  // If non-empty, the UI will filter the available basic-card networks
2162  // accordingly (e.g., only `visa' and `mastercard').
2163  repeated string supported_basic_card_networks = 6;
2164  // Contact details that should be gathered.
2165  optional ContactDetailsProto contact_details = 5;
2166  // Optional specification for the confirm button (defaults to standard confirm
2167  // chip if not specified).
2168  optional ChipProto confirm_chip = 33;
2169  // Optionally allows confirming through the given direct actions.
2170  optional DirectActionProto confirm_direct_action = 10;
2171  // The initial state of the terms & conditions choice.
2172  optional TermsAndConditionsState terms_and_conditions_state = 8;
2173  // When 'false', hide the terms and conditions box in the UI.
2174  optional bool request_terms_and_conditions = 9 [default = true];
2175  // Whether the terms and conditions should be displayed as a single checkbox
2176  // with |accept_terms_and_conditions_text| as text. If false, the accept terms
2177  // will be displayed as a radio button next to an additional "Read and agree
2178  // later on domain.com" choice.
2179  optional bool show_terms_as_checkbox = 12;
2180  // The text for the terms and conditions "I accept..." choice. The text is
2181  // formatted such that '<b>text</b>' will be bold and '<link0>clickable
2182  // link</link0>', '<link1>other link</link1>', etc will be clickable links
2183  // that will finish this action and return the clicked link in the action
2184  // result.
2185  optional string accept_terms_and_conditions_text = 13;
2186  // Message that indicates that the user wants to review the terms and
2187  // conditions of a 3rd party's domain, e.g., 'example.com'.
2188  optional string terms_require_review_text = 20;
2189  // Privacy notice telling users that autofill assistant will send personal
2190  // data to a third party’s website.
2191  optional string privacy_notice_text = 21;
2192  // Additional actions available to the user. This can be used for instance to
2193  // display a "Show terms" button that will navigate the user to the terms and
2194  // conditions page when clicked.
2195  repeated UserActionProto additional_actions = 11;
2196  // Optionally requests a payment method with a billing address that has a
2197  // postcode value.
2198  optional bool require_billing_postal_code = 14;
2199  // The error message to display when the billing address is missing the
2200  // postal code. This field is mandatory if |require_postal_code| is true.
2201  optional string billing_postal_code_missing_text = 15;
2202  // The error message to display when the selected credit card is expired.
2203  optional string credit_card_expired_text = 23;
2204  // The login details that should be gathered.
2205  optional LoginDetailsProto login_details = 16;
2206  // The date/time range that should be gathered.
2207  optional DateTimeRangeProto date_time_range = 17;
2208  // An optional list of additional sections, which is above all other sections.
2209  repeated UserFormSectionProto additional_prepended_sections = 18;
2210  // An optional list of additional sections, which is below all other sections.
2211  repeated UserFormSectionProto additional_appended_sections = 19;
2212  // Backend-configured user interface to show below
2213  // |additional_prepended_sections|.
2214  optional GenericUserInterfaceProto generic_user_interface_prepended = 22;
2215  // Backend-configured user interface to show below
2216  // |additional_appended_sections|.
2217  optional GenericUserInterfaceProto generic_user_interface_appended = 25;
2218  // Optional. Text to be shown in a separate info section.
2219  optional string info_section_text = 24;
2220  // Optional. If true the text in the info section will be centered.
2221  optional bool info_section_text_center = 31;
2222  // Optional. If specified, the continue button will only be enabled if the
2223  // boolean at this location is true (and everything else is valid too).
2224  optional string additional_model_identifier_to_check = 27;
2225  // Clears any previously selected credit card. The client will revert to
2226  // default-selecting the card instead. NOTE: When clearing the credit card
2227  // selection, the billing address should also be cleared!
2228  optional bool clear_previous_credit_card_selection = 28;
2229  // Clears the previously selected login option, if any. The client will revert
2230  // to default-selecting the login option instead.
2231  optional bool clear_previous_login_selection = 29;
2232  // The names of the selected profiles to clear. Should be a subset of
2233  // {billing_address_name, shipping_address_name,
2234  // contact_details.contact_details_name}. NOTE: when clearing the billing
2235  // address, the selected credit card should also be cleared!
2236  repeated string clear_previous_profile_selection = 30;
2237
2238  reserved 7, 26;
2239}
2240
2241// Stop Autofill Assistant.
2242message StopProto {
2243  // If true, close the Chrome Custom Tab, in addition to shutting down Autofill
2244  // Assistant.
2245  optional bool close_cct = 2;
2246
2247  // Whether to show the feedback chip once Autofill Assistant has stopped.
2248  // Note that this is only relevant if the UI is still being shown after the
2249  // stop, which happens only if:
2250  // - close_cct is false.
2251  // - The action preceding this one is a Tell action.
2252  optional bool show_feedback_chip = 3;
2253
2254  reserved 1;  // stop_action_type
2255}
2256
2257message DetailsChangesProto {
2258  // Whether the changes require user approval. This de-emphasize
2259  // non-highlighted fields.
2260  optional bool user_approval_required = 1;
2261
2262  // Whether the title should be highlighted.
2263  optional bool highlight_title = 2;
2264
2265  // Whether the first description line should be highlighted.
2266  optional bool highlight_line1 = 3;
2267
2268  // Whether the second description line should be highlighted.
2269  optional bool highlight_line2 = 4;
2270
2271  // Whether the third description line should be highlighted.
2272  optional bool highlight_line3 = 5;
2273}
2274
2275message DetailsProto {
2276  optional string title = 1;
2277
2278  oneof image {
2279    string image_url = 2;
2280    // When set to true shows placeholder in place of an image.
2281    bool show_image_placeholder = 10;
2282  }
2283  // Specifies the hint for accessibility. If set to empty, the image will not
2284  // be announced by accessibility.
2285  optional string image_accessibility_hint = 14;
2286
2287  // Specifies what happens when user tap on the image in the details section.
2288  message ImageClickthroughData {
2289    // Whether to show the original URL where image is extracted from. Only
2290    // useful when 'image_url' is set.
2291    optional bool allow_clickthrough = 1;
2292
2293    // When image clickthrough is allowed, below texts are used to customize the
2294    // modal dialog shown to user *if* they are set, otherwise default texts
2295    // will be used.
2296    optional string description = 2;
2297    optional string positive_text = 3;
2298    optional string negative_text = 4;
2299
2300    // The url to present when user did choose to clickthrough.
2301    optional string clickthrough_url = 5;
2302  }
2303
2304  optional ImageClickthroughData image_clickthrough_data = 12;
2305
2306  // Optional label to provide additional price information.
2307  optional string total_price_label = 9;
2308  // The price containing the total amount and the currency to pay, formatted
2309  // in the client's locale (e.g., $123.00).
2310  optional string total_price = 6;
2311
2312  optional string description_line_1 = 7;
2313  optional string description_line_2 = 8;
2314  optional string description_line_3 = 13;
2315
2316  // Deprecated, but currently still necessary and supported. We can get rid of
2317  // these fields when the backend starts setting description_line_1 and 2.
2318  optional DateTimeProto datetime = 3;
2319  optional string description = 4;
2320
2321  // Asks the UI to show animated placeholders for missing fields.
2322  // The placeholder will be shown on effectively missing:
2323  // * title
2324  // * image
2325  // * description line (1, 2 or 3)
2326  // TODO(crbug.com/806868): Make the fields for displaying placeholders
2327  // configurable by the server.
2328  optional bool animate_placeholders = 11;
2329
2330  // Deprecated, no longer supported.
2331  reserved 5;
2332}
2333
2334// Show contextual information.
2335message ShowDetailsProto {
2336  oneof data_to_show {
2337    DetailsProto details = 1;
2338    // Shows full name and email address.
2339    string contact_details = 3;
2340    bool credit_card = 4;
2341    // Shows full name and address.
2342    string shipping_address = 5;
2343  }
2344
2345  // Flags indicating which parts of the details (if any) have changed.
2346  // This field is taken into account only if |details| is filled.
2347  optional DetailsChangesProto change_flags = 2;
2348}
2349
2350// Set the value of an form element.
2351message SetFormFieldValueProto {
2352  message Result { optional bool fallback_to_simulate_key_presses = 1; }
2353  message KeyPress {
2354    oneof keypress {
2355      // Text to insert as-is into a form field.
2356      string text = 1;
2357      // DEPRECATED: A single US-ASCII character (e.g., 13 for carriage return).
2358      int32 keycode = 2;
2359      // Text as generated by processing a virtual key code with a keyboard
2360      // layout. This can also be used for keyboard control sequences such
2361      // as "\r" or "\t".
2362      string keyboard_input = 3;
2363      // Use the username from the Chrome password manager login previously
2364      // selected in a CollectUserDataAction.
2365      bool use_username = 4;
2366      // Use the password from the Chrome password manager login previously
2367      // selected in a CollectUserDataAction.
2368      bool use_password = 5;
2369      // Use the value stored at the specified memory location.
2370      string client_memory_key = 6;
2371      // A value from an Autofill source. Note that this must be proceeded by a
2372      // |CollectUserDataAction|.
2373      AutofillValue autofill_value = 8;
2374    }
2375
2376    reserved 7;
2377  }
2378
2379  // A reference to the form element whose value should be set.
2380  optional SelectorProto element = 1;
2381
2382  // The value to set.
2383  repeated KeyPress value = 2;
2384
2385  // The strategy used to execute filling the value.
2386  optional KeyboardValueFillStrategy fill_strategy = 7;
2387
2388  // Delay between two key presses when simlulating.
2389  optional int32 delay_in_millisecond = 6 [default = 20];
2390
2391  reserved 5;
2392}
2393
2394// Asks the password manager to generate a suitable password for |element|. The
2395// generated password can be filled in subsequent SetFormFieldValueProto
2396// actions.
2397message GeneratePasswordForFormFieldProto {
2398  // A reference to the form element for which to generate a password.
2399  optional SelectorProto element = 1;
2400  // The client memory key to store the generated password.
2401  optional string memory_key = 2;
2402}
2403
2404// Presaves generated password to the password store.
2405// Presaving stores a generated password with empty username.
2406// Only possible if a password has already been generated using
2407// |GeneratePasswordForFormFieldProto|.
2408message PresaveGeneratedPasswordProto {
2409  // The client memory key of the stored password.
2410  optional string memory_key = 1;
2411}
2412
2413// Asks the password save manager to save generated password after successful
2414// submission.
2415message SaveGeneratedPasswordProto {
2416  // The client memory key of stored password.
2417  optional string memory_key = 1;
2418}
2419
2420// Configures the UI of the autofill assistant client.
2421message ConfigureUiStateProto {
2422  enum OverlayBehavior {
2423    // The overlay is decided according to the state the client is in.
2424    DEFAULT = 0;
2425    // The overlay is always hidden.
2426    HIDDEN = 1;
2427  }
2428  optional OverlayBehavior overlay_behavior = 1;
2429}
2430
2431// Set an element attribute to a specific value.
2432message SetAttributeProto {
2433  // A reference to the form element whose attribute should be set.
2434  optional SelectorProto element = 1;
2435
2436  // The attribute to set, e.g. ["style", "position"] to change
2437  // element.style.position.
2438  repeated string attribute = 2;
2439
2440  // The value to set.
2441  optional string value = 3;
2442}
2443
2444message InfoBoxProto {
2445  // Optional path to an image. Ok tick used if not set.
2446  optional string image_path = 1;
2447
2448  // The explanation to show in the box. Not setting this field will clear an
2449  // existing info box.
2450  optional string explanation = 2;
2451}
2452
2453// Shows an info box with informational content. The info box content is cleared
2454// when |info_box| is not set.
2455message ShowInfoBoxProto {
2456  optional InfoBoxProto info_box = 1;
2457}
2458
2459// Allow scripts to configure the peek height of the sheet and whether we should
2460// resize the viewport by this peek height. If talkback is enabled, the mode is
2461// set to RESIZE_VISUAL_VIEWPORT. Changes to the mode are only applied after
2462// talkback is disabled.
2463message ConfigureBottomSheetProto {
2464  enum ViewportResizing {
2465    // Don't change resizing configuration.
2466    NO_CHANGE = 0;
2467
2468    // Resize the layout viewport such that it is completely visible when the
2469    // sheet is in the peek state.
2470    RESIZE_LAYOUT_VIEWPORT = 1;
2471
2472    // Don't resize the viewport such that it is overlaid by the sheet, even in
2473    // the peek state.
2474    NO_RESIZE = 2;
2475
2476    // Dynamically resize the visual viewport by the height of the sheet. This
2477    // allows to fully scroll the page above the sheet at any time.
2478    RESIZE_VISUAL_VIEWPORT = 3;
2479  }
2480
2481  // The peek mode allows to set what components are visible when the sheet is
2482  // in the peek (minimized) state.
2483  enum PeekMode {
2484    UNDEFINED_PEEK_MODE = 0;
2485
2486    // Only show the swipe handle.
2487    HANDLE = 1;
2488
2489    // Show the swipe handle, header (status message, poodle, profile icon) and
2490    // progress bar.
2491    HANDLE_HEADER = 2;
2492
2493    // Show swipe handle, header, progress bar, suggestions and actions.
2494    HANDLE_HEADER_CAROUSELS = 3;
2495  }
2496
2497  // Whether the viewport should be resized. Resizing the viewport is an
2498  // expensive operation, so toggling the resize on/off should be done
2499  // cautiously.
2500  optional ViewportResizing viewport_resizing = 1;
2501
2502  // Set the peek mode. This will change the peek mode of the sheet without
2503  // actually updating the sheet to that setting. If viewport_resizing is set
2504  // to RESIZE_LAYOUT_VIEWPORT or was set by a previous ConfigureBottomSheet
2505  // action, the viewport will be resized to match the new peek height.
2506  optional PeekMode peek_mode = 2;
2507
2508  // Maximum time to wait for the window to resize before continuing with the
2509  // script. If 0 or unset, the action doesn't wait.
2510  optional int32 resize_timeout_ms = 3;
2511
2512  // Option to automatically expand or collapse the sheet or leave as is.
2513  oneof apply_state {
2514    // Go to the expanded state (same as if the user swiped the bottom sheet
2515    // up).
2516    bool expand = 4;
2517    // Go to the peek state (same as if the user swiped the bottom
2518    // sheet down).
2519    bool collapse = 5;
2520  }
2521}
2522
2523// Allow scripts to display a form with multiple inputs.
2524message ShowFormProto {
2525  // The form to display.
2526  optional FormProto form = 1;
2527
2528  // The chip to display below the form. This chip will be enabled only if all
2529  // form inputs are valid.
2530  optional ChipProto chip = 2;
2531
2532  // Optionally allow confirming the prompt using given direct actions.
2533  optional DirectActionProto direct_action = 3;
2534}
2535
2536message FormProto {
2537  // A result associated to this form, such that |input_results[i]| is the
2538  // result of |inputs[i]|. If the user clicks a link while in the form action,
2539  // |link| will be set to the index of the clicked link and |input_results|
2540  // may be incomplete.
2541  message Result {
2542    repeated FormInputProto.Result input_results = 1;
2543    // If this is set, it contains the index of the text link that was clicked.
2544    // E.g., <link4>Details</link4> will populate this field with '4' when
2545    // clicked.
2546    optional int32 link = 2;
2547  }
2548
2549  // The different inputs to display.
2550  repeated FormInputProto inputs = 1;
2551
2552  // Optionally adds an informational text below the form.
2553  optional string info_label = 2;
2554  // If set, an info icon will be shown next to the info label that prompts a
2555  // popup when tapped. Ignored if info_label is not set.
2556  optional InfoPopupProto info_popup = 3;
2557}
2558
2559message FormInputProto {
2560  message Result {
2561    oneof input_type {
2562      CounterInputProto.Result counter = 1;
2563      SelectionInputProto.Result selection = 2;
2564    }
2565  }
2566
2567  oneof input_type {
2568    CounterInputProto counter = 1;
2569    SelectionInputProto selection = 2;
2570  }
2571}
2572
2573// An input that is made of one or more counters. This input is considered valid
2574// if its |validation_rule| is satisfied or if it doesn't have one.
2575message CounterInputProto {
2576  // A single counter.
2577  message Counter {
2578    // The label shown with the counter. All occurrences of the '{value}'
2579    // substring will be replaced by the current counter value. May contain
2580    // links of the form <link1>Some text</link1>.
2581    optional string label = 1;
2582
2583    // Text shown below the label. Optional. May contain links of the form
2584    // <link1>Some text</link1>.
2585    optional string description_line_1 = 5;
2586
2587    // Text shown below |description_line_2|. Optional. May contain links of the
2588    // form <link1>Some text</link1>.
2589    optional string description_line_2 = 8;
2590
2591    // The possible values this counter can have. If empty, the possible values
2592    // will be all integer values between |min_value| and |max_value|.
2593    // Note that the order of the values matters and they will not be
2594    // automatically sorted.
2595    repeated int32 allowed_values = 6;
2596
2597    // The minimum value this counter can have. Ignored if |allowed_values| is
2598    // not empty.
2599    optional int32 min_value = 2 [default = -0x80000000];  // kint32min
2600
2601    // The maximum value this counter can have. Ignored if |allowed_values| is
2602    // not empty.
2603    optional int32 max_value = 3 [default = 0x7FFFFFFF];  // kint32max
2604
2605    // The initial value of the counter. If |allowed_values| is not empty, it
2606    // must contain |initial_value| or it will otherwise default to the first
2607    // value.
2608    optional int32 initial_value = 4 [default = 0];
2609
2610    reserved 7;
2611  }
2612
2613  // A result associated to this counter.
2614  message Result {
2615    // The values of all counters from this CounterInputProto, such that
2616    // |values[i]| is the value of |counters[i]|.
2617    repeated int32 values = 1;
2618  }
2619
2620  // A validation rule to validate this input values.
2621  message ValidationRule {
2622    // A rule to combine sub rules. This rule allows to express the following:
2623    //  - Rule A and Rule B must be satisfied.
2624    //  - Rule A or Rule B must be satisfied.
2625    //  - Rule A must not be satisfied.
2626    //  - At least 2 of Rules A, B or C must be satisfied.
2627    //
2628    // This rule is satisfied if the number of satisfied |sub_rules| is >=
2629    // min_satisfied_rules and <= max_satisfied_rules.
2630    message BooleanRule {
2631      // The sub rules to check.
2632      repeated ValidationRule sub_rules = 1;
2633
2634      // The minimum number of rules that must be satisfied.
2635      optional int32 min_satisfied_rules = 2 [default = 0];
2636
2637      // The maximum number of rules that must be satisfied.
2638      optional int32 max_satisfied_rules = 3
2639          [default = 0x7FFFFFFF];  // kint32max
2640    }
2641
2642    // A rule on the value of one of the |counters|. This rule is satisfied if
2643    // min_value <= counter.value <= max_value.
2644    message CounterRule {
2645      // The index of the counter in |counters|. Must be >= 0 and <
2646      // |counters.size|.
2647      optional int32 counter_index = 1;
2648
2649      // The minimum value this counter can have.
2650      optional int32 min_value = 2 [default = -0x80000000];  // kint32min
2651
2652      // The maximum value this counter can have.
2653      optional int32 max_value = 3 [default = 0x7FFFFFFF];  // kint32max
2654    }
2655
2656    // A rule on the sum of the |counters|. This rule satisfied if the sum of
2657    // all |counters| is >= min_value and <= max_value. If there is an overflow
2658    // when computing the sum, the behavior is undefined.
2659    message CountersSumRule {
2660      // The minimum value the total can have.
2661      optional int64 min_value = 1
2662          [default = -0x8000000000000000];  // kint64min
2663
2664      // The maximum value this counter can have.
2665      optional int64 max_value = 2 [default = 0x7FFFFFFFFFFFFFFF];  // kint64max
2666    }
2667
2668    oneof rule_type {
2669      BooleanRule boolean = 1;
2670      CounterRule counter = 2;
2671      CountersSumRule counters_sum = 3;
2672    }
2673  }
2674
2675  // An optional label shown above the different counters.
2676  optional string label = 1;
2677
2678  // The counters to display.
2679  repeated Counter counters = 2;
2680
2681  // If specified, the input will initially display maximum |minimized_count|
2682  // counters. If |counters|.size > |minimized_count|, the remaining counters
2683  // will be displayed in an expandable section below the first
2684  // |minimized_count| counters. Setting this value will have no effect if
2685  // |expand_text| and |minimize_text| are not set.
2686  optional int32 minimized_count = 3 [default = 0x7FFFFFFF];  // kint32max
2687
2688  // Text shown when counters are inside the expandable section and the section
2689  // is minimized. Clicking this text will expand the section and show the
2690  // remaining counters.
2691  optional string expand_text = 4;
2692
2693  // Text shown when counters are inside the expandable section and the section
2694  // is expanded. Clicking this text will minimize the section and hide the
2695  // counters inside it.
2696  optional string minimize_text = 5;
2697
2698  // Validation rule used to check whether the current values of this input are
2699  // valid.
2700  optional ValidationRule validation_rule = 6;
2701
2702  // The minimum value of the sum of the counters. All counters decrease button
2703  // will be disabled if sum <= min_counters_sum.
2704  optional int64 min_counters_sum = 7
2705      [default = -0x8000000000000000];  // kint64min
2706
2707  // The maximum value of the sum of the counters. All counters increase button
2708  // will be disabled if sum >= max_counters_sum.
2709  optional int64 max_counters_sum = 8
2710      [default = 0x7FFFFFFFFFFFFFFF];  // kint64max
2711}
2712
2713// An input that allows the user to choose one or multiple options. This input
2714// is considered valid if the number of selected choices is bigger or equal than
2715// |min_choices|.
2716message SelectionInputProto {
2717  message Choice {
2718    // The label of this choice. May contain links of the form <link1>Some
2719    // text</link1>.
2720    optional string label = 1;
2721
2722    // Text shown below the label. Optional. May contain links of the form
2723    // <link1>Some text</link1>.
2724    optional string description_line_1 = 3;
2725
2726    // Text shown below |description_line_2|. Optional. May contain links of the
2727    // form <link1>Some text</link1>.
2728    optional string description_line_2 = 4;
2729
2730    // Whether this choice is selected by default. If |allow_multiple| is false,
2731    // then maximum 1 Choice can have this set to true, otherwise the associated
2732    // FormAction will fail.
2733    optional bool selected = 2 [default = false];
2734
2735    reserved 7;
2736  }
2737
2738  message Result {
2739    // Stores whether each choice was selected or not, such that |selected[i]|
2740    // is true if |choices[i]| was selected.
2741    repeated bool selected = 1;
2742  }
2743
2744  // An optional label shown above the different choices.
2745  optional string label = 1;
2746
2747  // The choices to display.
2748  repeated Choice choices = 2;
2749
2750  // Whether the user will be allowed to select multiple choices. If false, each
2751  // choice will be displayed with a radio button. Otherwise, it will be
2752  // displayed with checkboxes.
2753  optional bool allow_multiple = 3 [default = false];
2754
2755  // The minimum number of choices that should be selected to consider this
2756  // input valid.
2757  optional int32 min_selected_choices = 4 [default = 1];
2758}
2759
2760// Action to show a popup bubble on top of the bottom sheet, anchored at the
2761// icon. Setting an empty message will remove any existing and visible popup
2762// message. A second action replaces a previously shown message.
2763message PopupMessageProto {
2764  // Message to show in the popup.
2765  optional string message = 1;
2766}
2767
2768// Action to get an element's status.
2769message GetElementStatusProto {
2770  optional SelectorProto element = 1;
2771
2772  optional ValueMatch expected_value_match = 2;
2773  optional ValueSource value_source = 4;
2774
2775  // If set and a mismatch happens, the action will report an failure status
2776  // with |ELEMENT_MISMATCH|. If this flag is set to false, the action will not
2777  // fail and simply report the result.
2778  optional bool mismatch_should_fail = 3;
2779
2780  // The result that gets sent as part of |ProcessedActionProto.result_data|.
2781  message Result {
2782    // The field is considered not empty.
2783    optional bool not_empty = 1;
2784    // The field matches the expected input.
2785    optional bool match_success = 2;
2786    // The field was expected to match an empty expectation. For a value this
2787    // means an empty expected value, for a RegExp this means the extracted
2788    // match was empty.
2789    optional bool expected_empty_match = 4;
2790
2791    // For logging and debugging.
2792    repeated ComparisonReport reports = 3;
2793  }
2794
2795  enum ValueSource {
2796    NOT_SET = 0;
2797    // Compare the element's |value| attribute against this expected match.
2798    VALUE = 1;
2799    // Compare the element's |innerText| attribute against this expected match.
2800    INNER_TEXT = 2;
2801  }
2802
2803  message MatchOptions {
2804    optional bool case_sensitive = 1;
2805    optional bool remove_space = 2;
2806  }
2807
2808  message MatchExpectation {
2809    optional MatchOptions match_options = 1;
2810
2811    oneof match_level {
2812      bool full_match = 2;
2813      bool contains = 3;
2814      bool starts_with = 4;
2815      bool ends_with = 5;
2816    }
2817  }
2818
2819  message TextMatch {
2820    oneof value_source {
2821      // The value to check against.
2822      string value = 1;
2823      // A value from an Autofill source. Note that this must be proceeded by a
2824      // |CollectUserDataAction|.
2825      AutofillValue autofill_value = 2;
2826      // A regular expression.
2827      string re2 = 4;
2828    }
2829
2830    // Optional. The expectations to declare this as a matching success. If
2831    // left empty, the action will always be treated as successful.
2832    optional MatchExpectation match_expectation = 3;
2833  }
2834
2835  message ValueMatch { optional TextMatch text_match = 1; }
2836
2837  message ComparisonReport {
2838    optional MatchOptions match_options = 1;
2839
2840    optional bool full_match = 2;
2841    optional bool contains = 3;
2842    optional bool starts_with = 4;
2843    optional bool ends_with = 5;
2844
2845    optional bool empty = 6;
2846    optional bool expected_empty_match = 7;
2847  }
2848}
2849