| 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 // given search parameters. | 598 // given search parameters. |
| 599 static AutomationNode[] findAll(FindParams params); | 599 static AutomationNode[] findAll(FindParams params); |
| 600 | 600 |
| 601 // Returns whether this node matches the given $(ref:automation.FindParams). | 601 // Returns whether this node matches the given $(ref:automation.FindParams). |
| 602 static boolean matches(FindParams params); | 602 static boolean matches(FindParams params); |
| 603 }; | 603 }; |
| 604 | 604 |
| 605 // Called when the <code>AutomationNode</code> for the page is available. | 605 // Called when the <code>AutomationNode</code> for the page is available. |
| 606 callback RootCallback = void(AutomationNode rootNode); | 606 callback RootCallback = void(AutomationNode rootNode); |
| 607 | 607 |
| 608 // Called with the <code>AutomationNode</code> that currently has focus. |
| 609 callback FocusCallback = void(AutomationNode focusedNode); |
| 610 |
| 608 interface Functions { | 611 interface Functions { |
| 609 // Get the automation tree for the tab with the given tabId, or the current | 612 // Get the automation tree for the tab with the given tabId, or the current |
| 610 // tab if no tabID is given, enabling automation if necessary. Returns a | 613 // tab if no tabID is given, enabling automation if necessary. Returns a |
| 611 // tree with a placeholder root node; listen for the "loadComplete" event to | 614 // tree with a placeholder root node; listen for the "loadComplete" event to |
| 612 // get a notification that the tree has fully loaded (the previous root node | 615 // get a notification that the tree has fully loaded (the previous root node |
| 613 // reference will stop working at or before this point). | 616 // reference will stop working at or before this point). |
| 614 [nocompile] static void getTree(optional long tabId, RootCallback callback); | 617 [nocompile] static void getTree(optional long tabId, RootCallback callback); |
| 615 | 618 |
| 616 // Get the automation tree for the whole desktop which consists of all on | 619 // Get the automation tree for the whole desktop which consists of all on |
| 617 // screen views. Note this API is currently only supported on Chrome OS. | 620 // screen views. Note this API is currently only supported on Chrome OS. |
| 618 [nocompile] static void getDesktop(RootCallback callback); | 621 [nocompile] static void getDesktop(RootCallback callback); |
| 619 | 622 |
| 623 // Get the automation node that currently has focus, globally. Will return |
| 624 // null if none of the nodes in any loaded trees have focus. |
| 625 [nocompile] static void getFocus(FocusCallback callback); |
| 626 |
| 620 // Add a tree change observer. Tree change observers are static/global, they | 627 // Add a tree change observer. Tree change observers are static/global, they |
| 621 // listen to changes across all trees. Pass a filter to determine what | 628 // listen to changes across all trees. Pass a filter to determine what |
| 622 // specific tree changes to listen to, and note that listnening to all | 629 // specific tree changes to listen to, and note that listnening to all |
| 623 // tree changes can be expensive. | 630 // tree changes can be expensive. |
| 624 [nocompile] static void addTreeChangeObserver( | 631 [nocompile] static void addTreeChangeObserver( |
| 625 TreeChangeObserverFilter filter, TreeChangeObserver observer); | 632 TreeChangeObserverFilter filter, TreeChangeObserver observer); |
| 626 | 633 |
| 627 // Remove a tree change observer. | 634 // Remove a tree change observer. |
| 628 [nocompile] static void removeTreeChangeObserver( | 635 [nocompile] static void removeTreeChangeObserver( |
| 629 TreeChangeObserver observer); | 636 TreeChangeObserver observer); |
| 630 | 637 |
| 631 // Sets the selection in a tree. This creates a selection in a single | 638 // Sets the selection in a tree. This creates a selection in a single |
| 632 // tree (anchorObject and focusObject must have the same root). | 639 // tree (anchorObject and focusObject must have the same root). |
| 633 // Everything in the tree between the two node/offset pairs gets included | 640 // Everything in the tree between the two node/offset pairs gets included |
| 634 // in the selection. The anchor is where the user started the selection, | 641 // in the selection. The anchor is where the user started the selection, |
| 635 // while the focus is the point at which the selection gets extended | 642 // while the focus is the point at which the selection gets extended |
| 636 // e.g. when dragging with a mouse or using the keyboard. For nodes with | 643 // e.g. when dragging with a mouse or using the keyboard. For nodes with |
| 637 // the role staticText, the offset gives the character offset within | 644 // the role staticText, the offset gives the character offset within |
| 638 // the value where the selection starts or ends, respectively. | 645 // the value where the selection starts or ends, respectively. |
| 639 [nocompile] static void setDocumentSelection( | 646 [nocompile] static void setDocumentSelection( |
| 640 SetDocumentSelectionParams params); | 647 SetDocumentSelectionParams params); |
| 641 }; | 648 }; |
| 642 }; | 649 }; |
| OLD | NEW |