| // Copyright 2019 The Chromium Authors. All rights reserved. |
| // 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 "model.proto"; |
| import "view_layout.proto"; |
| |
| message GenericUserInterfaceProto { |
| // The root view, usually a view container. |
| optional ViewProto root_view = 1; |
| // The interactions for this generic user interface. |
| optional InteractionsProto interactions = 2; |
| // The model containing initial values for interactive UI. |
| optional ModelProto model = 3; |
| } |
| |
| message InteractionsProto { |
| repeated InteractionProto interactions = 1; |
| } |
| |
| // An interaction consists of a trigger event and a series of actions. |
| message InteractionProto { |
| // Functions to call each time the event happens, in the specified order. |
| repeated CallbackProto callbacks = 1; |
| // The trigger event for |callbacks|. |
| optional EventProto trigger_event = 2; |
| } |
| |
| // UI Actions to invoke. |
| message CallbackProto { |
| oneof kind { |
| SetModelValueProto set_value = 1; |
| ShowInfoPopupProto show_info_popup = 2; |
| ShowListPopupProto show_list_popup = 3; |
| ComputeValueProto compute_value = 4; |
| SetUserActionsProto set_user_actions = 5; |
| EndActionProto end_action = 6; |
| ShowCalendarPopupProto show_calendar_popup = 7; |
| SetTextProto set_text = 8; |
| ToggleUserActionProto toggle_user_action = 9; |
| SetViewVisibilityProto set_view_visibility = 11; |
| SetViewEnabledProto set_view_enabled = 12; |
| ShowGenericUiPopupProto show_generic_popup = 13; |
| } |
| // Optional model identifier pointing to a single boolean. If set, the |
| // callback will only be invoked if the condition is true. |
| optional string condition_model_identifier = 10; |
| } |
| |
| message EventProto { |
| oneof kind { |
| OnModelValueChangedEventProto on_value_changed = 1; |
| OnViewClickedEventProto on_view_clicked = 2; |
| OnUserActionCalled on_user_action_called = 3; |
| OnTextLinkClickedProto on_text_link_clicked = 4; |
| OnPopupDismissedProto on_popup_dismissed = 5; |
| } |
| } |
| |
| // Event that is triggered whenever |model_identifier| changes. |
| message OnModelValueChangedEventProto { |
| // The identifier of the value to observe. |
| optional string model_identifier = 1; |
| } |
| |
| // Event that is triggered whenever |view_identifier| is clicked. |
| message OnViewClickedEventProto { |
| // The identifier of the view to observe. |
| optional string view_identifier = 1; |
| } |
| |
| // Event that is triggered when |user_action_identifier| is called. |
| message OnUserActionCalled { |
| // The identifier of the user action to observe. |
| optional string user_action_identifier = 1; |
| } |
| |
| // Event that is triggered when clicking the specified text link. |
| message OnTextLinkClickedProto { |
| // The number of the text link to observe, i.e., the number in the html-style |
| // tag <link3>...</link3>. |
| optional int32 text_link = 1; |
| } |
| |
| // Event that is triggered when the specified popup is dismissed. |
| message OnPopupDismissedProto { |
| // The identifier of the popup to observe. |
| optional string popup_identifier = 1; |
| } |
| |
| // Callback that writes the specified value to |model_identifier|. |
| message SetModelValueProto { |
| // The model identifier to write to. |
| optional string model_identifier = 1; |
| // The value to write. |
| optional ValueReferenceProto value = 3; |
| reserved 2; |
| } |
| |
| // Computes a value and stores the result to |result_model_identifier|. |
| message ComputeValueProto { |
| oneof kind { |
| // Computes the logical AND of the specified model identifiers. |
| BooleanAndProto boolean_and = 2; |
| // Computes the logical OR of the specified model identifiers. |
| BooleanOrProto boolean_or = 3; |
| // Computes the logical NOT of the specified model identifiers. |
| BooleanNotProto boolean_not = 4; |
| // Creates a string representation of the specified value. |
| ToStringProto to_string = 5; |
| // Compares two values. |
| ValueComparisonProto comparison = 6; |
| // Computes the sum of two single integers. |
| IntegerSumProto integer_sum = 7; |
| } |
| |
| // The model identifier to write the result to. |
| optional string result_model_identifier = 1; |
| } |
| |
| // Performs a logical AND on all specified values. |
| message BooleanAndProto { |
| // The values to logically AND. All values must be single booleans. |
| repeated ValueReferenceProto values = 2; |
| reserved 1; |
| } |
| |
| // Performs a logical OR on all specified values. |
| message BooleanOrProto { |
| // The values to logically OR. All values must be single booleans. |
| repeated ValueReferenceProto values = 2; |
| reserved 1; |
| } |
| |
| // Performs a logical NOT on the specified value. |
| message BooleanNotProto { |
| // The value to logically invert. Must be a single boolean. |
| optional ValueReferenceProto value = 2; |
| reserved 1; |
| } |
| |
| // Creates a string representation of the specified value. |
| message ToStringProto { |
| // The value to stringify. |
| optional ValueReferenceProto value = 3; |
| |
| // Optional format options. |
| oneof format_options { DateFormatProto date_format = 2; } |
| reserved 1; |
| } |
| |
| // A format string for a date, such as "EEE, MMM d". See |
| // http://userguide.icu-project.org/formatparse/datetime for full specification. |
| message DateFormatProto { |
| optional string date_format = 1; |
| } |
| |
| // A comparison of two values in the form |value_a| <mode> |value_b|. EQUAL is |
| // supported for all values. All other comparison modes are only supported for |
| // single integers, strings, and dates. |
| message ValueComparisonProto { |
| enum Mode { |
| UNDEFINED = 0; |
| LESS = 1; |
| LESS_OR_EQUAL = 2; |
| EQUAL = 3; |
| GREATER_OR_EQUAL = 4; |
| GREATER = 5; |
| } |
| |
| // The first value to compare. |
| optional ValueReferenceProto value_a = 4; |
| // The second value to compare. |
| optional ValueReferenceProto value_b = 5; |
| // The comparison mode. |
| optional Mode mode = 3; |
| |
| reserved 1, 2; |
| } |
| |
| // Computes the sum of all input integers. |
| message IntegerSumProto { |
| // The values to sum. All values must be single integers. |
| repeated ValueReferenceProto values = 3; |
| |
| reserved 1, 2; |
| } |
| |
| // Displays a standard info popup. |
| message ShowInfoPopupProto { |
| optional InfoPopupProto info_popup = 1; |
| } |
| |
| // Displays a popup showing a list of strings to choose from. Depending on |
| // |allow_multiselect|, users will be able to select one or multiple items from |
| // the list. |
| message ShowListPopupProto { |
| // The popup item type, corresponding to |
| // chromium/content/browser/input/PopupItemType.java. |
| enum ItemType { |
| GROUP = 0; |
| DISABLED = 1; |
| ENABLED = 2; |
| } |
| // The item names to show in the list. Must be a StringList. |
| optional ValueReferenceProto item_names = 6; |
| // Optional, must be the same length as the list stored at |
| // |items_list_model_identifier| if specified. Will default to ENABLED for all |
| // items if not specified. Must be a list of int32 |ItemType| if specified. |
| optional ValueReferenceProto item_types = 7; |
| // The indices of the selected items (both input and output). Must be a list |
| // of integers. |
| optional string selected_item_indices_model_identifier = 3; |
| // Whether to allow the selection of multiple items or not. |
| optional bool allow_multiselect = 4; |
| // Optional output model identifier to store the names of the selected items |
| // in a StringList. |
| optional string selected_item_names_model_identifier = 5; |
| |
| reserved 1, 2; |
| } |
| |
| // Sets the list of available user actions. User actions are either direct |
| // actions performed via assistant and/or chips that users can tap. |
| message SetUserActionsProto { |
| // The user actions to set. Must contain a UserActionList value. |
| optional ValueReferenceProto user_actions = 2; |
| |
| reserved 1; |
| } |
| |
| // Enables or disables a single user action. Modifies the value in-place. |
| message ToggleUserActionProto { |
| // Input and output. Should point to a list of user actions to modify. |
| optional string user_actions_model_identifier = 1; |
| // The identifier of the specific user action to modify. |
| optional string user_action_identifier = 2; |
| // Whether the user action should be enabled or disabled. Should be a single |
| // boolean. |
| optional ValueReferenceProto enabled = 4; |
| |
| reserved 3; |
| } |
| |
| // Ends the generic Ui action (this is usually tied to a chip). |
| // |
| // This behaves exactly the same as tapping a regular chip would in any other |
| // action, i.e., the result of the action (|status| + model) is written to the |
| // action response, which will be sent to the backend. |
| message EndActionProto { |
| // The status to report to the backend. |
| optional ProcessedActionStatusProto status = 1; |
| } |
| |
| // Displays a calendar popup that lets the user select a date. |
| message ShowCalendarPopupProto { |
| // The date model identifier (both input and output). Must point to a single |
| // Date. If not set, the calendar will default to the current date. |
| optional string date_model_identifier = 1; |
| // The minimum allowed date. Must point to a single Date. |
| optional ValueReferenceProto min_date = 4; |
| // The maximum allowed date. Must point to a single Date. |
| optional ValueReferenceProto max_date = 5; |
| |
| reserved 2, 3; |
| } |
| |
| // Modifies the displayed text of a text view or a text input view. |
| message SetTextProto { |
| // The text to set. Must be a single string. |
| optional ValueReferenceProto text = 3; |
| // The text view to modify. Must point to a text view or a text input |
| // view. |
| optional string view_identifier = 2; |
| |
| reserved 1; |
| } |
| |
| // Modifies a view's visibiliy. |
| message SetViewVisibilityProto { |
| // The view to modify. |
| optional string view_identifier = 1; |
| |
| // The visibility flag. Must be a single boolean. |
| optional ValueReferenceProto visible = 3; |
| |
| reserved 2; |
| } |
| |
| // Shows a popup with generic UI. |
| message ShowGenericUiPopupProto { |
| // The user interface to show. Note that nested user models are merged into |
| // the global one, so take care to avoid accidental identifier overlap. |
| optional GenericUserInterfaceProto generic_ui = 1; |
| // Mandatory identifier for this popup, used in the corresponding trigger |
| // events. |
| optional string popup_identifier = 2; |
| } |
| |
| // Enables or disables a view. Note that disabled views won't react to click |
| // events. |
| message SetViewEnabledProto { |
| // The view to modify. |
| optional string view_identifier = 1; |
| |
| // Whether the view should be enabled or not. Must point to a single boolean. |
| optional ValueReferenceProto enabled = 2; |
| } |