| 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. This is a tree | 6 // automation (accessibility) tree for the browser. This is a tree |
| 7 // representation, analogous to the DOM tree, which represents the | 7 // representation, analogous to the DOM tree, which represents the |
| 8 // <em>semantic</em> structure of a page, and can be used to programmatically | 8 // <em>semantic</em> structure of a page, and can be used to programmatically |
| 9 // interact with a page. | 9 // interact with a page. |
| 10 [nocompile] namespace automation { | 10 [nocompile] namespace automation { |
| 11 // TODO(dtseng/aboxhall): Make this take an |automation.Event| param. |
| 12 // A listener for events on an <code>AutomationNode</code>. |
| 13 callback AutomationListener = void(); |
| 14 |
| 11 // A single node in an <code>AutomationTree</code>. | 15 // A single node in an <code>AutomationTree</code>. |
| 12 [nocompile] dictionary AutomationNode { | 16 [nocompile] dictionary AutomationNode { |
| 13 // Unique ID to identify this node. | 17 // Unique ID to identify this node. |
| 14 long id; | 18 long id; |
| 15 | 19 |
| 16 // The role of this node, e.g. button, static text etc. | 20 // The role of this node, e.g. button, static text etc. |
| 17 DOMString role; | 21 DOMString role; |
| 18 | 22 |
| 19 // The state of this node, e.g. {pressed": true, "inactive": true} etc. | 23 // The state of this node, e.g. {pressed": true, "inactive": true} etc. |
| 20 object state; | 24 object state; |
| 21 | 25 |
| 22 // TODO(aboxhall): Rect location; | 26 // TODO(aboxhall): Rect location; |
| 23 | 27 |
| 24 // A collection of this node's other attributes. | 28 // A collection of this node's other attributes. |
| 25 // TODO(aboxhall): Create and use combined list of attributes from | 29 // TODO(aboxhall): Create and use combined list of attributes from |
| 26 // AXStringAttribute, AXIntAttribute etc. | 30 // AXStringAttribute, AXIntAttribute etc. |
| 27 object? attributes; | 31 object? attributes; |
| 28 | 32 |
| 29 // The index of this node in its parent node's list of children. If this is | 33 // The index of this node in its parent node's list of children. If this is |
| 30 // the root node, this will be undefined. | 34 // the root node, this will be undefined. |
| 31 long? index_in_parent; | 35 long? indexInParent; |
| 32 | 36 |
| 37 // Traversal. |
| 33 static object[] children(); | 38 static object[] children(); |
| 34 static object parent(); | 39 static object parent(); |
| 35 static object firstChild(); | 40 static object firstChild(); |
| 36 static object lastChild(); | 41 static object lastChild(); |
| 37 static object previousSibling(); | 42 static object previousSibling(); |
| 38 static object nextSibling(); | 43 static object nextSibling(); |
| 44 |
| 45 // Actions. |
| 46 static void doDefault(); |
| 47 static void focus(); |
| 48 static void makeVisible(); |
| 49 static void setSelection(long startIndex, long endIndex); |
| 50 |
| 51 // Events. |
| 52 static void addEventListener(DOMString eventType, |
| 53 AutomationListener listener, |
| 54 bool capture); |
| 55 static void removeEventListener(AutomationListener listener); |
| 39 }; | 56 }; |
| 40 | 57 |
| 41 // The automation tree for a single page. | 58 // The automation tree for a single page. |
| 42 [nocompile] dictionary AutomationTree { | 59 [nocompile] dictionary AutomationTree { |
| 43 AutomationNode root; | 60 AutomationNode root; |
| 44 }; | 61 }; |
| 45 | 62 |
| 46 // Called when the <code>AutomationTree</code> for the page is available. | 63 // Called when the <code>AutomationTree</code> for the page is available. |
| 47 callback RootCallback = void(AutomationTree tree); | 64 callback RootCallback = void(AutomationTree tree); |
| 48 | 65 |
| 49 interface Functions { | 66 interface Functions { |
| 50 // Get the automation tree for the current tab, enabling automation if | 67 // Get the automation tree for the current tab, enabling automation if |
| 51 // necessary. | 68 // necessary. |
| 52 [nocompile] static void getTree(RootCallback callback); | 69 [nocompile] static void getTree(RootCallback callback); |
| 53 }; | 70 }; |
| 54 }; | 71 }; |
| OLD | NEW |