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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 | 310 |
311 // A change to the Automation tree. | 311 // A change to the Automation tree. |
312 [nocompile, noinline_doc] dictionary TreeChange { | 312 [nocompile, noinline_doc] dictionary TreeChange { |
313 // The $(ref:automation.AutomationNode) that changed. | 313 // The $(ref:automation.AutomationNode) that changed. |
314 AutomationNode target; | 314 AutomationNode target; |
315 | 315 |
316 // The type of change. | 316 // The type of change. |
317 TreeChangeType type; | 317 TreeChangeType type; |
318 }; | 318 }; |
319 | 319 |
320 enum TreeChangeObserverMask { | |
321 noTreeChanges, | |
322 liveRegionTreeChanges, | |
323 allTreeChanges | |
324 }; | |
325 | |
320 // A listener for changes on the <code>AutomationNode</code> tree. | 326 // A listener for changes on the <code>AutomationNode</code> tree. |
321 callback TreeChangeObserver = void(TreeChange treeChange); | 327 callback TreeChangeObserver = void(TreeChange treeChange); |
322 | 328 |
323 // A single node in an Automation tree. | 329 // A single node in an Automation tree. |
324 [nocompile, noinline_doc] dictionary AutomationNode { | 330 [nocompile, noinline_doc] dictionary AutomationNode { |
325 // The root node of the tree containing this AutomationNode. | 331 // The root node of the tree containing this AutomationNode. |
326 AutomationNode root; | 332 AutomationNode root; |
327 | 333 |
328 // Whether this AutomationNode is a root node. | 334 // Whether this AutomationNode is a root node. |
329 boolean isRootNode; | 335 boolean isRootNode; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
571 // tab if no tabID is given, enabling automation if necessary. Returns a | 577 // tab if no tabID is given, enabling automation if necessary. Returns a |
572 // tree with a placeholder root node; listen for the "loadComplete" event to | 578 // tree with a placeholder root node; listen for the "loadComplete" event to |
573 // get a notification that the tree has fully loaded (the previous root node | 579 // get a notification that the tree has fully loaded (the previous root node |
574 // reference will stop working at or before this point). | 580 // reference will stop working at or before this point). |
575 [nocompile] static void getTree(optional long tabId, RootCallback callback); | 581 [nocompile] static void getTree(optional long tabId, RootCallback callback); |
576 | 582 |
577 // Get the automation tree for the whole desktop which consists of all on | 583 // Get the automation tree for the whole desktop which consists of all on |
578 // screen views. Note this API is currently only supported on Chrome OS. | 584 // screen views. Note this API is currently only supported on Chrome OS. |
579 [nocompile] static void getDesktop(RootCallback callback); | 585 [nocompile] static void getDesktop(RootCallback callback); |
580 | 586 |
587 // Set the type of tree change events you want to receive when | |
588 // calling addTreeChangeObserver. | |
Peter Lundblad
2015/11/24 11:04:31
If we keep this design, please add a note that the
| |
589 [nocompile] static void setTreeChangeObserverMask( | |
590 TreeChangeObserverMask mask); | |
591 | |
581 // Add a tree change observer. Tree change observers are static/global, they | 592 // Add a tree change observer. Tree change observers are static/global, they |
582 // listen to changes across all trees. | 593 // listen to changes across all trees. Note that you must also call |
594 // setTreeChangeObserverMask for this to do anything. | |
Peter Lundblad
2015/11/24 11:04:31
Replace 'this to do anything' with 'any listeners
| |
583 [nocompile] static void addTreeChangeObserver( | 595 [nocompile] static void addTreeChangeObserver( |
584 TreeChangeObserver observer); | 596 TreeChangeObserver observer); |
585 | 597 |
586 // Remove a tree change observer. | 598 // Remove a tree change observer. |
587 [nocompile] static void removeTreeChangeObserver( | 599 [nocompile] static void removeTreeChangeObserver( |
588 TreeChangeObserver observer); | 600 TreeChangeObserver observer); |
589 | 601 |
590 // Sets the selection in a tree. This creates a selection in a single | 602 // Sets the selection in a tree. This creates a selection in a single |
591 // tree (anchorObject and focusObject must have the same root). | 603 // tree (anchorObject and focusObject must have the same root). |
592 // Everything in the tree between the two node/offset pairs gets included | 604 // Everything in the tree between the two node/offset pairs gets included |
593 // in the selection. The anchor is where the user started the selection, | 605 // in the selection. The anchor is where the user started the selection, |
594 // while the focus is the point at which the selection gets extended | 606 // while the focus is the point at which the selection gets extended |
595 // e.g. when dragging with a mouse or using the keyboard. For nodes with | 607 // e.g. when dragging with a mouse or using the keyboard. For nodes with |
596 // the role staticText, the offset gives the character offset within | 608 // the role staticText, the offset gives the character offset within |
597 // the value where the selection starts or ends, respectively. | 609 // the value where the selection starts or ends, respectively. |
598 [nocompile] static void setDocumentSelection( | 610 [nocompile] static void setDocumentSelection( |
599 SetDocumentSelectionParams params); | 611 SetDocumentSelectionParams params); |
600 }; | 612 }; |
601 }; | 613 }; |
OLD | NEW |