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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 | 278 |
279 // Places focus on this node. | 279 // Places focus on this node. |
280 static void focus(); | 280 static void focus(); |
281 | 281 |
282 // Scrolls this node to make it visible. | 282 // Scrolls this node to make it visible. |
283 static void makeVisible(); | 283 static void makeVisible(); |
284 | 284 |
285 // Sets selection within a text field. | 285 // Sets selection within a text field. |
286 static void setSelection(long startIndex, long endIndex); | 286 static void setSelection(long startIndex, long endIndex); |
287 | 287 |
288 // Whether this AutomationRootNode is loaded or not. If false, call load() | |
289 // to get the contents. Only applicable on webArea nodes. | |
290 boolean loaded; | |
dmazzoni
2014/10/29 06:53:30
Should this be boolean? so that it can be undefine
| |
291 | |
292 // Load the accessibility tree for this AutomationRootNode. Only | |
293 // applicable on webArea nodes. | |
294 static void load(RootCallback callback); | |
dmazzoni
2014/10/29 06:53:30
can a method be optional?
| |
295 | |
288 // Adds a listener for the given event type and event phase. | 296 // Adds a listener for the given event type and event phase. |
289 static void addEventListener( | 297 static void addEventListener( |
290 EventType eventType, AutomationListener listener, boolean capture); | 298 EventType eventType, AutomationListener listener, boolean capture); |
291 | 299 |
292 // Removes a listener for the given event type and event phase. | 300 // Removes a listener for the given event type and event phase. |
293 static void removeEventListener( | 301 static void removeEventListener( |
294 EventType eventType, AutomationListener listener, boolean capture); | 302 EventType eventType, AutomationListener listener, boolean capture); |
295 }; | 303 }; |
296 | 304 |
297 // Called when the <code>AutomationRootNode</code> for the page is available. | 305 // Called when the <code>AutomationRootNode</code> for the page is available. |
298 callback RootCallback = void(AutomationRootNode rootNode); | 306 callback RootCallback = void(AutomationRootNode rootNode); |
299 | 307 |
300 // The root node of the automation tree for a single frame or desktop. | 308 // The root node of the automation tree for a single frame or desktop. |
301 // This may be: | 309 // This may be: |
302 // <ul> | 310 // <ul> |
303 // <li> The desktop | 311 // <li> The desktop |
304 // <li> The top frame of a page | 312 // <li> The top frame of a page |
305 // <li> A frame or iframe within a page | 313 // <li> A frame or iframe within a page |
306 // </ul> | 314 // </ul> |
307 // Thus, an <code>AutomationRootNode</code> may be a descendant of one or | 315 // 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 | 316 // more <code>AutomationRootNode</code>s, and in turn have one or more |
309 // <code>AutomationRootNode</code>s in its descendants. Thus, the | 317 // <code>AutomationRootNode</code>s in its descendants. Thus, the |
310 // <code>root</code> property of the <code>AutomationRootNode</code> will be | 318 // <code>root</code> property of the <code>AutomationRootNode</code> will be |
311 // the immediate parent <code>AutomationRootNode</code>, or <code>null</code> | 319 // the immediate parent <code>AutomationRootNode</code>, or <code>null</code> |
312 // if this is the top-level <code>AutomationRootNode</code>. | 320 // if this is the top-level <code>AutomationRootNode</code>. |
313 // | 321 // |
314 // Extends $(ref:automation.AutomationNode). | 322 // Extends $(ref:automation.AutomationNode). |
315 [nocompile, noinline_doc] dictionary AutomationRootNode { | 323 [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 }; | 324 }; |
326 | 325 |
327 interface Functions { | 326 interface Functions { |
328 // Get the automation tree for the tab with the given tabId, or the current | 327 // 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 | 328 // 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 | 329 // 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 | 330 // get a notification that the tree has fully loaded (the previous root node |
332 // reference will stop working at or before this point). | 331 // reference will stop working at or before this point). |
333 [nocompile] static void getTree(optional long tabId, RootCallback callback); | 332 [nocompile] static void getTree(optional long tabId, RootCallback callback); |
334 | 333 |
335 // Get the automation tree for the whole desktop which consists of all on | 334 // 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. | 335 // screen views. Note this API is currently only supported on Chrome OS. |
337 [nocompile] static void getDesktop(RootCallback callback); | 336 [nocompile] static void getDesktop(RootCallback callback); |
338 }; | 337 }; |
339 }; | 338 }; |
OLD | NEW |