blob: 35aa1a8cbc73a22ffedf131e3b00c0ce866b32ef [file] [log] [blame]
// Copyright 2020 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 "action_value.proto";
// Identifier for elements on the client. This is used to store and retrieve
// elements. To store an element and create a usable |ClientIdProto| use a
// |WaitForDomProto| with a |ClientIdProto| annotated |ElementConditionProto|.
message ClientIdProto {
optional string identifier = 1;
}
// Scroll the element into the view center.
message ScrollIntoViewProto {
optional ClientIdProto client_id = 1;
// Defines the transition animation. One of "auto" or "smooth". Defaults to
// "auto".
optional string animation = 2;
// Defines vertical alignment. One of "start", "center", "end" or "nearest".
// Defaults to "center".
optional string vertical_alignment = 3;
// Defines horizontal alignment. One of "start", "center", "end" or "nearest".
// Defaults to "center".
optional string horizontal_alignment = 4;
}
// Scroll the element into view only if necessary. Do not do anything otherwise.
message ScrollIntoViewIfNeededProto {
optional ClientIdProto client_id = 1;
// Defines whether to center or scroll to the nearest edge. Defaults to true.
optional bool center = 2;
}
message ScrollDistance {
oneof value {
// Padding in CSS pixels.
int32 pixels = 1;
// Ratio in relation to the window in direction of the scrolling. E.g.
// |window.innerHeight|.
float window_ratio = 2;
}
}
message ScrollWindowProto {
// Optional frame. If not specified, will scroll the main window.
optional ClientIdProto optional_frame_id = 1;
optional ScrollDistance scroll_distance = 2;
// Defines the transition animation. One of "auto" or "smooth". Defaults to
// "auto".
optional string animation = 3;
}
message ScrollContainerProto {
optional ClientIdProto client_id = 1;
optional ScrollDistance scroll_distance = 2;
// Defines the transition animation. One of "auto" or "smooth". Defaults to
// "auto".
optional string animation = 3;
}
// Wait for the document ready status to be at least "interactive".
message WaitForDocumentToBecomeInteractiveProto {
// Optional frame. If not specified, will wait for the state of the main
// frame.
optional ClientIdProto client_id = 1;
optional int32 timeout_in_ms = 2;
}
// Wait for the document ready status to be "complete".
message WaitForDocumentToBecomeCompleteProto {
// Optional frame. If not specified, will wait for the state of the main
// frame.
optional ClientIdProto client_id = 1;
optional int32 timeout_in_ms = 2;
}
// Wait until an element has become stable, i.e. didn't move for the last few
// rounds.
message WaitForElementToBecomeStableProto {
optional ClientIdProto client_id = 1;
optional int32 stable_check_max_rounds = 2 [default = 50];
optional int32 stable_check_interval_ms = 3 [default = 200];
}
// Check that the element is on top and not currently covered by any other
// element.
message CheckElementIsOnTopProto {
optional ClientIdProto client_id = 1;
}
// Send a mousedown followed by a mouseup event on the element.
message SendClickEventProto {
optional ClientIdProto client_id = 1;
}
// Send a touchdown followed by a touchup event on the element.
message SendTapEventProto {
optional ClientIdProto client_id = 1;
}
// Use JavaScript to click an element.
message JsClickProto {
optional ClientIdProto client_id = 1;
}
// Send a keydown followed by a keyup event per character to the element. This
// requires the element to have focus to receive them. Some characters (like
// new line) are treated as special keys.
message SendKeystrokeEventsProto {
optional ClientIdProto client_id = 1;
optional TextValue value = 2;
optional int32 delay_in_ms = 3;
message Result {
// The number of months since the password used to fill an
// input was last used.
// If the input is not of password type or an error happens,
// this field will be empty.
optional int32 months_since_password_last_used = 1;
}
}
// Send a single key event to the element. This requires the element to have
// focus to receive it.
message SendKeyEventProto {
optional ClientIdProto client_id = 1;
optional KeyEvent key_event = 2;
}
// Send a change event on the element.
message SendChangeEventProto {
optional ClientIdProto client_id = 1;
}
// Set a potentially nested attribute of an element. Depending on the attribute
// (e.g. "value", "checked" or similar) it may be necessary to additionally
// send an additional change using |SendChangeEventProto|.
message SetElementAttributeProto {
optional ClientIdProto client_id = 1;
repeated string attribute = 2;
optional TextValue value = 3;
}
// Select the text value of a field. This requires to be used on an |input| or
// |textarea|.
message SelectFieldValueProto {
optional ClientIdProto client_id = 1;
}
// Focus a field.
message FocusFieldProto {
optional ClientIdProto client_id = 1;
}
// Blur a field that might have focus to remove its focus.
message BlurFieldProto {
optional ClientIdProto client_id = 1;
}
// Select the |option| of a |select| element. This only sets the option in JS,
// it does not fire a "change" event. If a "change" event is required, use in
// combination with |SendChangeEventProto|. If the element in |option| is
// not an option of the element in |select|, an |OPTION_VALUE_NOT_FOUND| error
// is returned. If the element in |select| is not an HTML <select> element, an
// |INVALID_TARGET| error is returned.
message SelectOptionElementProto {
optional ClientIdProto select_id = 1;
optional ClientIdProto option_id = 2;
}
// Checks if any of the tags matches the element tag of the element in
// |client_id|. Returns |ACTION_APPLIED| if there is a match and
// |ELEMENT_MISMATCH| otherwise.
message CheckElementTagProto {
optional ClientIdProto client_id = 1;
repeated string any_of_tag = 2;
}
// Check whether the element in |option_id| is selected in the element in
// |select_id|.
message CheckOptionElementProto {
optional ClientIdProto select_id = 1;
optional ClientIdProto option_id = 2;
// If set and a mismatch happens, the action will report a failure status
// with |ELEMENT_MISMATCH|. If this flag is set to false, the action will not
// fail and simply report the result.
optional bool mismatch_should_fail = 3;
message Result { optional bool match = 1; }
}