Forward accessibility events to the automation extension process.
[chromium-blink-merge.git] / chrome / common / extensions / api / automation_internal.idl
blobb290c638c3153c1a935330b3f33e15df5705cea2
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This is the implementation layer of the chrome.automation API, and is
6 // essentially a translation of the internal accessibility tree update system
7 // into an extension API.
8 namespace automationInternal {
9 dictionary Rect {
10 long left;
11 long top;
12 long width;
13 long height;
16 // A compact representation of the accessibility information for a
17 // single web object, in a form that can be serialized and sent from
18 // one process to another.
19 // See ui/accessibility/ax_node_data.h
20 dictionary AXNodeData {
21 long id;
22 DOMString role;
23 object state;
24 Rect location;
26 object? boolAttributes;
27 object? floatAttributes;
28 object? htmlAttributes;
29 object? intAttributes;
30 object? intlistAttributes;
31 object? stringAttributes;
32 long[] childIds;
35 dictionary AXTreeUpdate {
36 // ID of the node, if any, which should be invalidated before the new data
37 // is applied.
38 long nodeIdToClear;
40 // A vector of nodes to update according to the rules described in
41 // ui/accessibility/ax_tree_update.h.
42 AXNodeData[] nodes;
45 // Data for an accessibility event and/or an atomic change to an accessibility
46 // tree. See ui/accessibility/ax_tree_update.h for an extended explanation of
47 // the tree update format.
48 dictionary AXEventParams {
49 // The tree id of the web contents that this update is for.
50 long treeID;
52 // ID of the node that the event applies to.
53 long targetID;
55 // The type of event that this update represents.
56 DOMString eventType;
58 // Serialized changes to the tree structure and node data that should be
59 // applied before processing the event.
60 AXTreeUpdate update;
63 // All possible actions that can be performed on automation nodes.
64 enum ActionType {
65 focus,
66 doDefault,
67 makeVisible,
68 setSelection,
69 showContextMenu
72 // Arguments required for all actions supplied to performAction.
73 dictionary PerformActionRequiredParams {
74 long treeID;
75 long automationNodeID;
76 ActionType actionType;
79 // Arguments for the set_selection action supplied to performAction.
80 dictionary SetSelectionParams {
81 long startIndex;
82 long endIndex;
85 // Arguments for the querySelector function.
86 dictionary QuerySelectorRequiredParams {
87 long treeID;
88 long automationNodeID;
89 DOMString selector;
92 // Arguments for the enableTab function.
93 dictionary EnableTabParams {
94 long routingID;
95 long? tabID;
98 // Returns the accessibility tree id of the web contents who's accessibility
99 // was enabled using enableTab().
100 callback EnableTabCallback = void(long tree_id);
102 // Callback called when enableDesktop() returns.
103 callback EnableDesktopCallback = void();
105 // Callback called when querySelector() returns.
106 callback QuerySelectorCallback = void(long resultAutomationNodeID);
108 interface Functions {
109 // Enable automation of the tab with the given id, or the active tab if no
110 // tab id is given, and retrieves accessibility tree id for use in
111 // future updates.
112 static void enableTab(EnableTabParams args,
113 EnableTabCallback callback);
115 // Enable automation of the frame with the given tree id.
116 static void enableFrame(long tree_id);
118 // Enables desktop automation.
119 static void enableDesktop(long routingID,
120 EnableDesktopCallback callback);
122 // Performs an action on an automation node.
123 static void performAction(PerformActionRequiredParams args,
124 object opt_args);
126 // Performs a query selector query.
127 static void querySelector(QuerySelectorRequiredParams args,
128 QuerySelectorCallback callback);
131 interface Events {
132 // Fired when an accessibility event occurs
133 static void onAccessibilityEvent(AXEventParams update);
135 static void onAccessibilityTreeDestroyed(long treeID);