Commit 34f2af6b authored by rdevlin.cronin's avatar rdevlin.cronin Committed by Commit bot

[Extensions] Remove source/opener tab id from extension ports

The message parameter source_tab_id is no longer used; remove it. By
extension, also remove the opener_tab_id_ property from
ExtensionMessagePorts.

BUG=667584

Review-Url: https://codereview.chromium.org/2540533002
Cr-Commit-Position: refs/heads/master@{#435538}
parent 2ce645a7
......@@ -99,7 +99,6 @@ ExtensionMessagePort::ExtensionMessagePort(
extension_id_(extension_id),
browser_context_(extension_process->GetBrowserContext()),
extension_process_(extension_process),
opener_tab_id_(-1),
did_create_port_(false),
background_host_ptr_(nullptr),
frame_tracker_(new FrameTracker(this)) {
......@@ -122,7 +121,6 @@ ExtensionMessagePort::ExtensionMessagePort(
extension_id_(extension_id),
browser_context_(rfh->GetProcess()->GetBrowserContext()),
extension_process_(nullptr),
opener_tab_id_(-1),
did_create_port_(false),
background_host_ptr_(nullptr),
frame_tracker_(new FrameTracker(this)) {
......@@ -203,10 +201,8 @@ void ExtensionMessagePort::DispatchOnConnect(
const GURL& source_url,
const std::string& tls_channel_id) {
ExtensionMsg_TabConnectionInfo source;
if (source_tab) {
if (source_tab)
source.tab.Swap(source_tab.get());
source.tab.GetInteger("id", &opener_tab_id_);
}
source.frame_id = source_frame_id;
ExtensionMsg_ExternalConnectionInfo info;
......@@ -228,7 +224,7 @@ void ExtensionMessagePort::DispatchOnDisconnect(
void ExtensionMessagePort::DispatchOnMessage(const Message& message) {
SendToPort(base::MakeUnique<ExtensionMsg_DeliverMessage>(
MSG_ROUTING_NONE, port_id_, opener_tab_id_, message));
MSG_ROUTING_NONE, port_id_, message));
}
void ExtensionMessagePort::IncrementLazyKeepaliveCount() {
......
......@@ -98,11 +98,6 @@ class ExtensionMessagePort : public MessageService::MessagePort {
// when the frame is removed or unloaded.
std::set<content::RenderFrameHost*> frames_;
// The ID of the tab where the channel was created. This is saved so that any
// onMessage events can be run in the scope of the tab.
// Only set on receiver ports (if the opener was a tab). -1 if invalid.
int opener_tab_id_;
// Whether the renderer acknowledged creation of the port. This is used to
// distinguish abnormal port closure (e.g. no receivers) from explicit port
// closure (e.g. by the port.disconnect() JavaScript method in the renderer).
......
......@@ -600,9 +600,8 @@ IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect,
std::string /* tls_channel_id */)
// Deliver a message sent with ExtensionHostMsg_PostMessage.
IPC_MESSAGE_ROUTED3(ExtensionMsg_DeliverMessage,
IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage,
int /* target_port_id */,
int /* source_tab_id */,
extensions::Message)
// Dispatch the Port.onDisconnect event for message channels.
......
......@@ -1000,7 +1000,6 @@ void Dispatcher::OnCancelSuspend(const std::string& extension_id) {
}
void Dispatcher::OnDeliverMessage(int target_port_id,
int source_tab_id,
const Message& message) {
MessagingBindings::DeliverMessage(*script_context_set_, target_port_id,
message,
......
......@@ -156,7 +156,6 @@ class Dispatcher : public content::RenderThreadObserver,
void OnActivateExtension(const std::string& extension_id);
void OnCancelSuspend(const std::string& extension_id);
void OnDeliverMessage(int target_port_id,
int source_tab_id,
const Message& message);
void OnDispatchOnConnect(int target_port_id,
const std::string& channel_name,
......
......@@ -345,7 +345,6 @@ void ExtensionFrameHelper::OnExtensionDispatchOnConnect(
}
void ExtensionFrameHelper::OnExtensionDeliverMessage(int target_id,
int source_tab_id,
const Message& message) {
MessagingBindings::DeliverMessage(
extension_dispatcher_->script_context_set(), target_id, message,
......
......@@ -125,7 +125,6 @@ class ExtensionFrameHelper
const ExtensionMsg_ExternalConnectionInfo& info,
const std::string& tls_channel_id);
void OnExtensionDeliverMessage(int target_port_id,
int source_tab_id,
const Message& message);
void OnExtensionDispatchOnDisconnect(int port_id,
const std::string& error_message);
......
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