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..508951610a5afbca8f1b6457f60e599dd9fc3038 100644 |
--- a/chrome/renderer/resources/extensions/automation_custom_bindings.js |
+++ b/chrome/renderer/resources/extensions/automation_custom_bindings.js |
@@ -127,6 +127,23 @@ automation.registerCustomHook(function(bindingsAPI) { |
addTreeChangeObserver(observer); |
}); |
+ apiFunctions.setHandleRequest('setDocumentSelection', function(params) { |
+ var anchorNodeImpl = privates(params.anchorObject).impl; |
+ var focusNodeImpl = privates(params.focusObject).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) { |
+ throw new Error('Use AutomationNode.setSelection to set the selection ' + |
+ 'in the desktop tree.'); |
+ } |
+ automationInternal.performAction({ treeID: anchorNodeImpl.treeID, |
+ automationNodeID: anchorNodeImpl.id, |
+ actionType: 'setSelection'}, |
+ { focusNodeID: focusNodeImpl.id, |
+ anchorOffset: params.anchorOffset, |
+ focusOffset: params.focusOffset }); |
+ }); |
+ |
}); |
automationInternal.onTreeChange.addListener(function(treeID, |