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

Side by Side Diff: chrome/browser/extensions/api/messaging/extension_message_port.cc

Issue 14301016: Fix a couple of bugs relating to sending Tab info with chrome.runtime.connect and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add key to app1/manifest.json Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/messaging/extension_message_port.h" 5 #include "chrome/browser/extensions/api/messaging/extension_message_port.h"
6 6
7 #include "chrome/browser/extensions/extension_host.h" 7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/extensions/background_info.h" 11 #include "chrome/common/extensions/background_info.h"
12 #include "chrome/common/extensions/extension_messages.h" 12 #include "chrome/common/extensions/extension_messages.h"
13 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
14 14
15 namespace extensions { 15 namespace extensions {
16 16
17 ExtensionMessagePort::ExtensionMessagePort(content::RenderProcessHost* process, 17 ExtensionMessagePort::ExtensionMessagePort(content::RenderProcessHost* process,
18 int routing_id, 18 int routing_id,
19 const std::string& extension_id) 19 const std::string& extension_id)
20 : process_(process), 20 : process_(process),
21 routing_id_(routing_id), 21 routing_id_(routing_id),
22 extension_id_(extension_id), 22 extension_id_(extension_id),
23 background_host_ptr_(NULL) { 23 background_host_ptr_(NULL) {
24 } 24 }
25 25
26 void ExtensionMessagePort::DispatchOnConnect( 26 void ExtensionMessagePort::DispatchOnConnect(
27 int dest_port_id, 27 int dest_port_id,
28 const std::string& channel_name, 28 const std::string& channel_name,
29 const std::string& tab_json, 29 const base::DictionaryValue& source_tab,
30 const std::string& source_extension_id, 30 const std::string& source_extension_id,
31 const std::string& target_extension_id) { 31 const std::string& target_extension_id,
32 const GURL& source_url) {
33 ExtensionMsg_ExternalConnectionInfo info;
34 info.target_id = target_extension_id;
35 info.source_id = source_extension_id;
36 info.source_url = source_url;
32 process_->Send(new ExtensionMsg_DispatchOnConnect( 37 process_->Send(new ExtensionMsg_DispatchOnConnect(
33 routing_id_, dest_port_id, channel_name, 38 routing_id_, dest_port_id, channel_name, source_tab, info));
34 tab_json, source_extension_id, target_extension_id));
35 } 39 }
36 40
37 void ExtensionMessagePort::DispatchOnDisconnect( 41 void ExtensionMessagePort::DispatchOnDisconnect(
38 int source_port_id, 42 int source_port_id,
39 const std::string& error_message) { 43 const std::string& error_message) {
40 process_->Send(new ExtensionMsg_DispatchOnDisconnect( 44 process_->Send(new ExtensionMsg_DispatchOnDisconnect(
41 routing_id_, source_port_id, error_message)); 45 routing_id_, source_port_id, error_message));
42 } 46 }
43 47
44 void ExtensionMessagePort::DispatchOnMessage(const std::string& message, 48 void ExtensionMessagePort::DispatchOnMessage(const std::string& message,
(...skipping 24 matching lines...) Expand all
69 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id_); 73 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id_);
70 if (host && host == background_host_ptr_) 74 if (host && host == background_host_ptr_)
71 pm->DecrementLazyKeepaliveCount(host->extension()); 75 pm->DecrementLazyKeepaliveCount(host->extension());
72 } 76 }
73 77
74 content::RenderProcessHost* ExtensionMessagePort::GetRenderProcessHost() { 78 content::RenderProcessHost* ExtensionMessagePort::GetRenderProcessHost() {
75 return process_; 79 return process_;
76 } 80 }
77 81
78 } // namespace extensions 82 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698