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 3d38afc4e0a5c427a40f93c8108a22a99e5aaede..b8ab7270fabe6c31894b2c82bf97610f7d52008d 100644 |
| --- a/chrome/renderer/resources/extensions/automation_custom_bindings.js |
| +++ b/chrome/renderer/resources/extensions/automation_custom_bindings.js |
| @@ -14,6 +14,7 @@ var forEach = require('utils').forEach; |
| var lastError = require('lastError'); |
| var logging = requireNative('logging'); |
| var schema = requireNative('automationInternal').GetSchemaAdditions(); |
| +var GetRoutingID = requireNative('automationInternal').GetRoutingID; |
|
not at google - send to devlin
2015/06/04 23:03:29
rather than requiring automationInternal 3 times,
dmazzoni
2015/06/08 18:02:58
Done.
|
| /** |
| * A namespace to export utility functions to other files in automation. |
| @@ -53,7 +54,9 @@ automation.registerCustomHook(function(bindingsAPI) { |
| var apiFunctions = bindingsAPI.apiFunctions; |
| // TODO(aboxhall, dtseng): Make this return the speced AutomationRootNode obj. |
| - apiFunctions.setHandleRequest('getTree', function getTree(tabId, callback) { |
| + apiFunctions.setHandleRequest('getTree', function getTree(tabID, callback) { |
| + var routingID = GetRoutingID(); |
| + |
| // enableTab() ensures the renderer for the active or specified tab has |
| // accessibility enabled, and fetches its ax tree id to use as |
| // a key in the idToAutomationRootNode map. The callback to |
| @@ -61,13 +64,15 @@ automation.registerCustomHook(function(bindingsAPI) { |
| // the tree is available (either due to having been cached earlier, or after |
| // an accessibility event occurs which causes the tree to be populated), the |
| // callback can be called. |
| - automationInternal.enableTab(tabId, function onEnable(id) { |
| - if (lastError.hasError(chrome)) { |
| - callback(); |
| - return; |
| - } |
| - automationUtil.storeTreeCallback(id, callback); |
| - }); |
| + var params = { routingID: routingID, tabID: tabID }; |
| + automationInternal.enableTab(params, |
| + function onEnable(id) { |
| + if (lastError.hasError(chrome)) { |
| + callback(); |
| + return; |
| + } |
| + automationUtil.storeTreeCallback(id, callback); |
| + }); |
| }); |
| var desktopTree = null; |
| @@ -80,9 +85,11 @@ automation.registerCustomHook(function(bindingsAPI) { |
| else |
| idToCallback[DESKTOP_TREE_ID] = [callback]; |
| + var routingID = GetRoutingID(); |
| + |
| // TODO(dtseng): Disable desktop tree once desktop object goes out of |
| // scope. |
| - automationInternal.enableDesktop(function() { |
| + automationInternal.enableDesktop(routingID, function() { |
| if (lastError.hasError(chrome)) { |
| delete idToAutomationRootNode[ |
| DESKTOP_TREE_ID]; |