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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 visited | 213 visited |
214 }; | 214 }; |
215 | 215 |
216 dictionary Rect { | 216 dictionary Rect { |
217 long left; | 217 long left; |
218 long top; | 218 long top; |
219 long width; | 219 long width; |
220 long height; | 220 long height; |
221 }; | 221 }; |
222 | 222 |
| 223 // Called when the result for a <code>query</code> is available. |
| 224 callback QueryCallback = void(AutomationNode node); |
| 225 |
223 // An event in the Automation tree. | 226 // An event in the Automation tree. |
224 [nocompile, noinline_doc] dictionary AutomationEvent { | 227 [nocompile, noinline_doc] dictionary AutomationEvent { |
225 // The $(ref:automation.AutomationNode) to which the event was targeted. | 228 // The $(ref:automation.AutomationNode) to which the event was targeted. |
226 AutomationNode target; | 229 AutomationNode target; |
227 | 230 |
228 // The type of the event. | 231 // The type of the event. |
229 EventType type; | 232 EventType type; |
230 | 233 |
231 // Stops this event from further processing except for any remaining | 234 // Stops this event from further processing except for any remaining |
232 // listeners on $(ref:AutomationEvent.target). | 235 // listeners on $(ref:AutomationEvent.target). |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // Sets selection within a text field. | 285 // Sets selection within a text field. |
283 static void setSelection(long startIndex, long endIndex); | 286 static void setSelection(long startIndex, long endIndex); |
284 | 287 |
285 // Adds a listener for the given event type and event phase. | 288 // Adds a listener for the given event type and event phase. |
286 static void addEventListener( | 289 static void addEventListener( |
287 EventType eventType, AutomationListener listener, boolean capture); | 290 EventType eventType, AutomationListener listener, boolean capture); |
288 | 291 |
289 // Removes a listener for the given event type and event phase. | 292 // Removes a listener for the given event type and event phase. |
290 static void removeEventListener( | 293 static void removeEventListener( |
291 EventType eventType, AutomationListener listener, boolean capture); | 294 EventType eventType, AutomationListener listener, boolean capture); |
| 295 |
| 296 // Gets the first node in this node's subtree which matches the given CSS |
| 297 // selector and is within the same DOM context. |
| 298 // |
| 299 // If this node doesn't correspond directly with an HTML node in the DOM, |
| 300 // querySelector will be run on this node's nearest HTML node ancestor. Note |
| 301 // that this may result in the query returning a node which is not a |
| 302 // descendant of this node. |
| 303 // |
| 304 // If the selector matches a node which doesn't directly correspond to an |
| 305 // automation node (for example an element within an ARIA widget, where the |
| 306 // ARIA widget forms one node of the automation tree, or an element which |
| 307 // is hidden from accessibility via hiding it using CSS or using |
| 308 // aria-hidden), this will return the nearest ancestor which does correspond |
| 309 // to an automation node. |
| 310 static void querySelector(DOMString selector, QueryCallback callback); |
292 }; | 311 }; |
293 | 312 |
294 // Called when the <code>AutomationNode</code> for the page is available. | 313 // Called when the <code>AutomationNode</code> for the page is available. |
295 callback RootCallback = void(AutomationNode rootNode); | 314 callback RootCallback = void(AutomationNode rootNode); |
296 | 315 |
297 interface Functions { | 316 interface Functions { |
298 // Get the automation tree for the tab with the given tabId, or the current | 317 // Get the automation tree for the tab with the given tabId, or the current |
299 // tab if no tabID is given, enabling automation if necessary. Returns a | 318 // tab if no tabID is given, enabling automation if necessary. Returns a |
300 // tree with a placeholder root node; listen for the "loadComplete" event to | 319 // tree with a placeholder root node; listen for the "loadComplete" event to |
301 // get a notification that the tree has fully loaded (the previous root node | 320 // get a notification that the tree has fully loaded (the previous root node |
302 // reference will stop working at or before this point). | 321 // reference will stop working at or before this point). |
303 [nocompile] static void getTree(optional long tabId, RootCallback callback); | 322 [nocompile] static void getTree(optional long tabId, RootCallback callback); |
304 | 323 |
305 // Get the automation tree for the whole desktop which consists of all on | 324 // Get the automation tree for the whole desktop which consists of all on |
306 // screen views. Note this API is currently only supported on Chrome OS. | 325 // screen views. Note this API is currently only supported on Chrome OS. |
307 [nocompile] static void getDesktop(RootCallback callback); | 326 [nocompile] static void getDesktop(RootCallback callback); |
308 }; | 327 }; |
309 }; | 328 }; |
OLD | NEW |