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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_object_installer.js

Issue 1942683005: Refactor event handler classes to make it easier to add new event type listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
(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 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698