OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * @fileoverview Provides bindings to instantiate objects in the automation API. | |
7 * | |
8 * Due to restrictions in the extension system, it is not ordinarily possible to | |
9 * construct an object defined by the extension API. However, given an instance | |
10 * of that object, we can save its constructor for future use. | |
11 */ | |
12 | |
13 goog.provide('AutomationObjectInstaller'); | |
dmazzoni
2016/05/02 22:15:48
Nice hack! How about something like AutomationObje
David Tseng
2016/05/03 20:18:27
Done.
| |
14 | |
15 /** | |
16 * installs the AutomationNode and AutomationEvent classes based on an | |
dmazzoni
2016/05/02 22:15:48
nit: capital I at start of sentence
David Tseng
2016/05/03 20:18:27
Done.
| |
17 * AutomationNode instance. | |
18 * @param {chrome.automation.AutomationNode} node | |
19 */ | |
20 AutomationObjectInstaller.init = function(node) { | |
21 chrome.automation.AutomationNode = | |
22 /** @type {function (new:chrome.automation.AutomationNode)} */( | |
23 node.constructor); | |
24 node.addEventListener(chrome.automation.EventType.childrenChanged, | |
25 function installAutomationEvent(e) { | |
26 chrome.automation.AutomationEvent = | |
27 /** @type {function (new:chrome.automation.AutomationEvent)} */( | |
28 e.constructor); | |
29 node.removeEventListener( | |
30 chrome.automation.EventType.childrenChanged, | |
31 installAutomationEvent, | |
32 true); | |
33 }, | |
34 true); | |
35 }; | |
OLD | NEW |