Chromium Code Reviews| Index: chrome/renderer/resources/extensions/automation_custom_bindings.js |
| diff --git a/chrome/renderer/resources/extensions/automation_custom_bindings.js b/chrome/renderer/resources/extensions/automation_custom_bindings.js |
| index ae84e27949fd3baaca5a8ab0f0819b402a5ebc7e..31816022648b797909daa421667d5ede7b5094b8 100644 |
| --- a/chrome/renderer/resources/extensions/automation_custom_bindings.js |
| +++ b/chrome/renderer/resources/extensions/automation_custom_bindings.js |
| @@ -127,6 +127,27 @@ automation.registerCustomHook(function(bindingsAPI) { |
| addTreeChangeObserver(observer); |
| }); |
| + apiFunctions.setHandleRequest('setSelection', function(anchorNode, |
| + anchorOffset, |
| + focusNode, |
| + focusOffset) { |
| + var anchorNodeImpl = privates(anchorNode).impl; |
| + var focusNodeImpl = privates(focusNode).impl; |
| + if (anchorNodeImpl.treeID !== focusNodeImpl.treeID) |
| + throw new Error('Selection anchor and focus must be in the same tree.'); |
| + if (anchorNodeImpl.treeID === DESKTOP_TREE_ID && |
| + (anchorNodeImpl.id !== focusNodeImpl.id)) { |
|
David Tseng
2015/09/23 19:10:42
Also, forgot to add that I think this API should j
|
| + throw new Error( |
| + 'Selections in the desktop tree must be within the same node'); |
| + } |
| + automationInternal.performAction({ treeID: anchorNodeImpl.treeID, |
| + automationNodeID: anchorNodeImpl.id, |
| + actionType: 'setSelection'}, |
| + { focusNodeID: focusNodeImpl.id, |
| + anchorOffset: anchorOffset, |
| + focusOffset: focusOffset }); |
| + }); |
| + |
| }); |
| automationInternal.onTreeChange.addListener(function(treeID, |