Commit 1122a79d authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Chromecast] Remove unneccessary tabs custom bindings

The `tabs` custom bindings have been entirely replaced by native
counterparts. Remove the JS version.

Bug: 938998
Change-Id: I7a55e00fb2bf008bcecae6c3b00179040f6aba8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1559255Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649257}
parent 7043ec9f
......@@ -65,7 +65,6 @@ void CastExtensionsDispatcherDelegate::PopulateSourceMap(
source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS);
source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS);
source_map->RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS);
}
......
// Copyright (c) 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Custom binding for the tabs API.
var messaging = require('messaging');
var OpenChannelToTab = requireNative('messaging_natives').OpenChannelToTab;
var sendRequestIsDisabled = requireNative('process').IsSendRequestDisabled();
var forEach = require('utils').forEach;
apiBridge.registerCustomHook(function(bindingsAPI, extensionId) {
var apiFunctions = bindingsAPI.apiFunctions;
var tabs = bindingsAPI.compiledApi;
apiFunctions.setHandleRequest('connect', function(tabId, connectInfo) {
var name = '';
var frameId = -1;
if (connectInfo) {
name = connectInfo.name || name;
frameId = connectInfo.frameId;
if (typeof frameId == 'undefined' || frameId === null || frameId < 0)
frameId = -1;
}
var portId = OpenChannelToTab(tabId, frameId, extensionId, name);
return messaging.createPort(portId, name);
});
apiFunctions.setHandleRequest('sendRequest',
function(tabId, request, responseCallback) {
if (sendRequestIsDisabled)
throw new Error(sendRequestIsDisabled);
var port = tabs.connect(tabId, {name: messaging.kRequestChannel});
messaging.sendMessageImpl(port, request, responseCallback);
});
apiFunctions.setHandleRequest('sendMessage',
function(tabId, message, options, responseCallback) {
var connectInfo = {
name: messaging.kMessageChannel
};
if (options) {
forEach(options, function(k, v) {
connectInfo[k] = v;
});
}
var port = tabs.connect(tabId, connectInfo);
messaging.sendMessageImpl(port, message, responseCallback);
});
});
......@@ -12,7 +12,6 @@
<include name="IDR_AUTOMATION_CUSTOM_BINDINGS_JS" file="extensions\automation_custom_bindings.js" type="BINDATA" />
<include name="IDR_AUTOMATION_EVENT_JS" file="extensions\automation\automation_event.js" type="BINDATA" />
<include name="IDR_AUTOMATION_NODE_JS" file="extensions\automation\automation_node.js" type="BINDATA" />
<include name="IDR_TABS_CUSTOM_BINDINGS_JS" file="extensions\tabs_custom_bindings.js" type="BINDATA" />
<include name="IDR_TTS_CUSTOM_BINDINGS_JS" file="extensions\tts_custom_bindings.js" type="BINDATA" />
</includes>
</release>
......
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