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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 EventType type; | 229 EventType type; |
230 | 230 |
231 // Stops this event from further processing except for any remaining | 231 // Stops this event from further processing except for any remaining |
232 // listeners on $(ref:AutomationEvent.target). | 232 // listeners on $(ref:AutomationEvent.target). |
233 static void stopPropagation(); | 233 static void stopPropagation(); |
234 }; | 234 }; |
235 | 235 |
236 // A listener for events on an <code>AutomationNode</code>. | 236 // A listener for events on an <code>AutomationNode</code>. |
237 callback AutomationListener = void(AutomationEvent event); | 237 callback AutomationListener = void(AutomationEvent event); |
238 | 238 |
239 // Called when the root <code>AutomationNode</code> for the page is available. | |
240 callback RootCallback = void(AutomationNode rootNode); | |
241 | |
239 // A single node in an Automation tree. | 242 // A single node in an Automation tree. |
240 [nocompile, noinline_doc] dictionary AutomationNode { | 243 [nocompile, noinline_doc] dictionary AutomationNode { |
241 // The root node of the tree containing this AutomationNode. | 244 // The root node of the tree containing this AutomationNode. |
242 AutomationRootNode root; | 245 AutomationNode root; |
aboxhall
2014/10/29 19:29:11
Why did this change? An AutomationRootNode _is_ an
David Tseng
2014/10/29 20:35:30
I removed the AutomationRootNode interface; can pu
| |
243 | 246 |
244 // Whether this AutomationNode is an AutomationRootNode. | 247 // Whether this AutomationNode is a root node. |
245 boolean isRootNode; | 248 boolean isRootNode; |
246 | 249 |
247 // Unique ID to identify this node. | 250 // Unique ID to identify this node. |
248 long id; | 251 long id; |
249 | 252 |
250 // The role of this node. | 253 // The role of this node. |
251 automation.RoleType role; | 254 automation.RoleType role; |
252 | 255 |
253 // The $(ref:automation.StateType)s describing this node. | 256 // The $(ref:automation.StateType)s describing this node. |
254 object state; | 257 object state; |
255 | 258 |
256 // The rendered location (as a bounding box) of this node within the frame. | 259 // The rendered location (as a bounding box) of this node within the frame. |
257 automation.Rect location; | 260 automation.Rect location; |
258 | 261 |
259 // A collection of this node's other attributes. | 262 // A collection of this node's other attributes. |
260 object? attributes; | 263 object? attributes; |
261 | 264 |
265 // Whether this AutomationNode is loaded or not. If false, call load() | |
266 // to get the contents. Only applicable on webArea nodes. | |
267 boolean? loaded; | |
268 | |
262 // The index of this node in its parent node's list of children. If this is | 269 // The index of this node in its parent node's list of children. If this is |
263 // the root node, this will be undefined. | 270 // the root node, this will be undefined. |
264 long? indexInParent; | 271 long? indexInParent; |
265 | 272 |
266 static AutomationNode[] children(); | 273 static AutomationNode[] children(); |
267 static AutomationNode parent(); | 274 static AutomationNode parent(); |
268 static AutomationNode firstChild(); | 275 static AutomationNode firstChild(); |
269 static AutomationNode lastChild(); | 276 static AutomationNode lastChild(); |
270 static AutomationNode previousSibling(); | 277 static AutomationNode previousSibling(); |
271 static AutomationNode nextSibling(); | 278 static AutomationNode nextSibling(); |
272 | 279 |
273 // Does the default action based on this node's role. This is generally | 280 // Does the default action based on this node's role. This is generally |
274 // the same action that would result from clicking the node such as | 281 // the same action that would result from clicking the node such as |
275 // expanding a treeitem, toggling a checkbox, selecting a radiobutton, | 282 // expanding a treeitem, toggling a checkbox, selecting a radiobutton, |
276 // or activating a button. | 283 // or activating a button. |
277 static void doDefault(); | 284 static void doDefault(); |
278 | 285 |
279 // Places focus on this node. | 286 // Places focus on this node. |
280 static void focus(); | 287 static void focus(); |
281 | 288 |
282 // Scrolls this node to make it visible. | 289 // Scrolls this node to make it visible. |
283 static void makeVisible(); | 290 static void makeVisible(); |
284 | 291 |
285 // Sets selection within a text field. | 292 // Sets selection within a text field. |
286 static void setSelection(long startIndex, long endIndex); | 293 static void setSelection(long startIndex, long endIndex); |
287 | 294 |
295 // Load the accessibility tree for this node hosting a frame. Only | |
296 // applicable on webArea nodes. | |
297 static void load(RootCallback callback); | |
298 | |
288 // Adds a listener for the given event type and event phase. | 299 // Adds a listener for the given event type and event phase. |
289 static void addEventListener( | 300 static void addEventListener( |
290 EventType eventType, AutomationListener listener, boolean capture); | 301 EventType eventType, AutomationListener listener, boolean capture); |
291 | 302 |
292 // Removes a listener for the given event type and event phase. | 303 // Removes a listener for the given event type and event phase. |
293 static void removeEventListener( | 304 static void removeEventListener( |
294 EventType eventType, AutomationListener listener, boolean capture); | 305 EventType eventType, AutomationListener listener, boolean capture); |
295 }; | 306 }; |
296 | 307 |
297 // Called when the <code>AutomationRootNode</code> for the page is available. | |
298 callback RootCallback = void(AutomationRootNode rootNode); | |
299 | |
300 // The root node of the automation tree for a single frame or desktop. | |
301 // This may be: | |
302 // <ul> | |
303 // <li> The desktop | |
304 // <li> The top frame of a page | |
305 // <li> A frame or iframe within a page | |
306 // </ul> | |
307 // Thus, an <code>AutomationRootNode</code> may be a descendant of one or | |
308 // more <code>AutomationRootNode</code>s, and in turn have one or more | |
309 // <code>AutomationRootNode</code>s in its descendants. Thus, the | |
310 // <code>root</code> property of the <code>AutomationRootNode</code> will be | |
311 // the immediate parent <code>AutomationRootNode</code>, or <code>null</code> | |
312 // if this is the top-level <code>AutomationRootNode</code>. | |
313 // | |
314 // Extends $(ref:automation.AutomationNode). | |
315 [nocompile, noinline_doc] dictionary AutomationRootNode { | |
316 // TODO(aboxhall/dtseng): implement loading. Kept separate to not include | |
317 // in generated docs. | |
318 | |
319 // Whether this AutomationRootNode is loaded or not. If false, call load() | |
320 // to get the contents. | |
321 boolean loaded; | |
322 | |
323 // Load the accessibility tree for this AutomationRootNode. | |
324 static void load(RootCallback callback); | |
325 }; | |
326 | |
327 interface Functions { | 308 interface Functions { |
328 // Get the automation tree for the tab with the given tabId, or the current | 309 // Get the automation tree for the tab with the given tabId, or the current |
329 // tab if no tabID is given, enabling automation if necessary. Returns a | 310 // tab if no tabID is given, enabling automation if necessary. Returns a |
330 // tree with a placeholder root node; listen for the "loadComplete" event to | 311 // tree with a placeholder root node; listen for the "loadComplete" event to |
331 // get a notification that the tree has fully loaded (the previous root node | 312 // get a notification that the tree has fully loaded (the previous root node |
332 // reference will stop working at or before this point). | 313 // reference will stop working at or before this point). |
333 [nocompile] static void getTree(optional long tabId, RootCallback callback); | 314 [nocompile] static void getTree(optional long tabId, RootCallback callback); |
334 | 315 |
335 // Get the automation tree for the whole desktop which consists of all on | 316 // Get the automation tree for the whole desktop which consists of all on |
336 // screen views. Note this API is currently only supported on Chrome OS. | 317 // screen views. Note this API is currently only supported on Chrome OS. |
337 [nocompile] static void getDesktop(RootCallback callback); | 318 [nocompile] static void getDesktop(RootCallback callback); |
338 }; | 319 }; |
339 }; | 320 }; |
OLD | NEW |