Commit 9a3fb195 authored by lazyboy's avatar lazyboy Committed by Commit bot

Fix TODO in chrome_web_view, use utils.lookup to find context menu events.

This was done previously accessing array by index, which is brittle b/c
this depends on the ordering of the events in web_view_internal.json.

BUG=None
Test=None, internal only cleanup.

Review URL: https://codereview.chromium.org/1039043003

Cr-Commit-Position: refs/heads/master@{#322588}
parent 0816793b
......@@ -123,8 +123,8 @@ var WebViewContextMenus = Utils.expose(
WebViewImpl.prototype.maybeSetupContextMenus = function() {
if (!this.contextMenusOnContextMenuEvent_) {
var eventName = 'chromeWebViewInternal.onContextMenuShow';
// TODO(lazyboy): Find event by name instead of events[1].
var eventSchema = ChromeWebViewSchema.events[1];
var eventSchema =
Utils.lookup(ChromeWebViewSchema.events, 'name', 'onShow');
var eventOptions = {supportsListeners: true};
this.contextMenusOnContextMenuEvent_ = new ContextMenusOnContextMenuEvent(
this, eventName, eventSchema, eventOptions, this.viewInstanceId);
......@@ -143,8 +143,8 @@ WebViewImpl.prototype.maybeSetupContextMenus = function() {
return function() {
if (!this.contextMenusOnClickedEvent_) {
var eventName = 'chromeWebViewInternal.onClicked';
// TODO(lazyboy): Find event by name instead of events[0].
var eventSchema = ChromeWebViewSchema.events[0];
var eventSchema =
Utils.lookup(ChromeWebViewSchema.events, 'name', 'onClicked');
var eventOptions = {supportsListeners: true};
var onClickedEvent = new ContextMenusOnClickedEvent(
eventName, eventSchema, eventOptions, this.viewInstanceId);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment