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 // Possible tree changes to listen to using addTreeChangeObserver. |
| 321 // Note that listening to all tree changes can be expensive. |
| 322 enum TreeChangeObserverFilter { |
| 323 noTreeChanges, |
| 324 liveRegionTreeChanges, |
| 325 allTreeChanges |
| 326 }; |
| 327 |
320 // A listener for changes on the <code>AutomationNode</code> tree. | 328 // A listener for changes on the <code>AutomationNode</code> tree. |
321 callback TreeChangeObserver = void(TreeChange treeChange); | 329 callback TreeChangeObserver = void(TreeChange treeChange); |
322 | 330 |
323 // A single node in an Automation tree. | 331 // A single node in an Automation tree. |
324 [nocompile, noinline_doc] dictionary AutomationNode { | 332 [nocompile, noinline_doc] dictionary AutomationNode { |
325 // The root node of the tree containing this AutomationNode. | 333 // The root node of the tree containing this AutomationNode. |
326 AutomationNode root; | 334 AutomationNode root; |
327 | 335 |
328 // Whether this AutomationNode is a root node. | 336 // Whether this AutomationNode is a root node. |
329 boolean isRootNode; | 337 boolean isRootNode; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 // tree with a placeholder root node; listen for the "loadComplete" event to | 580 // 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 | 581 // get a notification that the tree has fully loaded (the previous root node |
574 // reference will stop working at or before this point). | 582 // reference will stop working at or before this point). |
575 [nocompile] static void getTree(optional long tabId, RootCallback callback); | 583 [nocompile] static void getTree(optional long tabId, RootCallback callback); |
576 | 584 |
577 // Get the automation tree for the whole desktop which consists of all on | 585 // 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. | 586 // screen views. Note this API is currently only supported on Chrome OS. |
579 [nocompile] static void getDesktop(RootCallback callback); | 587 [nocompile] static void getDesktop(RootCallback callback); |
580 | 588 |
581 // Add a tree change observer. Tree change observers are static/global, they | 589 // Add a tree change observer. Tree change observers are static/global, they |
582 // listen to changes across all trees. | 590 // listen to changes across all trees. Pass a filter to determine what |
| 591 // specific tree changes to listen to, and note that listnening to all |
| 592 // tree changes can be expensive. |
583 [nocompile] static void addTreeChangeObserver( | 593 [nocompile] static void addTreeChangeObserver( |
584 TreeChangeObserver observer); | 594 TreeChangeObserverFilter filter, TreeChangeObserver observer); |
585 | 595 |
586 // Remove a tree change observer. | 596 // Remove a tree change observer. |
587 [nocompile] static void removeTreeChangeObserver( | 597 [nocompile] static void removeTreeChangeObserver( |
588 TreeChangeObserver observer); | 598 TreeChangeObserver observer); |
589 | 599 |
590 // Sets the selection in a tree. This creates a selection in a single | 600 // Sets the selection in a tree. This creates a selection in a single |
591 // tree (anchorObject and focusObject must have the same root). | 601 // tree (anchorObject and focusObject must have the same root). |
592 // Everything in the tree between the two node/offset pairs gets included | 602 // 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, | 603 // 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 | 604 // 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 | 605 // 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 | 606 // the role staticText, the offset gives the character offset within |
597 // the value where the selection starts or ends, respectively. | 607 // the value where the selection starts or ends, respectively. |
598 [nocompile] static void setDocumentSelection( | 608 [nocompile] static void setDocumentSelection( |
599 SetDocumentSelectionParams params); | 609 SetDocumentSelectionParams params); |
600 }; | 610 }; |
601 }; | 611 }; |
OLD | NEW |