summaryrefslogtreecommitdiff
path: root/chromium/components/autofill_assistant/browser/interactions.proto
blob: 5117cde6eb37b5a2df63a5ff21807ef1b885fae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
// 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 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;
  }
  // 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;
  }
}

// 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;
}

// 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;
}