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. 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 visited | 213 visited |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 dictionary Rect { | 216 dictionary Rect { |
| 217 long left; | 217 long left; |
| 218 long top; | 218 long top; |
| 219 long width; | 219 long width; |
| 220 long height; | 220 long height; |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 // The parameters for a <code>query</code>. | |
| 224 dictionary QueryInfo { | |
| 225 DOMString? querySelector; | |
|
David Tseng
2014/10/27 20:44:35
Is this optional?
aboxhall
2014/10/28 23:43:56
See below.
| |
| 226 }; | |
|
David Tseng
2014/10/27 20:44:35
Will there be additional info members? If not, the
aboxhall
2014/10/28 23:43:56
Right, I guess my CL description was a little misl
dmazzoni
2014/10/29 00:00:10
My vote is to have two separate APIs. I'll comment
| |
| 227 | |
| 228 // Called when the result for a <code>query</code> is available. | |
| 229 callback QueryCallback = void(AutomationNode node); | |
| 230 | |
| 223 // An event in the Automation tree. | 231 // An event in the Automation tree. |
| 224 [nocompile, noinline_doc] dictionary AutomationEvent { | 232 [nocompile, noinline_doc] dictionary AutomationEvent { |
| 225 // The $(ref:automation.AutomationNode) to which the event was targeted. | 233 // The $(ref:automation.AutomationNode) to which the event was targeted. |
| 226 AutomationNode target; | 234 AutomationNode target; |
| 227 | 235 |
| 228 // The type of the event. | 236 // The type of the event. |
| 229 EventType type; | 237 EventType type; |
| 230 | 238 |
| 231 // Stops this event from further processing except for any remaining | 239 // Stops this event from further processing except for any remaining |
| 232 // listeners on $(ref:AutomationEvent.target). | 240 // listeners on $(ref:AutomationEvent.target). |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 // Sets selection within a text field. | 293 // Sets selection within a text field. |
| 286 static void setSelection(long startIndex, long endIndex); | 294 static void setSelection(long startIndex, long endIndex); |
| 287 | 295 |
| 288 // Adds a listener for the given event type and event phase. | 296 // Adds a listener for the given event type and event phase. |
| 289 static void addEventListener( | 297 static void addEventListener( |
| 290 EventType eventType, AutomationListener listener, boolean capture); | 298 EventType eventType, AutomationListener listener, boolean capture); |
| 291 | 299 |
| 292 // Removes a listener for the given event type and event phase. | 300 // Removes a listener for the given event type and event phase. |
| 293 static void removeEventListener( | 301 static void removeEventListener( |
| 294 EventType eventType, AutomationListener listener, boolean capture); | 302 EventType eventType, AutomationListener listener, boolean capture); |
| 303 | |
|
David Tseng
2014/10/27 20:44:35
nit: Docs?
aboxhall
2014/10/28 23:43:56
Done.
| |
| 304 static void query(QueryInfo info, QueryCallback callback); | |
| 295 }; | 305 }; |
| 296 | 306 |
| 297 // Called when the <code>AutomationRootNode</code> for the page is available. | 307 // Called when the <code>AutomationRootNode</code> for the page is available. |
| 298 callback RootCallback = void(AutomationRootNode rootNode); | 308 callback RootCallback = void(AutomationRootNode rootNode); |
| 299 | 309 |
| 300 // The root node of the automation tree for a single frame or desktop. | 310 // The root node of the automation tree for a single frame or desktop. |
| 301 // This may be: | 311 // This may be: |
| 302 // <ul> | 312 // <ul> |
| 303 // <li> The desktop | 313 // <li> The desktop |
| 304 // <li> The top frame of a page | 314 // <li> The top frame of a page |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 330 // tree with a placeholder root node; listen for the "loadComplete" event to | 340 // 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 | 341 // get a notification that the tree has fully loaded (the previous root node |
| 332 // reference will stop working at or before this point). | 342 // reference will stop working at or before this point). |
| 333 [nocompile] static void getTree(optional long tabId, RootCallback callback); | 343 [nocompile] static void getTree(optional long tabId, RootCallback callback); |
| 334 | 344 |
| 335 // Get the automation tree for the whole desktop which consists of all on | 345 // 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. | 346 // screen views. Note this API is currently only supported on Chrome OS. |
| 337 [nocompile] static void getDesktop(RootCallback callback); | 347 [nocompile] static void getDesktop(RootCallback callback); |
| 338 }; | 348 }; |
| 339 }; | 349 }; |
| OLD | NEW |