OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The <code>chrome.automation</code> API allows developers to access the | 5 // The <code>chrome.automation</code> API allows developers to access the |
6 // automation (accessibility) tree for the browser. The tree resembles the DOM | 6 // automation (accessibility) tree for the browser. The tree resembles the DOM |
7 // tree, but only exposes the <em>semantic</em> structure of a page. It can be | 7 // tree, but only exposes the <em>semantic</em> structure of a page. It can be |
8 // used to programmatically interact with a page by examining names, roles, and | 8 // used to programmatically interact with a page by examining names, roles, and |
9 // states, listening for events, and performing actions on nodes. | 9 // states, listening for events, and performing actions on nodes. |
10 [nocompile] namespace automation { | 10 [nocompile] namespace automation { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 titleBar, | 174 titleBar, |
175 toggleButton, | 175 toggleButton, |
176 toolbar, | 176 toolbar, |
177 treeGrid, | 177 treeGrid, |
178 treeItem, | 178 treeItem, |
179 tree, | 179 tree, |
180 unknown, | 180 unknown, |
181 tooltip, | 181 tooltip, |
182 valueIndicator, | 182 valueIndicator, |
183 webArea, | 183 webArea, |
| 184 webView, |
184 window | 185 window |
185 }; | 186 }; |
186 | 187 |
187 // Describes characteristics of an $(ref:automation.AutomationNode). | 188 // Describes characteristics of an $(ref:automation.AutomationNode). |
188 enum StateType { | 189 enum StateType { |
189 busy, | 190 busy, |
190 checked, | 191 checked, |
191 collapsed, | 192 collapsed, |
192 default, | 193 default, |
193 disabled, // ui/views only | 194 disabled, // ui/views only |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // listeners on $(ref:AutomationEvent.target). | 233 // listeners on $(ref:AutomationEvent.target). |
233 static void stopPropagation(); | 234 static void stopPropagation(); |
234 }; | 235 }; |
235 | 236 |
236 // A listener for events on an <code>AutomationNode</code>. | 237 // A listener for events on an <code>AutomationNode</code>. |
237 callback AutomationListener = void(AutomationEvent event); | 238 callback AutomationListener = void(AutomationEvent event); |
238 | 239 |
239 // A single node in an Automation tree. | 240 // A single node in an Automation tree. |
240 [nocompile, noinline_doc] dictionary AutomationNode { | 241 [nocompile, noinline_doc] dictionary AutomationNode { |
241 // The root node of the tree containing this AutomationNode. | 242 // The root node of the tree containing this AutomationNode. |
242 AutomationRootNode root; | 243 AutomationNode root; |
243 | 244 |
244 // Whether this AutomationNode is an AutomationRootNode. | 245 // Whether this AutomationNode is root node. |
245 boolean isRootNode; | 246 boolean isRootNode; |
246 | 247 |
247 // Unique ID to identify this node. | |
248 long id; | |
249 | |
250 // The role of this node. | 248 // The role of this node. |
251 automation.RoleType role; | 249 automation.RoleType role; |
252 | 250 |
253 // The $(ref:automation.StateType)s describing this node. | 251 // The $(ref:automation.StateType)s describing this node. |
254 object state; | 252 object state; |
255 | 253 |
256 // The rendered location (as a bounding box) of this node within the frame. | 254 // The rendered location (as a bounding box) of this node within the frame. |
257 automation.Rect location; | 255 automation.Rect location; |
258 | 256 |
259 // A collection of this node's other attributes. | 257 // A collection of this node's other attributes. |
(...skipping 27 matching lines...) Expand all Loading... |
287 | 285 |
288 // Adds a listener for the given event type and event phase. | 286 // Adds a listener for the given event type and event phase. |
289 static void addEventListener( | 287 static void addEventListener( |
290 EventType eventType, AutomationListener listener, boolean capture); | 288 EventType eventType, AutomationListener listener, boolean capture); |
291 | 289 |
292 // Removes a listener for the given event type and event phase. | 290 // Removes a listener for the given event type and event phase. |
293 static void removeEventListener( | 291 static void removeEventListener( |
294 EventType eventType, AutomationListener listener, boolean capture); | 292 EventType eventType, AutomationListener listener, boolean capture); |
295 }; | 293 }; |
296 | 294 |
297 // Called when the <code>AutomationRootNode</code> for the page is available. | 295 // Called when the <code>AutomationNode</code> for the page is available. |
298 callback RootCallback = void(AutomationRootNode rootNode); | 296 callback RootCallback = void(AutomationNode rootNode); |
299 | |
300 // The root node of the automation tree for a single frame or desktop. | |
301 // This may be: | |
302 // <ul> | |
303 // <li> The desktop | |
304 // <li> The top frame of a page | |
305 // <li> A frame or iframe within a page | |
306 // </ul> | |
307 // Thus, an <code>AutomationRootNode</code> may be a descendant of one or | |
308 // more <code>AutomationRootNode</code>s, and in turn have one or more | |
309 // <code>AutomationRootNode</code>s in its descendants. Thus, the | |
310 // <code>root</code> property of the <code>AutomationRootNode</code> will be | |
311 // the immediate parent <code>AutomationRootNode</code>, or <code>null</code> | |
312 // if this is the top-level <code>AutomationRootNode</code>. | |
313 // | |
314 // Extends $(ref:automation.AutomationNode). | |
315 [nocompile, noinline_doc] dictionary AutomationRootNode { | |
316 // TODO(aboxhall/dtseng): implement loading. Kept separate to not include | |
317 // in generated docs. | |
318 | |
319 // Whether this AutomationRootNode is loaded or not. If false, call load() | |
320 // to get the contents. | |
321 boolean loaded; | |
322 | |
323 // Load the accessibility tree for this AutomationRootNode. | |
324 static void load(RootCallback callback); | |
325 }; | |
326 | 297 |
327 interface Functions { | 298 interface Functions { |
328 // Get the automation tree for the tab with the given tabId, or the current | 299 // Get the automation tree for the tab with the given tabId, or the current |
329 // tab if no tabID is given, enabling automation if necessary. Returns a | 300 // tab if no tabID is given, enabling automation if necessary. Returns a |
330 // tree with a placeholder root node; listen for the "loadComplete" event to | 301 // tree with a placeholder root node; listen for the "loadComplete" event to |
331 // get a notification that the tree has fully loaded (the previous root node | 302 // get a notification that the tree has fully loaded (the previous root node |
332 // reference will stop working at or before this point). | 303 // reference will stop working at or before this point). |
333 [nocompile] static void getTree(optional long tabId, RootCallback callback); | 304 [nocompile] static void getTree(optional long tabId, RootCallback callback); |
334 | 305 |
335 // Get the automation tree for the whole desktop which consists of all on | 306 // Get the automation tree for the whole desktop which consists of all on |
336 // screen views. Note this API is currently only supported on Chrome OS. | 307 // screen views. Note this API is currently only supported on Chrome OS. |
337 [nocompile] static void getDesktop(RootCallback callback); | 308 [nocompile] static void getDesktop(RootCallback callback); |
338 }; | 309 }; |
339 }; | 310 }; |
OLD | NEW |