Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7707)

Unified Diff: chrome/renderer/resources/extensions/automation/automation_node.js

Issue 203753002: Implement actions for Automation API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial patch. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/automation/automation_node.js
diff --git a/chrome/renderer/resources/extensions/automation/automation_node.js b/chrome/renderer/resources/extensions/automation/automation_node.js
index 19e4cb815f870e475db45e672f9f85481b2944dc..e1d44b9f8402bdbb699c8232dc35a247fee12bbc 100644
--- a/chrome/renderer/resources/extensions/automation/automation_node.js
+++ b/chrome/renderer/resources/extensions/automation/automation_node.js
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(dtseng): Figure out if there's any other way to get access to
+// AutomationInternal.
+var automationInternal =
+ require('binding').Binding.create('automationInternal').generate();
var utils = require('utils');
/**
@@ -52,8 +56,27 @@ AutomationNodeImpl.prototype = {
return parent.children()[this.index_in_parent + 1];
return undefined;
},
-};
+ doDefault: function() {
+ AutomationInternal.performAction(
+ 'doDefault', this.owner.process_id, this.id)
+ },
+
+ focus: function() {
+ AutomationInternal.performAction(
+ 'focus', this.owner.process_id, this.id)
+ },
+
+ makeVisible: function() {
+ AutomationInternal.performAction(
+ 'makeVisible', this.owner.process_id, this.id)
+ },
+
+ setSelection: function(startIndex, endIndex) {
+ AutomationInternal.performAction(
+ 'setSelection', this.owner.process_id, this.id, [startIndex, endIndex]);
+ },
+};
var AutomationNode = utils.expose('AutomationNode',
AutomationNodeImpl,
@@ -62,5 +85,9 @@ var AutomationNode = utils.expose('AutomationNode',
'lastChild',
'children',
'previousSibling',
- 'nextSibling']);
+ 'nextSibling',
+ 'doDefault',
+ 'focus',
+ 'makeVisible',
+ 'setSelection']);
exports.AutomationNode = AutomationNode;

Powered by Google App Engine
This is Rietveld 408576698