summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/automation.idl
blob: f6cfbcee7652d21334e638b30b84178463dfd08d (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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
// Copyright 2014 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.

// The <code>chrome.automation</code> API allows developers to access the
// automation (accessibility) tree for the browser. The tree resembles the DOM
// tree, but only exposes the <em>semantic</em> structure of a page. It can be
// used to programmatically interact with a page by examining names, roles, and
// states, listening for events, and performing actions on nodes.
[nocompile] namespace automation {
  // Keep the following enums in sync with 'ui/accessibility/ax_enums.idl'.
  // They are kept here purely for extension docs generation.

  // Possible events fired on an $(ref:automation.AutomationNode).
  enum EventType {
    activedescendantchanged,
    alert,
    ariaAttributeChanged,
    autocorrectionOccured,
    blur,
    checkedStateChanged,
    childrenChanged,
    focus,
    hide,
    hover,
    invalidStatusChanged,
    layoutComplete,
    liveRegionChanged,
    loadComplete,
    locationChanged,
    menuEnd,
    menuListItemSelected,
    menuListValueChanged,
    menuPopupEnd,
    menuPopupStart,
    menuStart,
    rowCollapsed,
    rowCountChanged,
    rowExpanded,
    scrollPositionChanged,
    scrolledToAnchor,
    selectedChildrenChanged,
    selection,
    selectionAdd,
    selectionRemove,
    show,
    textChanged,
    textSelectionChanged,
    valueChanged
  };

  // Describes the purpose of an $(ref:automation.AutomationNode).
  enum RoleType {
    alertDialog,
    alert,
    annotation,
    application,
    article,
    banner,
    blockquote,
    browser,
    busyIndicator,
    button,
    buttonDropDown,
    canvas,
    cell,
    checkBox,
    client,
    colorWell,
    columnHeader,
    column,
    comboBox,
    complementary,
    contentInfo,
    date,
    dateTime,
    definition,
    descriptionListDetail,
    descriptionList,
    descriptionListTerm,
    desktop,
    details,
    dialog,
    directory,
    disclosureTriangle,
    div,
    document,
    drawer,
    editableText,
    embeddedObject,
    figcaption,
    figure,
    footer,
    form,
    grid,
    group,
    growArea,
    heading,
    helpTag,
    horizontalRule,
    iframe,
    ignored,
    imageMapLink,
    imageMap,
    image,
    incrementor,
    inlineTextBox,
    labelText,
    legend,
    link,
    listBoxOption,
    listBox,
    listItem,
    listMarker,
    list,
    locationBar,
    log,
    main,
    marquee,
    math,
    matte,
    menuBar,
    menuButton,
    menuItem,
    menuItemCheckBox,
    menuItemRadio,
    menuListOption,
    menuListPopup,
    menu,
    meter,
    navigation,
    note,
    outline,
    pane,
    paragraph,
    popUpButton,
    pre,
    presentational,
    progressIndicator,
    radioButton,
    radioGroup,
    region,
    rootWebArea,
    rowHeader,
    row,
    rulerMarker,
    ruler,
    svgRoot,
    scrollArea,
    scrollBar,
    seamlessWebArea,
    search,
    sheet,
    slider,
    sliderThumb,
    spinButtonPart,
    spinButton,
    splitGroup,
    splitter,
    staticText,
    status,
    systemWide,
    tabGroup,
    tabList,
    tabPanel,
    tab,
    tableHeaderContainer,
    table,
    textArea,
    textField,
    time,
    timer,
    titleBar,
    toggleButton,
    toolbar,
    treeGrid,
    treeItem,
    tree,
    unknown,
    tooltip,
    valueIndicator,
    webArea,
    window
  };

  // Describes characteristics of an $(ref:automation.AutomationNode).
  enum StateType {
    busy,
    checked,
    collapsed,
    default,
    disabled,  // ui/views only
    editable,  // ui/views only
    enabled,   // content only
    expanded,
    focusable,
    focused,
    haspopup,
    hovered,
    indeterminate,
    invisible,
    linked,
    multiselectable,
    offscreen,
    pressed,
    protected,
    readOnly,
    required,
    selectable,
    selected,
    vertical,
    visited
  };

  dictionary Rect {
    long left;
    long top;
    long width;
    long height;
  };

  // An event in the Automation tree.
  [nocompile, noinline_doc] dictionary AutomationEvent {
    // The $(ref:automation.AutomationNode) to which the event was targeted.
    AutomationNode target;

    // The type of the event.
    EventType type;

    // Stops this event from further processing except for any remaining
    // listeners on $(ref:AutomationEvent.target).
    static void stopPropagation();
  };

  // A listener for events on an <code>AutomationNode</code>.
  callback AutomationListener = void(AutomationEvent event);

  // A single node in an Automation tree.
  [nocompile, noinline_doc] dictionary AutomationNode {
    // The root node of the tree containing this AutomationNode.
    AutomationRootNode root;

    // Whether this AutomationNode is an AutomationRootNode.
    boolean isRootNode;

    // Unique ID to identify this node.
    long id;

    // The role of this node.
    automation.RoleType role;

    // The $(ref:automation.StateType)s describing this node.
    object state;

    // The rendered location (as a bounding box) of this node within the frame.
    automation.Rect location;

    // A collection of this node's other attributes.
    object? attributes;

    // The index of this node in its parent node's list of children. If this is
    // the root node, this will be undefined.
    long? indexInParent;

    static AutomationNode[] children();
    static AutomationNode parent();
    static AutomationNode firstChild();
    static AutomationNode lastChild();
    static AutomationNode previousSibling();
    static AutomationNode nextSibling();

    // Does the default action based on this node's role. This is generally
    // the same action that would result from clicking the node such as
    // expanding a treeitem, toggling a checkbox, selecting a radiobutton,
    // or activating a button.
    static void doDefault();

    // Places focus on this node.
    static void focus();

    // Scrolls this node to make it visible.
    static void makeVisible();

    // Sets selection within a text field.
    static void setSelection(long startIndex, long endIndex);

    // Adds a listener for the given event type and event phase.
    static void addEventListener(
        EventType eventType, AutomationListener listener, boolean capture);

    // Removes a listener for the given event type and event phase.
    static void removeEventListener(
        EventType eventType, AutomationListener listener, boolean capture);
  };

  // Called when the <code>AutomationRootNode</code> for the page is available.
  callback RootCallback = void(AutomationRootNode rootNode);

  // The root node of the automation tree for a single frame or desktop.
  // This may be:
  // <ul>
  //   <li> The desktop
  //   <li> The top frame of a page
  //   <li> A frame or iframe within a page
  // </ul>
  // Thus, an <code>AutomationRootNode</code> may be a descendant of one or
  // more <code>AutomationRootNode</code>s, and in turn have one or more
  // <code>AutomationRootNode</code>s in its descendants. Thus, the
  // <code>root</code> property of the <code>AutomationRootNode</code> will be
  // the immediate parent <code>AutomationRootNode</code>, or <code>null</code>
  // if this is the top-level <code>AutomationRootNode</code>.
  //
  // Extends $(ref:automation.AutomationNode).
  [nocompile, noinline_doc] dictionary AutomationRootNode {
    // TODO(aboxhall/dtseng): implement loading. Kept separate to not include
    // in generated docs.

    // Whether this AutomationRootNode is loaded or not. If false, call load()
    // to get the contents.
    boolean loaded;

    // Load the accessibility tree for this AutomationRootNode.
    static void load(RootCallback callback);
  };

  interface Functions {
    // Get the automation tree for the tab with the given tabId, or the current
    // tab if no tabID is given, enabling automation if necessary. Returns a
    // tree with a placeholder root node; listen for the "loadComplete" event to
    // get a notification that the tree has fully loaded (the previous root node
    // reference will stop working at or before this point).
    [nocompile] static void getTree(optional long tabId, RootCallback callback);

    // Get the automation tree for the whole desktop which consists of all on
    // screen views. Note this API is currently only supported on Chrome OS.
    [nocompile] static void getDesktop(RootCallback callback);
  };
};