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