// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. syntax = "proto2"; option optimize_for = LITE_RUNTIME; option java_package = "org.chromium.chrome.browser.autofill_assistant.proto"; option java_multiple_files = true; package autofill_assistant; import "components/autofill_assistant/browser/action_strategy.proto"; import "components/autofill_assistant/browser/action_value.proto"; import "components/autofill_assistant/browser/cud_condition.proto"; import "components/autofill_assistant/browser/dom_action.proto"; import "components/autofill_assistant/browser/generic_ui.proto"; import "components/autofill_assistant/browser/model.proto"; import "components/autofill_assistant/browser/view_layout.proto"; import "components/autofill_assistant/content/common/proto/semantic_feature_overrides.proto"; import "components/autofill_assistant/browser/public/external_action.proto"; // A field trial containing the name of the trial and the name of the // randomly selected trial group. message FieldTrialProto { optional string trial_name = 1; optional string group_name = 2; } // Context contains client environment details. // Next ID: 24 message ClientContextProto { message Chrome { optional string chrome_version = 1; repeated FieldTrialProto active_field_trials = 2; } oneof client { Chrome chrome = 1; } // locale will be the language tag of the default locale. The tag should // be a well-formed IETF BCP 47 language tag with language and country code // (e.g., "en-US"). // The intent is to communicate the client language preferences to the server. optional string locale = 5; // country should be a country code as defined by ISO 3166-1-alpha-2. // The intent is to communicate the client's location to the server. Location // is extracted from Chrome Variations Service latest country. optional string country = 6; // Experiment ids string provided by the 'caller'. optional string experiment_ids = 7; // True if the script is called from a Chrome Custom Tab created for Autofill // Assistant. optional bool is_cct = 8; // True if the onboarding screen was shown to the user. optional bool is_onboarding_shown = 10; // True if the script was triggered by a direct action. optional bool is_direct_action = 9; // True if this an in-Chrome triggered flow, rather than an externally // triggered one. optional bool is_in_chrome_triggered = 17; // The type of trigger script that was shown and accepted at the beginning of // this flow, if any. optional TriggerScriptProto.TriggerUIType trigger_ui_type = 18; message DeviceContextProto { message VersionProto { // The Android SDK version of the device. optional int32 sdk_int = 1; } optional VersionProto version = 1; // The manufacturer of the device. optional string manufacturer = 2; // The model of the device. optional string model = 3; } optional DeviceContextProto device_context = 11; enum AccountsMatchingStatus { // The account was not present in the intent. UNKNOWN = 0; // The account in the intent and the current chrome account match. ACCOUNTS_MATCHING = 1; // The account in the intent and the current chrome account DON'T match. ACCOUNTS_NOT_MATCHING = 2; } // Whether the account from the intent and the chrome account match. optional AccountsMatchingStatus accounts_matching_status = 12; // Whether a11y (talkback and touch exploration) is enabled or not. optional bool accessibility_enabled = 13; enum SignedIntoChromeStatus { UNDEFINED = 0; // There is no account signed into Chrome. NOT_SIGNED_IN = 1; // An account is signed into Chrome. SIGNED_IN = 2; } optional SignedIntoChromeStatus signed_into_chrome_status = 14; // The size of the current Chrome window. This not only includes the part of // the window that renders the website but also everything around it // (toolbars, omnibox, ...). message WindowSize { optional int32 height_pixels = 1; optional int32 width_pixels = 2; } optional WindowSize window_size = 15; // The current orientation of the device. enum ScreenOrientation { UNDEFINED_ORIENTATION = 0; PORTRAIT = 1; LANDSCAPE = 2; } optional ScreenOrientation screen_orientation = 16; // The type of platform the device is running on, e.g. Android, Desktop, or // iOS. enum PlatformType { PLATFORM_TYPE_UNDEFINED = 0; PLATFORM_TYPE_ANDROID = 1; PLATFORM_TYPE_IOS = 2; PLATFORM_TYPE_DESKTOP = 3; } optional PlatformType platform_type = 20; // The model for semantic dom annotation. message AnnotateDomModelContextProto { optional int64 model_version = 1; // If set to true, serve semantic selectors even if a user is not part of // an official server side experiment. This is used for emulator use cases // that do not necessarily have a signed in user or an account. optional bool force_semantic_selection = 2; } optional AnnotateDomModelContextProto annotate_dom_model_context = 22; // Set if the client has the JS flow library needed for JS flow execution. optional bool js_flow_library_loaded = 23; reserved 19, 21; } // Get the list of scripts that can potentially be run on a url. message SupportsScriptRequestProto { optional string url = 1; // Parameters that can be used to filter the scripts suitable for execution. repeated ScriptParameterProto script_parameters = 2; optional ClientContextProto client_context = 3; } // Parameters for testers and developers of implicit triggering. This proto can // be specified via the base64-encoded command line switch // --autofill-assistant-implicit-triggering-debug-parameters. Values will take // precedence over existing values in case of conflict. message ImplicitTriggeringDebugParametersProto { // The list of additional script parameters to send to the backend. This is // mainly intended to allow specifying DEBUG_SOCKET_ID and DEBUG_BUNDLE_ID. // Note: only a small set of parameters is allowlisted for GetTriggerScripts, // see components/autofill_assistant/browser/script_parameters.cc repeated ScriptParameterProto additional_script_parameters = 1; } message ScriptParameterProto { // Parameter name, as found in the Intent, without prefix. optional string name = 3; optional string value = 2; } // Response of the list of supported scripts. message SupportsScriptResponseProto { repeated SupportedScriptProto scripts = 1; // Defines what should happen if no scripts in [scripts] becomes runnable, // because of preconditions. optional ScriptTimeoutError script_timeout_error = 2; optional ClientSettingsProto client_settings = 3; // The ScriptStoreConfig to use with the initial GetActions request. optional ScriptStoreConfig script_store_config = 6; // Semantic selector related policy configuration. optional SemanticSelectorPolicy semantic_selector_policy = 7; reserved 4, 5; } // A privacy sensitive way to look up Capabilities. Allows querying for // capabilities by hashing the requested domain urls and sending only some of // the leading bits, such that the recipient will be unable to reconstruct the // original URL. message GetCapabilitiesByHashPrefixRequestProto { // Required. Number of bits in each hash prefix. Value must be in the range // [15, 64]. optional uint32 hash_prefix_length = 1; // Required. Hash prefixes for requested urls. The prefix will be taken as the // first `hash_prefix_length` number of bits of this uint64. Other bits will // be ignored. CityHash64 should be used to calculate the hashes. Encoding of // the domain url prior to hashing should be UTF-8, it should include the // http(s) header and exclude the last '/' character. // Examples: // - https://www.exampledomain.com // - https://example.domain.com // - https://domain.com repeated uint64 hash_prefix = 2 [packed = true]; // The client context of the device for which you want to know script // capabilities. // NOTE: Currently, this will only contain the Chrome version number, locale // and country for privacy reasons. optional ClientContextProto client_context = 3; // There is only a subset of parameters allowed to be sent from the client. // INTENT parameter is required. repeated ScriptParameterProto script_parameters = 4; } // Information that is passed from the bundle to the caller in GetCapabilities // RPC requests. // Next ID: 3 message BundleCapabilitiesInformationProto { // Information used by Chrome's FastCheckout vertical. message ChromeFastCheckoutProto { // A list of form signatures on which to trigger the bundle. repeated uint64 trigger_form_signatures = 1 [packed = true]; } optional ChromeFastCheckoutProto chrome_fast_checkout = 1; // If set to `true` the bundle supports consentless execution which is the // case for JS scripts executed on the client-side. optional bool supports_consentless_execution = 2; } message GetCapabilitiesByHashPrefixResponseProto { message MatchInfoProto { // Domain url that matches one of the requested hash prefixes. optional string url_match = 1; // The list of script parameters for the client to use. // Note: The list only contains additional or changed script parameters. // This will specifically NOT include mandatory script parameters such as // ENABLED or START_IMMEDIATELY, and will also not contain the INTENT. // Clients are required to add those parameters themselves if needed to. // They are omitted here to reduce the size of the response. repeated ScriptParameterProto script_parameters_override = 2; // Additional information that a bundle may wish to pass to the caller of // the GetCapabilities RPC call. optional BundleCapabilitiesInformationProto bundle_capabilities_information = 3; } // Match information for the requested hash prefixes. No correlation should // be assumed between the order of returned info and the order of requested // prefixes. Clients are expected to match the returned urls to determine // which responses they are interested in. repeated MatchInfoProto match_info = 1; } message GetNoRoundTripScriptsByHashPrefixRequestProto { // The number of leading bits to consider from hash_prefix. The remaining // trailing bits from hash_prefix should be ignored. optional uint32 hash_prefix_length = 1; // The CityHash64 of the URL of interest. Only the first hash_prefix_length // bits are meaningful. optional uint64 hash_prefix = 2; // The client context. optional ClientContextProto client_context = 3; // Optional script parameters. Note that only a subset of parameters are // allowed to be sent from the client. repeated ScriptParameterProto script_parameters = 4; // CUP-signed version of this proto. When set, the rest of the fields should // be ignored. optional CUPRequestData cup_data = 5; } message GetNoRoundTripScriptsByHashPrefixResponseProto { // CUP-signed version of this proto. When set, the rest of the fields in // ScriptActionRequestProto should be ignored. optional CUPResponseData cup_data = 1; message MatchInfo { message RoutineScript { optional string script_path = 1; // The set of actions to execute. If the last executed action is not a // stop action or a stop action inside a JS flow action the script will // fail. optional ActionsResponseProto action_response = 2; } // The domain for the script optional string domain = 1; // The response of the supports site request for this domain. optional SupportsScriptResponseProto supports_site_response = 2; // The scripts for the domain. Can contain one main script and several // interrupt scripts. repeated RoutineScript routine_scripts = 3; } // List of potential scripts matches for the request URL hash prefix. Callers // should inspect each element of the list to find the exact match, if any. repeated MatchInfo match_infos = 2; // Mentions non-fatal errors, such as an empty request. repeated string warnings = 3; } // Request to get user data. message GetUserDataRequestProto { message PaymentMethodRequest { // The client token, generated by GMS Core. optional bytes client_token = 1; // The list of supported card networks. repeated string supported_card_networks = 2; // The list of known payment instruments from a previous call. repeated string preexisting_ids = 3; } message AddressRequest { // The list of known addresses from a previous call. repeated string preexisting_ids = 1; } // For logging, to know which run this request has originated from. optional uint64 run_id = 1; optional bool request_name = 2; optional bool request_email = 3; optional bool request_phone = 4; optional AddressRequest request_shipping_addresses = 8; optional PaymentMethodRequest request_payment_methods = 7; reserved 5, 6; } // Response with user data. message GetUserDataResponseProto { // The locale to be used when creating this data. This can have influence // on the potential processing by Autofill. optional string locale = 3; repeated ProfileProto available_contacts = 1; // The identifier of the contact to select. If not specified, the client // will use its own heuristics to select a default contact. optional string selected_contact_identifier = 5; // Available phone numbers to select. repeated PhoneNumberProto available_phone_numbers = 10; // The identifier of the phone number to select. If not specified, // the client will use its own heuristics to select a default payment // instrument. optional string selected_phone_number_identifier = 11; // Available (shipping) addresses to select. repeated ProfileProto available_addresses = 4; // The identifier of the shipping address to select. If not specified, the // client will use its own heuristics to select a default shipping address. optional string selected_shipping_address_identifier = 6; // An opaque token to launch the GMS address editor for creating a new // address. optional bytes add_address_token = 8; // Available payment instruments to select. repeated PaymentInstrumentProto available_payment_instruments = 2; // The identifier of the payment instrument to select. If not specified, // the client will use its own heuristics to select a default payment // instrument. optional string selected_payment_instrument_identifier = 7; // An opaque token returned by the |GetInstrumentListResponse| to launch // the GMS card editor to create a new credit card. optional bytes add_payment_instrument_token = 9; } // Overlay image to be drawn on top of full overlays. message OverlayImageProto { // TODO(b/170202574): Remove legacy |image_url|. // If set, |image_size| is mandatory. oneof image { // Deprecated, but currently still supported. The image to display. string image_url = 1; // The image to display. DrawableProto image_drawable = 8; } // The size of the image to display. optional ClientDimensionProto image_size = 2; // The margin between the top of the page (anchor) and the image. optional ClientDimensionProto image_top_margin = 3; // The margin between the bottom of the image and the baseline of the text. optional ClientDimensionProto image_bottom_margin = 4; // The text to display beneath the image. If set, |text_color| and |text_size| // are mandatory. optional string text = 5; // Supported formats: #RRGGBB or #AARRGGBB. optional string text_color = 6; // The size of the text to display. optional ClientDimensionProto text_size = 7; } // Next ID: 26 message ClientSettingsProto { message IntegrationTestSettings { // Disables animations for the poodle and the progress bar. optional bool disable_header_animations = 1; // Disables change animations in the actions carousel. optional bool disable_carousel_change_animations = 2; } // Time between two periodic script precondition checks. optional int32 periodic_script_check_interval_ms = 1; // Time between two element checks in the script executor. optional int32 periodic_element_check_interval_ms = 2; // Run that many periodic checks before giving up unless something happens to // wake it up, such as the user touching the screen. optional int32 periodic_script_check_count = 3; // Time between two element position refreshes, when displaying highlighted // areas in prompt state. optional int32 element_position_update_interval_ms = 4; // Maximum amount of time normal actions should implicitly wait for a selector // to show up. optional int32 short_wait_for_element_deadline_ms = 5; // Time to wait between two checks of the box model, when waiting for an // element to become stable, such as before clicking. optional int32 box_model_check_interval_ms = 6; // Maximum number of checks to run while waiting for the element position to // become stable. optional int32 box_model_check_count = 7; // Maximum time to wait until document has reached "ready" state. optional int32 document_ready_check_timeout_ms = 20; // How much time to give users to tap undo when they tap a cancel button. optional int32 cancel_delay_ms = 12; // If the user taps the overlay that many time within |tap_duration| turn the // UI off and give them |tap_shutdown_delay| to undo. If 0, unexpected taps // are ignored. optional int32 tap_count = 13; // Reset the unexpected tap counter after that time. optional int32 tap_tracking_duration_ms = 14; // How much time to give users to tap undo when after |tap_count| unexpected // taps where optional int32 tap_shutdown_delay_ms = 15; // Optional image drawn on top of overlays. optional OverlayImageProto overlay_image = 16; // Optional settings intended for integration tests. optional IntegrationTestSettings integration_test_settings = 17; // Optional setting defining the size of the bottom sheet when Talkback is // enabled as a fraction of the available height. When set, the bottomsheet // will stop resizing automatically in talkback mode. It will always have the // specified size instead. optional float talkback_sheet_size_fraction = 18; // Deprecated, should be moved into |display_strings|. message BackButtonSettings { // The label of the highlighted "Undo" action. optional string undo_label = 2; reserved 1; } optional BackButtonSettings back_button_settings = 19; // Settings to define the behavior for showing warnings about slow connection // and/or websites to users. message SlowWarningSettings { enum MessageMode { UNKNOWN = 0; // The warning message will be appended to the existing status message. CONCATENATE = 1; // The warning message will replace the current status message. REPLACE = 2; } // Whether to show warnings related to a slow connection to the user. optional bool enable_slow_connection_warnings = 1; // Whether to show warnings related to a slow website to the user. optional bool enable_slow_website_warnings = 2; // If true, only one warning will be shown to the user, i.e. either the slow // connection or website, depending on which one triggers first. optional bool only_show_warning_once = 3; // If true, the slow connection warning will be shown only once. optional bool only_show_connection_warning_once = 4; // If true, the website warning will be shown only once. optional bool only_show_website_warning_once = 5; // Defines the maximum wait on a dom find element operation before showing // the slow website warning. optional int32 warning_delay_ms = 6; // Defines the threshold above which a roundtrip is considered too slow. optional int32 slow_roundtrip_threshold_ms = 7; // Defines the number of consecutive slow roundtrips allowed before showing // the slow connection warning. optional int32 max_consecutive_slow_roundtrips = 8; // The message to show as a warning to inform the user of a slow connection. // If this is not set, no warning will be shown in case of slow connection. optional string slow_connection_message = 9; // The message to show as a warning to inform the user of a slow website. // If this is not set, no warning will be shown in case of a slow website. optional string slow_website_message = 10; // The minimum duration that the message will be shown for (only applies to // the slow connection messages). optional int32 minimum_warning_message_duration_ms = 11; // Whether the warning message should replace the current status message or // should be concatenated. optional MessageMode message_mode = 12; } optional SlowWarningSettings slow_warning_settings = 21; // Strings that are needed for Chrome Client UI. enum DisplayStringId { // Unspecified value UNSPECIFIED = 0; // Text label that is shown when autofill assistant cannot help anymore, // because of a user action. GIVE_UP = 1; // Text label shown next to an UNDO button when user action indicate they // want to continue on their own. MAYBE_GIVE_UP = 2; // Text label that is shown when autofill assistant cannot help anymore, // because something went wrong. DEFAULT_ERROR = 3; // Text on the payment request primary button to confirm payment information PAYMENT_INFO_CONFIRM = 4; // Generic label for a button to continue to the next screen. CONTINUE_BUTTON = 5; // Text label that is shown when stopping the Autofill Assistant. STOPPED = 6; // Option shown in the menu when clicking the Autofill Assistant profile // icon. Clicking this option will open a feedback sharing dialog. SEND_FEEDBACK = 7; // A generic term for Close on buttons and menus. CLOSE = 8; // Title for Chrome's Settings. SETTINGS = 9; // Undo message for snackbar. UNDO = 10; } // A Chrome display string along with its ID. This is used to create a map of // display strings below. message DisplayString { optional DisplayStringId id = 1; optional string value = 2; } // A map of display strings keyed by the ID. Note that the locale of these // strings must be provided in |display_strings_locale|. These strings are // ignored if locale is not provided. repeated DisplayString display_strings = 22; // The locale of |display_strings|. If |display_strings_locale| is not // provided, we ignore |display_strings|. When locale // is updated/switched to a new locale, we replace the set of // |display_strings|, even if empty. The provided locale should be in BCP 47 // format, e.g. "en-US". optional string display_strings_locale = 23; // Extra time SelectorObserver has to finish. If it takes longer than // max_wait_time + extra_timeout (this value) it assumes something went // wrong and fails with a |TIMED_OUT| error. optional int32 selector_observer_extra_timeout_ms = 24; // SelectorObserver will wait until no DOM mutation notifications are received // for this amount of time to check the selectors. optional int32 selector_observer_debounce_interval_ms = 25; reserved 8 to 11; } message ScriptTimeoutError { // Wait for that long before considering that scripts preconditions have timed // out and executing the script specified in script_path. // // The script might be called more than once if the script terminates // successfully and again still nothing is found after timeout_ms. optional int32 timeout_ms = 1; // The script to execute when the error happens. optional string script_path = 2; } // Supported script. message SupportedScriptProto { // This is the internal name of the script. optional string path = 1; message PresentationProto { // Precondition contains a set of conditions that must hold for a script to // be executed. No precondition means that a script can run in any case. optional ScriptPreconditionProto precondition = 3; // Display priority of the script. Lowest number has highest priority, which // means a script with priority 0 should be displayed before a script with // priority 1. optional int32 priority = 5; // Optionally map this script to a direct action. optional DirectActionProto direct_action = 13; // When set to true this script can be run in 'autostart mode'. optional bool autostart = 8; // When set to true this script will be run from WaitForDom actions with // allow_interrupt=true. optional bool interrupt = 9; // Message to show once the script has been started. This is shown while // loading the actions. optional string start_message = 14; // Show the UI if it's not shown yet. Setting this to false is useful for // scripts started by direct actions. optional bool needs_ui = 15 [default = true]; reserved 1, 2, 4, 6, 7, 10 to 12, 16 to 18; } optional PresentationProto presentation = 2; reserved 3; } message ScriptPreconditionProto { // Pattern of the path parts of the URL, including query and '#''. repeated string path_pattern = 5; // Domain (exact match) excluding the last '/' character. repeated string domain = 6; // Combined with AND: all matches must be true for precondition to hold. repeated ScriptParameterMatchProto script_parameter_match = 7; // Script can only run if the given condition match. optional ElementConditionProto element_condition = 10; reserved 3, 8, 9; } message ScriptParameterMatchProto { // Parameter name, as found in the Intent, without prefix. optional string name = 4; // Checks whether the script parameter is present. optional bool exists = 2 [default = true]; // Checks whether the script parameter has exact value. Empty or missing value // is treated as wildcard - any value will pass. optional string value_equals = 3; } enum PolicyType { UNKNOWN_POLICY = 0; SCRIPT = 1; } message CUPRequestData { // A serialized ScriptActionRequestProto. optional bytes request = 1; // Combination of public key id and random nonce. optional bytes query_cup2key = 2; // SHA2 hash of the request. optional bytes hash_hex = 3; } message ScriptActionRequestProto { // CUP-signed version of this proto. When set, the rest of the fields in // ScriptActionRequestProto should be ignored. optional CUPRequestData cup_data = 11; optional ClientContextProto client_context = 7; // Global payload from the previous response, possibly for another script. optional bytes global_payload = 8; // Script payload from the previous response, for the same script. // // For backward compatibility, for initial requests, forward the last returned // script_payload. optional bytes script_payload = 2; oneof request { InitialScriptActionsRequestProto initial_request = 4; NextScriptActionsRequestProto next_request = 5; } reserved 6, 9, 10; } // Message specifying how to retrieve the scripts. If bundle_path is set, it // will read that bundle with the associated version. message ScriptStoreConfig { optional string bundle_path = 2; optional int64 bundle_version = 3; } // Initial request to get a script's actions. message InitialScriptActionsRequestProto { message QueryProto { // The backend expects the |script_path| to be a repeated field. This field // is expected to contain only one element. repeated string script_path = 1; // The exact URL on which the script was initially started. optional string url = 2; optional PolicyType policy = 3; reserved 4 to 12; } optional QueryProto query = 3; repeated ScriptParameterProto script_parameters = 2; // Specify a bundle and version to run. optional ScriptStoreConfig script_store_config = 6; reserved 1, 4, 5, 7 to 11; } message RoundtripTimingStats { // Reports how long it took for the previous roundtrip to the backend to // complete. optional int64 roundtrip_time_ms = 1; // Reports the total client processing time for the executed batch of actions. optional int64 client_time_ms = 2; } message RoundtripNetworkStats { message ActionNetworkStats { // The action type. optional int32 action_info_case = 1; // The size of this action after decoding, in bytes. optional int64 decoded_size_bytes = 2; } // The total size of the received HTTP response body in bytes, before // decoding. This is essentially the network footprint of the received // response, modulo HTTP headers. optional int64 roundtrip_encoded_body_size_bytes = 1; // The total size of the received HTTP response body in bytes, after // decoding. This is essentially the memory footprint of the received proto, // and a baseline to compare the footprint of individual actions with. optional int64 roundtrip_decoded_body_size_bytes = 2; // The network stats for ALL received actions. Note that this may include // actions that were not executed, so this list can be longer than // |processed_actions|. repeated ActionNetworkStats action_stats = 3; // Used for Chrome metrics only; in backend-metrics, this will always be 1 and // can be ignored. optional int32 num_roundtrips = 4; } // Next request to get a script's actions. message NextScriptActionsRequestProto { // The result of processing each ActionProto from the previous response. This // field must be in the same order as the actions in the original response. // It may have less actions in case of failure. repeated ProcessedActionProto processed_actions = 1; // Contains all roundtrip level (as opposed to action level) timing stats. optional RoundtripTimingStats timing_stats = 2; // Tracks whether the last roundtrip triggered a slow connection warning and // whether it was shown to the user. optional SlowWarningStatus slow_connection_warning = 34; // Roundtrip network stats for this RPC. optional RoundtripNetworkStats network_stats = 3; } message CUPResponseData { // A serialized ActionsResponseProto. optional bytes response = 1; // The signature signing both the response, as well as the request hash, key // ID, and nonce of the corresponding ScriptActionRequestProto. See // https://source.chromium.org/chromium/chromium/src/+/main:docs/updater/cup.md // for the signing scheme. optional bytes ecdsa_signature = 2; } // Response of a script's actions. message ActionsResponseProto { // CUP-signed version of this proto. When set, the rest of the fields in // ActionsResponseProto should be ignored. optional CUPResponseData cup_data = 11; // Opaque data to send to the next ScriptActionRequestProto. optional bytes global_payload = 4; // Opaque data to send to the next ScriptActionRequestProto for the same // script. optional bytes script_payload = 2; // Actions to be performed in order. // Should stop processing as soon as an action fails. repeated ActionProto actions = 3; // List of scripts to update. // // The client is expected to update the cache of scripts with this new // information. No action is needed when this field is not set. If the field // is set with an empty list of scripts, then no script is eligible to run // anymore. // // Note: This is an intermediate solution and the logic associated with this // field will eventually be absorbed into the supports script response from // the backend. message UpdateScriptListProto { repeated SupportedScriptProto scripts = 1; } optional UpdateScriptListProto update_script_list = 5; // Needs to be evaluated before each JS flow action. Contains function // definitions that js flows might call. // Only set if ClientContextProto::js_flow_library_loaded is false. optional string js_flow_library = 13; // Id of the current run. optional uint64 run_id = 12; // Opaque data for reporting progress. Only included in the initial response // from GetActions. optional bytes report_token = 14; reserved 1, 6 to 10; } // A privacy sensitive way to look up Trigger Scripts. Allows querying for // scripts by hashing the requested domain urls and sending only some of // the leading bits, such that the recipient will be unable to reconstruct the // original URL. message GetTriggerScriptsByHashPrefixRequestProto { // Required. Number of bits in each hash prefix. Value must be in the range // [15, 64]. optional uint32 hash_prefix_length = 1; // Required. Hash prefixes for requested urls. The prefix will be taken as the // first `hash_prefix_length` number of bits of this uint64. Other bits will // be ignored. CityHash64 should be used to calculate the hashes. Encoding of // the domain url prior to hashing should be UTF-8, it should include the // http(s) header and exclude the last '/' character. // Examples: // - https://www.exampledomain.com // - https://example.domain.com // - https://domain.com repeated uint64 hash_prefix = 2 [packed = true]; // The client context of the device for which you want to know script // capabilities. // NOTE: Currently, this will only contain the Chrome version number, locale // and country for privacy reasons. optional ClientContextProto client_context = 3; // There is only a subset of parameters allowed to be sent from the client. // INTENT parameter is required. repeated ScriptParameterProto script_parameters = 4; } message GetTriggerScriptsByHashPrefixResponseProto { message MatchInfoProto { // The domain for which this trigger script is available. optional string domain = 1; optional GetTriggerScriptsResponseProto trigger_scripts_response = 2; } // Match information for the requested hash prefixes. No correlation should // be assumed between the order of returned info and the order of requested // prefixes. Clients are expected to match the returned urls to determine // which responses they are interested in. repeated MatchInfoProto match_info = 1; } // RPC request to fetch the available trigger scripts for a particular domain. message GetTriggerScriptsRequestProto { // The exact url for which to fetch the trigger scripts. optional string url = 1; // The client context. // NOTE: Currently, this will only contain the Chrome version number for // privacy reasons. optional ClientContextProto client_context = 2; // Optional script parameters. repeated ScriptParameterProto script_parameters = 3; } // The RPC response to a |GetTriggerScriptsRequestProto|. message GetTriggerScriptsResponseProto { // The available trigger scripts, if any. repeated TriggerScriptProto trigger_scripts = 1; // A list of additional domains and subdomains. Trigger scripts will // automatically cancel the ongoing session if the user navigates away from // the original domain or any of the additional domains. repeated string additional_allowed_domains = 2; // The amount of time a trigger script may evaluate trigger conditions while // invisible. If a trigger script is invisible for this amount of time, it // will automatically finish with TRIGGER_CONDITION_TIMEOUT. // If not specified, there is no automatic timeout. // // This is only counted while no trigger script is shown, and the time is // reset on tab switch and whenever a trigger script is hidden. Note that this // only counts the time in-between checks, so the actual timeout will be // slightly longer. optional int32 trigger_condition_timeout_ms = 3; // The amount of time between consecutive checks of trigger conditions. Should // not be too small to limit performance impact. optional int32 trigger_condition_check_interval_ms = 4 [default = 1000]; // The list of script parameters for the client to use. This can be different // from the list the client sent in the GetTriggerScriptsRequest. // // For some flows, the GetTriggerScripts RPC is the first and only // communication with the backend prior to the start of the regular flow. As // such, the backend needs to send any additional script parameters (such as // appropriate overlay colors) back to the client such that the regular flows // are guaranteed to have a full set of script parameters when/if they start. repeated ScriptParameterProto script_parameters = 5; } // A trigger script contains the full specification for a trigger script that is // run when a specific condition is true, prior to the full run. message TriggerScriptProto { enum TriggerScriptAction { UNDEFINED = 0; // The current trigger script is cancelled. If the prompt is not currently // being shown, this has no effect. If the prompt is currently being shown, // the prompt is hidden and the trigger script is restarted once the trigger // condition has become false again. NOT_NOW = 1; // Cancels the current trigger script and does not restart it for this // session. CANCEL_SESSION = 2; // Cancels the current trigger script and prevents trigger scripts from ever // running again. TODO(b/172039582): allow a per-domain opt-out. CANCEL_FOREVER = 3; // Displays a popup to give users additional cancel options. SHOW_CANCEL_POPUP = 4; // Stop the trigger script and start the regular script. ACCEPT = 5; } // Set of TriggerUIType to group UKM metrics by. // // The set of available values is defined by AutofillAssistantTriggerUIType in // tools/metrics/histograms/enums.xml enum TriggerUIType { UNSPECIFIED_TRIGGER_UI_TYPE = 0; // Explicit trigger requests by some external trigger surface, i.e., a link // or button. SHOPPING_CART_FIRST_TIME_USER = 1; SHOPPING_CART_RETURNING_USER = 2; SHOPPING_CHECKOUT_FIRST_TIME_USER = 3; SHOPPING_CHECKOUT_RETURNING_USER = 4; FOOD_ORDERING_CART_FIRST_TIME_USER = 9; FOOD_ORDERING_CART_RETURNING_USER = 10; // Implicit trigger requests started by Chrome itself. IN_CHROME_SHOPPING_CART_FIRST_TIME_USER = 5; IN_CHROME_SHOPPING_CART_RETURNING_USER = 6; IN_CHROME_SHOPPING_CHECKOUT_FIRST_TIME_USER = 7; IN_CHROME_SHOPPING_CHECKOUT_RETURNING_USER = 8; IN_CHROME_FOOD_ORDERING_CART_FIRST_TIME_USER = 11; IN_CHROME_FOOD_ORDERING_CART_RETURNING_USER = 12; } // The |trigger_condition| must be true for the script to trigger. optional TriggerScriptConditionProto trigger_condition = 1; // The user interface to show. optional TriggerScriptUIProto user_interface = 3; // What should happen if the user swipe-dismisses the bottom sheet. optional TriggerScriptAction on_swipe_to_dismiss = 4 [default = CANCEL_SESSION]; // An identifier for the type of trigger UI this trigger represents, for UKM. optional TriggerUIType trigger_ui_type = 7; reserved 2, 5, 6; } message TriggerScriptConditionProto { message DocumentReadyStateCondition { // The minimum document ready state for the condition to be true. optional DocumentReadyState min_document_ready_state = 1; // If specified, check the document in the given frame, instead // of the main document. optional SelectorProto frame = 2; } oneof type { // The condition matches if all of these conditions match. TriggerScriptConditionsProto all_of = 1; // The condition matches if at least one of these conditions matches. TriggerScriptConditionsProto any_of = 2; // The condition matches if none of these conditions match. TriggerScriptConditionsProto none_of = 3; // The condition matches if the specified selector matches the current DOM.. SelectorProto selector = 8; // The condition matches if the user has stored login credentials for the // domain. Empty stored_login_credentials = 5; // The condition matches if the user has never seen a trigger script before. Empty is_first_time_user = 6; // The condition matches if the client is in the specified experiment. int32 experiment_id = 7; // The condition matches if the keyboard is hidden. Empty keyboard_hidden = 9; // The condition describes a parameter value that must be set to trigger. ScriptParameterMatchProto script_parameter_match = 10; // Pattern of the path parts of the URL, including query and '#'. string path_pattern = 11; // Domain (exact match), including the scheme (e.g. // "https://www.example.com"). string domain_with_scheme = 12; // The condition matches if the DOM state of the specified frame matches // |document_ready_state|. DocumentReadyStateCondition document_ready_state = 13; } reserved 4; } message TriggerScriptConditionsProto { repeated TriggerScriptConditionProto conditions = 1; } message TriggerScriptUIProto { message ProgressBar { repeated DrawableProto step_icons = 1; optional int32 active_step = 2; } message TriggerChip { optional ChipProto chip = 1; optional TriggerScriptProto.TriggerScriptAction action = 2; } message Popup { message Choice { // The text to display. optional string text = 1; // The action to execute if this popup item is selected. optional TriggerScriptProto.TriggerScriptAction action = 2; } // The available popup items. repeated Choice choices = 1; } // The status message to display. optional string status_message = 1; // The callout to display. If not specified, no callout will be shown. optional string callout_message = 2; // The progress bar to display. If not specified, no progress bar will be // shown. optional ProgressBar progress_bar = 3; // The cancel popup, usually associated with a particular chip. optional Popup cancel_popup = 4; // The available left-aligned chips, specified in order from left to right. repeated TriggerChip left_aligned_chips = 5; // The available right-aligned chips, specified in order from left to right. repeated TriggerChip right_aligned_chips = 6; // The status message to display when transitioning from this trigger script // to the regular script. optional string regular_script_loading_status_message = 7; // Whether the visual viewport should be resized to allow scrolling to the // bottom of the page while the trigger script is being displayed. optional bool resize_visual_viewport = 8; // Whether the bottom sheet should temporarily disappear when scrolling down // the website, to move out of the way. This setting is ignored if // |ui_timeout_ms| is specified. // // The value of resize_visual_viewport is ignored when scroll_to_hide is true. // This allows the backend setting both to true and letting chrome choose // scroll_to_hide if it is supported. optional bool scroll_to_hide = 9; // The amount of time that the UI may be shown to the user. If not specified, // there is no limit. This is intended for websites where the UI could block // important parts of the website underneath and |scroll_to_hide| does not // mitigate the issue. If this field is specified, |scroll_to_hide| will be // ignored. |resize_visual_viewport| will be applied if requested. // // Once hidden, the UI may be shown again the next time the trigger condition // is true (same behavior as NOT_NOW). Note that the timeout is disabled if // the user taps either the overflow icon or the confirm chip. optional int32 ui_timeout_ms = 10; } // An action could be performed. message ActionProto { // Wait these many milliseconds before executing the action, if set. optional int32 action_delay_ms = 3; // Opaque data that should not be interpreted by the client. The client must // pass this back unchanged in the next request optional bytes server_payload = 4; // The action to be executed. // // WARNING: proto messages in this oneof and all protos they depend on must // meet the requirements listed on jspb_parse.h to be callable conveniently // from RunJsFlow. In practice, this means don't add any new fields of type // bytes, uint32, uint64, fixed32, fixed64, sfixed32 or sfixed64. oneof action_info { SelectOptionProto select_option = 7; NavigateProto navigate = 9; PromptProto prompt = 10; TellProto tell = 11; ShowCastProto show_cast = 12; WaitForDomProto wait_for_dom = 19; UseCreditCardProto use_card = 28; UseAddressProto use_address = 29; UploadDomProto upload_dom = 18; ShowProgressBarProto show_progress_bar = 24; ShowDetailsProto show_details = 32; StopProto stop = 35; CollectUserDataProto collect_user_data = 36; SetAttributeProto set_attribute = 37; ShowInfoBoxProto show_info_box = 39; ExpectNavigationProto expect_navigation = 40; WaitForNavigationProto wait_for_navigation = 41; ConfigureBottomSheetProto configure_bottom_sheet = 42; ShowFormProto show_form = 43; PopupMessageProto popup_message = 44; WaitForDocumentProto wait_for_document = 45; ShowGenericUiProto show_generic_ui = 49; GeneratePasswordForFormFieldProto generate_password_for_form_field = 52; SaveGeneratedPasswordProto save_generated_password = 53; ConfigureUiStateProto configure_ui_state = 54; PresaveGeneratedPasswordProto presave_generated_password = 55; GetElementStatusProto get_element_status = 56; ScrollIntoViewProto scroll_into_view = 57; WaitForDocumentToBecomeInteractiveProto wait_for_document_to_become_interactive = 58; WaitForDocumentToBecomeCompleteProto wait_for_document_to_become_complete = 59; SendClickEventProto send_click_event = 60; SendTapEventProto send_tap_event = 61; JsClickProto js_click = 62; SendKeystrokeEventsProto send_keystroke_events = 63; SendChangeEventProto send_change_event = 64; SetElementAttributeProto set_element_attribute = 65; SelectFieldValueProto select_field_value = 66; FocusFieldProto focus_field = 67; WaitForElementToBecomeStableProto wait_for_element_to_become_stable = 68; CheckElementIsOnTopProto check_element_is_on_top = 69; ReleaseElementsProto release_elements = 70; DispatchJsEventProto dispatch_js_event = 72; SendKeyEventProto send_key_event = 73; SelectOptionElementProto select_option_element = 74; CheckElementTagProto check_element_tag = 75; CheckOptionElementProto check_option_element = 76; SetPersistentUiProto set_persistent_ui = 77; ClearPersistentUiProto clear_persistent_ui = 78; ScrollIntoViewIfNeededProto scroll_into_view_if_needed = 79; ScrollWindowProto scroll_window = 80; ScrollContainerProto scroll_container = 81; SetTouchableAreaProto set_touchable_area = 82; BlurFieldProto blur_field = 85; ResetPendingCredentialsProto reset_pending_credentials = 86; SaveSubmittedPasswordProto save_submitted_password = 87; UpdateClientSettingsProto update_client_settings = 89; JsFlowProto js_flow = 92; ExecuteJsProto execute_js = 93; RegisterPasswordResetRequestProto register_password_reset_request = 94; ExternalActionProto external_action = 95; SetNativeValueProto set_native_value = 96; SetNativeCheckedProto set_native_checked = 97; PromptQrCodeScanProto prompt_qr_code_scan = 98; ReportProgressProto report_progress = 99; ParseSingleTagXmlProto parse_single_tag_xml = 100; } // Set to true to make the client remove any contextual information if the // script finishes with this action. It has no effect if there is any other // action sent to the client after this one. Default is false. optional bool clean_contextual_ui = 33; reserved 5, 6, 8, 13 to 17, 20 to 23, 25 to 27, 30, 31, 34, 38, 46 to 48, 50, 51, 71, 83, 84, 88, 90, 91; } // Result of |CollectUserDataProto| to be sent to the server. message CollectUserDataResultProto { optional string card_issuer_network = 1; // Whether the integrated terms and conditions approval checkbox was checked. optional bool is_terms_and_conditions_accepted = 2; // The email address of the payer. optional string payer_email = 3; // If set, this means that the user triggered the action in // |CollectUserDataProto.additional_actions| that has index // |additional_action_index|. optional int32 additional_action_index = 4; // If set, this means that the user clicked on one of the terms and conditions // links. optional int32 terms_link = 5; oneof payload_or_tag { // The payload of the chosen login option, from LoginOptionsProto.payload. bytes login_payload = 6; // The payload of the chosen login option, from LoginOptionsProto.tag. string login_tag = 21; } // The values obtained by the generic user interface. optional ModelProto model = 9; // The memory keys of all non-empty text inputs, corresponding to the memory // keys specified in |TextInputProto|. The values themselves are stored in the // client and do not leave the device. repeated string set_text_input_memory_keys = 10; // The values obtained from the additional sections. repeated ModelProto.ModelValue additional_sections_values = 15; // Indicates whether the UI was shown to the user. This can be false if // only the login section was requested and the choice was implicitly made. optional bool shown_to_user = 16; // Indicates that the chosen login option was missing the username. optional bool login_missing_username = 17; reserved 7, 8, 11 to 14, 18 to 20; } message ActionTimingStats { // Requested delay before executing the action. optional int64 delay_ms = 1; // Time actively spent by the client to execute the action. optional int64 active_time_ms = 2; // Time spent waiting for users to complete a task and/or for website // loading/navigation. optional int64 wait_time_ms = 3; } // Enum used to track the slow warnings that can trigger due to slow connection // or long running wait for dom actions. enum SlowWarningStatus { // The warning wasn't triggered. NO_WARNING = 0; // The warning was triggered but not shown to the user. WARNING_TRIGGERED = 1; // The warning was triggered and shown to the user. WARNING_SHOWN = 2; } message ProcessedActionProto { // The action that was processed. optional ActionProto action = 1; optional ProcessedActionStatusProto status = 2; optional ProcessedActionStatusDetailsProto status_details = 19; oneof result_data { PromptProto.Result prompt_choice = 5; // Should be set as a result of CollectUserDataAction. CollectUserDataResultProto collect_user_data_result = 15; // May be set as a result of WaitForDomProto. WaitForDomProto.Result wait_for_dom_result = 22; // Should be set as a result of FormAction. FormProto.Result form_result = 21; WaitForDocumentProto.Result wait_for_document_result = 25; // Should be set as a result of ShowGenericUiProto. ShowGenericUiProto.Result show_generic_ui_result = 28; // Should be set as a result of GetElementStatusProto. GetElementStatusProto.Result get_element_status_result = 31; // Should be set as a result of UploadDomProto. UploadDomProto.Result upload_dom_result = 33; // Should be set as a result of CheckOptionElementProto. CheckOptionElementProto.Result check_option_element_result = 35; // Should be set as a result of SendKeystrokeEventsProto. SendKeystrokeEventsProto.Result send_key_stroke_events_result = 36; // Should be set as a result of JsFlowProto. JsFlowProto.Result js_flow_result = 37; // Should be set as a result of SaveSubmittedPassword. SaveSubmittedPasswordProto.Result save_submitted_password_result = 38; // Should be set as a result of an ExternalAction. ExternalActionProto.Result external_action_result = 39; } // Reports information about navigation that happened while // processing the action. This is meant for debugging. optional NavigationInfoProto navigation_info = 20; // Reports how long it took for the client to run the action. This does not // include the delay specified in action.delay_ms. optional int64 run_time_ms = 23; // Collects the timing stats related to the action execution. optional ActionTimingStats timing_stats = 32; // Tracks whether the action triggered a slow website warning and whether it // was shown to the user. optional SlowWarningStatus slow_warning_status = 34; reserved 3, 4, 6 to 14, 16 to 18, 24, 26, 27, 29, 30; } // Extended information about the action status, which provides more details // about what happened than a simple ProcessedActionStatusProto can. message ProcessedActionStatusDetailsProto { // More information included for unexpected errors. // // Only set for action whose status are OTHER_ACTION_STATUS or // UNEXPECTED_JS_ERROR. optional UnexpectedErrorInfoProto unexpected_error_info = 1; // In some case, such as USER_ABORTED_ACTION and NAVIGATION_ERROR, the status // reported by the action is overridden after the action failed, to report a // more appropriate error. When that happens, this field contains the original // status, to help debugging. optional ProcessedActionStatusProto original_status = 2; // More information included for autofill related errors. optional AutofillErrorInfoProto autofill_error_info = 3; // Additional information from the |WebController|. optional WebControllerErrorInfoProto web_controller_error_info = 5; // Additional information from the |ElementFinder|. repeated ElementFinderInfoProto element_finder_info = 6; reserved 4; } message NavigationInfoProto { // Navigation started while processing the current action. optional bool started = 1; // Navigation ended while processing the current action. optional bool ended = 2; // Navigation failed before or during the processing of the current action. optional bool has_error = 3; // Unexpected navigation started while processing the current action. This // will happen during some actions, such as PROMPT action but it should // normally not happen during scripts that have been updated to use // expect_navigation. optional bool unexpected = 4; } // Extra debugging information included in case of unexpected errors. // // Presence of this element either points to a problem in the executed // javascript (in which case, the relevant js_exception_xxx fields should be // set) or a bug in the client code. message UnexpectedErrorInfoProto { // Source file, within the client code, where an unexpected error was detected // and reported. // // Only filled for unexpected errors OTHER_ACTION_STATUS and // UNEXPECTED_JS_ERROR. // // This and source_line are only meaningful for the exact version reported in // the client context. optional string source_file = 1; // Line number, within the client's source file, where the error was detected. optional int32 source_line_number = 2; // JavaScript exception class name, if reporting a JavaScript error. optional string js_exception_classname = 3; enum JsExceptionLocation { UNKNOWN = 0; // Corresponds to ActionsResponseProto::js_flow_library JS_FLOW_LIBRARY = 1; // Corresponds to JsFlowProto::js_flow JS_FLOW = 2; } // The location that caused the JavaScript exception. Guaranteed to have the // same number of entries as js_exception_line_numbers and // js_exception_column_numbers. repeated JsExceptionLocation js_exception_locations = 8 [packed = true]; // JavaScript exception line numbers, within the js snippet that was sent to // devtools runtime by the client, if reporting a JavaScript error. Together // with |js_exception_column_numbers| this forms a stack trace. repeated int32 js_exception_line_numbers = 4; // JavaScript exception column number, within the js snippet that was sent to // devtools runtime by the client, if reporting a JavaScript error. Together // with |js_exception_line_numbers| this forms a stack trace. repeated int32 js_exception_column_numbers = 5; // Error code returned by devtools, if any. 0 is considered a success. optional int32 devtools_error_code = 6; // Error message returned by devtools, if any. optional string devtools_error_message = 7; } // Message to report autofill related errors for debugging purposes. message AutofillErrorInfoProto { message AutofillFieldError { // The field the error occurred for. optional SelectorProto field = 1; // The value expression associated with the field that caused the error. optional string value_expression = 5; oneof error_type { // No fallback value for this field. bool no_fallback_value = 3; // The status of the action. ProcessedActionStatusProto status = 4; // The field was required and expected to be filled during the fallback // flow but was empty in the end. bool empty_after_fallback = 6; // The field was expected to be cleared during the fallback flow but // still had a value in the end. bool filled_after_clear = 7; } reserved 2; } // Comma separated list of address keys in the client memory when the // unexpected error occurred. Memory values are never reported this way since // they may contain PII. Only the address key names! optional string client_memory_address_key_names = 1; // Name of the address key requested in the list of keys in // |client_memory_address_key_names|. optional string address_key_requested = 2; // Whether the client memory at |address_key_requested| pointed to null. optional bool address_pointee_was_null = 3; // Error status of the Chrome autofill attempt. optional ProcessedActionStatusProto autofill_error_status = 4; // Errors that occurred during fallback filling of autofill fields. repeated AutofillFieldError autofill_field_error = 5; // These values should match the values in FullCardRequest::FailureType. enum GetFullCardFailureType { UNKNOWN_FAILURE_TYPE = 0; // The user closed the prompt. The following scenarios are possible: // 1) The user declined to enter their CVC and closed the prompt. // 2) The user provided their CVC, got auth declined and then closed the // prompt without attempting a second time. // 3) The user provided their CVC and closed the prompt before waiting for // the result. PROMPT_CLOSED = 1; // The card could not be looked up due to card auth declined or failed. VERIFICATION_DECLINED = 2; // The request failed for technical reasons, such as a closing page or lack // of network connection. GENERIC_FAILURE = 3; } // Failure type from the |FullCardRequest|. optional GetFullCardFailureType get_full_card_failure_type = 6; } // Message to report errors related to WebController execution. message WebControllerErrorInfoProto { enum WebAction { UNSPECIFIED_WEB_ACTION = 0; // Scroll an element into view by centering it on the page. This uses // native JS functionality. SCROLL_INTO_VIEW = 1; // Waiting for the document ready state to be interactive. WAIT_FOR_DOCUMENT_TO_BECOME_INTERACTIVE = 2; // Send a click or tap event to an element. CLICK_OR_TAP_ELEMENT = 3; // Select an option from an HTML dropdown. SELECT_OPTION = 4; // Scroll the element into view with padding. This uses native JS // functionality for the initial scrolling and calculates the scrolling // for padding manually. SCROLL_INTO_VIEW_WITH_PADDING = 6; // Get the |value| attribute of an element. GET_FIELD_VALUE = 7; // Get any attribute of an element. GET_STRING_ATTRIBUTE = 8; // Select an element's value. This does only work for text elements. SELECT_FIELD_VALUE = 9; // Set the |value| attribute of an element. SET_VALUE_ATTRIBUTE = 10; // Set any attribute of an element. SET_ATTRIBUTE = 11; // Send a series of keystroke inputs. This requires an element to have // focus to receive them. SEND_KEYBOARD_INPUT = 12; // Get the outer HTML of an element. GET_OUTER_HTML = 13; // Get the tag of an element. GET_ELEMENT_TAG = 14; // Set active focus on a field. FOCUS_FIELD = 15; // Wait for an element position to stabilize before clicking or a tapping. // Fails with ELEMENT_UNSTABLE. WAIT_UNTIL_ELEMENT_IS_STABLE = 16; // Check that the element is on top, usually as part of clicking. // Fails with ELEMENT_NOT_ON_TOP. ON_TOP = 17; // Waiting for a certain document ready state failed. WAIT_FOR_DOCUMENT_READY_STATE = 18; // Trigger a change event. SEND_CHANGE_EVENT = 19; // Dispatch a 'duplexweb' event on document. DISPATCH_EVENT_ON_DOCUMENT = 20; // Send a single key event. SEND_KEY_EVENT = 21; // Set the selected option of an element. SELECT_OPTION_ELEMENT = 22; // Send a JS click to the element. JS_CLICK_ELEMENT = 23; // Check the selected option of an element. CHECK_OPTION_ELEMENT = 24; // Scroll an element into view only if needed. SCROLL_INTO_VIEW_IF_NEEDED = 25; // Scroll the window of a frame by a certain amount. SCROLL_WINDOW = 26; // Scroll the container by a certain amount. SCROLL_CONTAINER = 27; // Blur an element that might have focus to remove its focus. BLUR_FIELD = 28; // Execute JS on an element. EXECUTE_JS = 29; reserved 5; } // The web-action that failed. This is usually a step in an execution chain // for an action. optional WebAction failed_web_action = 1; } message ElementFinderInfoProto { // Tracking ID of the |Selector|. optional int64 tracking_id = 1; // If the Selector fails to be resolved, this index holds the starting index // of filters currently being applied. optional int32 failed_filter_index_range_start = 2; // If a filter failed, this index holds the filter that was supposed to be // applied next. optional int32 failed_filter_index_range_end = 3; // The original status of |ElementFinder|. optional ProcessedActionStatusProto status = 4; // If set, the document could not be resolved. optional bool get_document_failed = 5; enum SemanticInferenceStatus { // Unknown error. Should not occur. UNKNOWN = 0; // The model was run successfully. SUCCESS = 1; // An unexpected error happened when the model was run. E.g. the frame // was not available where it was expected to be. UNEXPECTED_ERROR = 2; // The model was successfully loaded but could not initialize the executor. INITIALIZATION_ERROR = 3; // The model could not be loaded. This is unexpected and should not occur. MODEL_LOAD_ERROR = 4; // The model loading timed out. MODEL_LOAD_TIMEOUT = 5; } message PredictedElement { // The predicted objective and predicted role of this element. optional SelectorProto.SemanticFilter semantic_filter = 4; // The element's backend node id. optional int32 backend_node_id = 3; // Whether this element was found using a feature override. optional bool used_override = 5; reserved 1, 2; } message SemanticInferenceResult { // If this is empty, the model inference did not find any results. repeated PredictedElement predicted_elements = 1; // Status per frame. The order is not predictable, the results are // collected async and arrive in random order. repeated SemanticInferenceStatus status_per_frame = 2; } optional SemanticInferenceResult semantic_inference_result = 6; } // The pseudo type values come from // https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-PseudoType. enum PseudoType { UNDEFINED = 0; FIRST_LINE = 1; FIRST_LETTER = 2; BEFORE = 3; AFTER = 4; BACKDROP = 5; SELECTION = 6; FIRST_LINE_INHERITED = 7; SCROLLBAR = 8; SCROLLBAR_THUMB = 9; SCROLLBAR_BUTTON = 10; SCROLLBAR_TRACK = 11; SCROLLBAR_TRACK_PIECE = 12; SCROLLBAR_CORNER = 13; RESIZER = 14; INPUT_LIST_BUTTON = 15; } // A reference to one or more elements on the page, possibly nested in frames. // Next ID: 12 message SelectorProto { // Filters for the element on the page. Filter are applied sequentially, using // the output of the previous filter as input. The root of these filters is // the main frame's document. repeated Filter filters = 9; // An ID that's used to identify selector in logs, as they pass through // different layers. It is passed to the client only as FYI. Client might // choose to echo back these ids when reporting specific selectors as // matching or not matching. optional int64 tracking_id = 10; // A filter that starts with one or more elements and returns one on more // elements. Filters are meant to be applied sequentially. // // The returned elements will be sorted by their order in the document. // Elements that were matched via the labelled filter will have the same order // as their label. // // Next ID: 17 message Filter { oneof filter { // Enter the document of an iframe or shadow root. The next filters apply // to the document inside of the iframe(s) or on the shadow element. // // Fails if there are more than one match. EmptyFilter enter_frame = 1; // Evaluate the given CSS selector on all start elements and use // the result as end elements. string css_selector = 2; // Check the inner text of all start elements, using the Javascript // innerText property. Keep only the element whose innerText match the // given regular expression. TextFilter inner_text = 3; // Check the value of all start elements, using the Javascript value // property. Keep only the element whose value property match the given // regular expression. TextFilter value = 4; // Select the pseudo-element of the given type associated with the current // elements. PseudoType pseudo_type = 5; // Only keep elements that have a box model, even if it is empty. // // This is the equivalent of the old MUST_BE_VISIBLE flag. It's been // renamed as having a bounding box is not enough to imply visibility. BoundingBoxFilter bounding_box = 6; // Take the nth match. Fails with ELEMENT_RESOLUTION_FAILED if there are // not enough matches. NthMatchFilter nth_match = 7; // Only keep elements that have a pseudo-element with the given content. // // This only works with BEFORE and AFTER. // // Note that this just filters out elements. It doesn't select the // pseudo-element; use pseudo_type for that. // // Deprecated: prefer css_style. This should be removed in Chrome M89. PseudoElementContent pseudo_element_content = 8; // Go from label to the labelled control. Only works starting with current // elements that are LABEL. // // For example if we have: // ... // then labelled, goes from the label to the form element. // // So, the form element can be accessed as "label~=/FirstName/ labelled". // This is especially useful in situations where someid can change. // // The same selector also works in the case where the element is inside of // the label, so we don't need to worry which implementation is used when // building the selector: // EmptyFilter labelled = 9; // Only keep results that match the given CSS selector. string match_css_selector = 11; // Only keep elements whose computed style match the given filter. This is // based on Window.computedStyle() CssStyleFilter css_style = 12; // Filter out elements whose center point are covered by another element. // // This first calls Element.scrollIntoViewIfNeeded to make sure the // element can be moved to the viewport, then calls // DocumentOrShadowDom.getElementFromPoint and compares the result with // the expected element. If the element at point is not the element, a // descendant of the element or a label of the element, there is an // overlay. // // Note that: // // - this filter will also weed out elements with no bounding box. Check // with bounding_box { } first. // // - this filter will also weed out elements that cannot be scrolled into // the viewport. // // - an element might be covered by an overlay and still be visible if the // overlay is transparent. An element might be covered by an overlay and // still be clickable, if the overlay intercepts and forwards events. // Overlays with pointer-events set to none are ignored. // // - an element might be only partially covered by an overlay. This filter // only checks the center of the element, since this is where the click // action sends its clicks or taps. // // - this filter only detects overlays in the current frame. To detect // overlays that cover the frame element itself, apply this filter on the // frame element before calling enter_frame. OnTopFilter on_top = 13; // Filtering against an element property. // // This filter replaces |inner_text| and |value|. PropertyFilter property = 14; // Retrieve parent of current elements. EmptyFilter parent = 15; // Run the ML model over extracted node signals and retrieve a matching // result. // TODO(b/233340267): By convention this must be the first filter in the // list. It can be followed by any set of other filters. // TODO(b/233340267): The filter only supports returning a single element, // although that element can have any number of children. Should it find // multiple elements, the Selector will return a |TOO_MANY_ELEMENTS| // error. SemanticFilter semantic = 16; } reserved 10; } // A regular expression value for filtering. message PropertyFilter { // The property to filter against. optional string property = 1; oneof value { TextFilter text_filter = 2; AutofillValueRegexp autofill_value_regexp = 3; } } // A way of filtering elements by their pseudo-element content. message PseudoElementContent { optional PseudoType pseudo_type = 1; optional TextFilter content = 2; } // Only keep elements whose computed style match the given filter. This is // based on Window.computedStyle() // // See // https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle message CssStyleFilter { // CSS property name. optional string property = 3; // Name of the pseudo-element whose style should be checked. Leave it unset // or set to the empty string to check the style of the real element. // // This is the pseudoElt argument of JavaScript's // window.getComputedStyle(element, [, pseudoElt]). optional string pseudo_element = 4; // By default the text filter in |value| must match. Set this to false to // require the text condition not to match. optional bool should_match = 5 [default = true]; // CSS property value match. // // Valid computed CSS properties always have a value, even if it's a default // value. The default value depends on the property. optional TextFilter value = 6; reserved 1, 2; } // Only keep elements that have a bounding box. message BoundingBoxFilter { // If require_nonempty=false, which is the default, require elements to have // at least one bounding rect returned by Element.getClientRects() // // If require_nonempty=true, additionally require the element's bounding // client rect to have a nonzero width and height. optional bool require_nonempty = 1; } // Filter out elements covered by other elements, such as overlays. message OnTopFilter { // If true, scroll the element into view before checking whether // it's on top. // // The logic for checking whether an element is on top only works on // elements that are positioned within the current viewport. Setting it to // false turns off automatic scrolling to make the element visible, so the // caller must make sure it's already the case. optional bool scroll_into_view_if_needed = 1 [default = true]; // If true and the element cannot be scrolled into view, so the filter // cannot check whether the element is on top, keep the element in the match // set. // // This can be combined with scroll_into_view_if_needed=false to make // this filter best effort and only check elements that are already in view. optional bool accept_element_if_not_in_view = 2; } message EmptyFilter {} message NthMatchFilter { // Take the match at the given |index|. optional int32 index = 1; } message SemanticFilter { // The objective we expect this Selector to have. optional int32 objective = 1; // The role we expect this Selector to have. optional int32 role = 2; // Timeout, defaults to 5s. // TODO(b/218482826): Consider moving this to settings. optional int32 model_timeout_ms = 3 [default = 5000]; // If true, ignore the objective and treat it as a wildcard '*' when // matching. optional bool ignore_objective = 4; reserved 5; } reserved 1 to 8, 11; } enum OptionalStep { STEP_UNSPECIFIED = 0; SKIP_STEP = 1; REPORT_STEP_RESULT = 2; REQUIRE_STEP_SUCCESS = 3; } // Contain all arguments to perform a select option action. This action also // fires a "change" event on the element. If the option is not found, an // |OPTION_VALUE_NOT_FOUND| error is returned. If the action is used on an // element that is not an HTML