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

Side by Side Diff: chrome/renderer/resources/extensions/automation_custom_bindings.js

Issue 304293002: Add human readable programmatic enum name/values to chrome.automation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Last feedback. Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Custom bindings for the automation API. 5 // Custom bindings for the automation API.
6 var AutomationNode = require('automationNode').AutomationNode; 6 var AutomationNode = require('automationNode').AutomationNode;
7 var AutomationTree = require('automationTree').AutomationTree; 7 var AutomationTree = require('automationTree').AutomationTree;
8 var automation = require('binding').Binding.create('automation'); 8 var automation = require('binding').Binding.create('automation');
9 var automationInternal = 9 var automationInternal =
10 require('binding').Binding.create('automationInternal').generate(); 10 require('binding').Binding.create('automationInternal').generate();
11 var eventBindings = require('event_bindings'); 11 var eventBindings = require('event_bindings');
12 var Event = eventBindings.Event; 12 var Event = eventBindings.Event;
13 var forEach = require('utils').forEach;
13 var lastError = require('lastError'); 14 var lastError = require('lastError');
15 var schema =
16 requireNative('automationInternal').GetSchemaAdditions();
14 17
15 // TODO(aboxhall): Look into using WeakMap 18 // TODO(aboxhall): Look into using WeakMap
16 var idToAutomationTree = {}; 19 var idToAutomationTree = {};
17 var idToCallback = {}; 20 var idToCallback = {};
18 21
19 // TODO(dtseng): Move out to automation/automation_util.js or as a static member 22 // TODO(dtseng): Move out to automation/automation_util.js or as a static member
20 // of AutomationTree to keep this file clean. 23 // of AutomationTree to keep this file clean.
21 /* 24 /*
22 * Creates an id associated with a particular AutomationTree based upon a 25 * Creates an id associated with a particular AutomationTree based upon a
23 * renderer/renderer host pair's process and routing id. 26 * renderer/renderer host pair's process and routing id.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 for (var i = 0; i < idToCallback[id].length; i++) { 112 for (var i = 0; i < idToCallback[id].length; i++) {
110 var callback = idToCallback[id][i]; 113 var callback = idToCallback[id][i];
111 callback(targetTree); 114 callback(targetTree);
112 } 115 }
113 delete idToCallback[id]; 116 delete idToCallback[id];
114 } 117 }
115 } 118 }
116 }); 119 });
117 120
118 exports.binding = automation.generate(); 121 exports.binding = automation.generate();
122
123 // Add additional accessibility bindings not specified in the automation IDL.
124 // Accessibility and automation share some APIs (see
125 // ui/accessibility/ax_enums.idl).
126 forEach(schema, function(k, v) {
127 exports.binding[k] = v;
128 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698