Chromium Code Reviews| 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 { | |
|
David Tseng
2015/11/24 18:46:30
This isn't really a mask since I don't think they'
dmazzoni
2015/11/30 22:00:46
Changed to Filter.
| |
| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 564 // tab if no tabID is given, enabling automation if necessary. Returns a | 570 // tab if no tabID is given, enabling automation if necessary. Returns a |
| 565 // tree with a placeholder root node; listen for the "loadComplete" event to | 571 // tree with a placeholder root node; listen for the "loadComplete" event to |
| 566 // get a notification that the tree has fully loaded (the previous root node | 572 // get a notification that the tree has fully loaded (the previous root node |
| 567 // reference will stop working at or before this point). | 573 // reference will stop working at or before this point). |
| 568 [nocompile] static void getTree(optional long tabId, RootCallback callback); | 574 [nocompile] static void getTree(optional long tabId, RootCallback callback); |
| 569 | 575 |
| 570 // Get the automation tree for the whole desktop which consists of all on | 576 // Get the automation tree for the whole desktop which consists of all on |
| 571 // screen views. Note this API is currently only supported on Chrome OS. | 577 // screen views. Note this API is currently only supported on Chrome OS. |
| 572 [nocompile] static void getDesktop(RootCallback callback); | 578 [nocompile] static void getDesktop(RootCallback callback); |
| 573 | 579 |
| 580 // Set the type of tree change events you want to receive when | |
| 581 // calling addTreeChangeObserver. | |
| 582 [nocompile] static void setTreeChangeObserverMask( | |
|
Peter Lundblad
2015/11/20 13:42:59
I assume this mask is per extension. IN any case,
dmazzoni
2015/11/23 20:16:50
That would be ideal, but it would significantly co
David Tseng
2015/11/24 18:46:30
I think, this looks a little like re-inventing the
dmazzoni
2015/11/26 00:08:04
The exception here is the onRemoved callback. Righ
| |
| 583 TreeChangeObserverMask mask); | |
| 584 | |
| 574 // Add a tree change observer. Tree change observers are static/global, they | 585 // Add a tree change observer. Tree change observers are static/global, they |
| 575 // listen to changes across all trees. | 586 // listen to changes across all trees. Note that you must also call |
| 587 // setTreeChangeObserverMask for this to do anything. | |
| 576 [nocompile] static void addTreeChangeObserver( | 588 [nocompile] static void addTreeChangeObserver( |
| 577 TreeChangeObserver observer); | 589 TreeChangeObserver observer); |
| 578 | 590 |
| 579 // Remove a tree change observer. | 591 // Remove a tree change observer. |
| 580 [nocompile] static void removeTreeChangeObserver( | 592 [nocompile] static void removeTreeChangeObserver( |
| 581 TreeChangeObserver observer); | 593 TreeChangeObserver observer); |
| 582 | 594 |
| 583 // Sets the selection in a tree. This creates a selection in a single | 595 // Sets the selection in a tree. This creates a selection in a single |
| 584 // tree (anchorObject and focusObject must have the same root). | 596 // tree (anchorObject and focusObject must have the same root). |
| 585 // Everything in the tree between the two node/offset pairs gets included | 597 // Everything in the tree between the two node/offset pairs gets included |
| 586 // in the selection. The anchor is where the user started the selection, | 598 // in the selection. The anchor is where the user started the selection, |
| 587 // while the focus is the point at which the selection gets extended | 599 // while the focus is the point at which the selection gets extended |
| 588 // e.g. when dragging with a mouse or using the keyboard. For nodes with | 600 // e.g. when dragging with a mouse or using the keyboard. For nodes with |
| 589 // the role staticText, the offset gives the character offset within | 601 // the role staticText, the offset gives the character offset within |
| 590 // the value where the selection starts or ends, respectively. | 602 // the value where the selection starts or ends, respectively. |
| 591 [nocompile] static void setDocumentSelection( | 603 [nocompile] static void setDocumentSelection( |
| 592 SetDocumentSelectionParams params); | 604 SetDocumentSelectionParams params); |
| 593 }; | 605 }; |
| 594 }; | 606 }; |
| OLD | NEW |