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

Unified Diff: chrome/browser/renderer_host/resource_message_filter.cc

Issue 155707: Changed the extension.connect() API not to broadcast to all tabs. Added a (Closed)
Patch Set: review comments Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/resource_message_filter.cc
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index bf542cdd167590d1a35bbc00f49a283740e838fd..41b0b3535042d3589e20d50a7b1390c1cdad16be 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -147,6 +147,7 @@ ResourceMessageFilter::ResourceMessageFilter(
request_context_(profile->GetRequestContext()),
media_request_context_(profile->GetRequestContextForMedia()),
extensions_request_context_(profile->GetRequestContextForExtensions()),
+ extensions_message_service_(profile->GetExtensionMessageService()),
profile_(profile),
render_widget_helper_(render_widget_helper),
audio_renderer_host_(audio_renderer_host),
@@ -334,6 +335,8 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& message) {
#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension,
OnOpenChannelToExtension)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToTab,
+ OnOpenChannelToTab)
IPC_MESSAGE_HANDLER(ViewHostMsg_CloseIdleConnections,
OnCloseIdleConnections)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCacheMode,
@@ -901,8 +904,23 @@ void ResourceMessageFilter::OnFreeTransportDIB(
void ResourceMessageFilter::OnOpenChannelToExtension(
int routing_id, const std::string& extension_id,
const std::string& channel_name, int* port_id) {
- *port_id = ExtensionMessageService::GetInstance(request_context_.get())->
- OpenChannelToExtension(routing_id, extension_id, channel_name, this);
+ if (extensions_message_service_.get()) {
+ *port_id = extensions_message_service_->
+ OpenChannelToExtension(routing_id, extension_id, channel_name, this);
+ } else {
+ *port_id = -1;
+ }
+}
+
+void ResourceMessageFilter::OnOpenChannelToTab(
+ int routing_id, int tab_id, const std::string& extension_id,
+ const std::string& channel_name, int* port_id) {
+ if (extensions_message_service_.get()) {
+ *port_id = extensions_message_service_->
+ OpenChannelToTab(routing_id, tab_id, extension_id, channel_name, this);
+ } else {
+ *port_id = -1;
+ }
}
bool ResourceMessageFilter::CheckBenchmarkingEnabled() {
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698