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

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

Issue 709933002: Add frameId to MessageSender (extension messaging API) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test that tests for a non-negative frameId Created 6 years, 1 month 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
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/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "content/public/browser/render_process_host.h" 8 #include "content/public/browser/render_process_host.h"
9 #include "extensions/browser/extension_host.h" 9 #include "extensions/browser/extension_host.h"
10 #include "extensions/browser/process_manager.h" 10 #include "extensions/browser/process_manager.h"
11 #include "extensions/common/extension_messages.h" 11 #include "extensions/common/extension_messages.h"
12 #include "extensions/common/manifest_handlers/background_info.h" 12 #include "extensions/common/manifest_handlers/background_info.h"
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 ExtensionMessagePort::ExtensionMessagePort(content::RenderProcessHost* process, 16 ExtensionMessagePort::ExtensionMessagePort(content::RenderProcessHost* process,
17 int routing_id, 17 int routing_id,
18 const std::string& extension_id) 18 const std::string& extension_id)
19 : process_(process), 19 : process_(process),
20 routing_id_(routing_id), 20 routing_id_(routing_id),
21 extension_id_(extension_id), 21 extension_id_(extension_id),
22 background_host_ptr_(NULL) { 22 background_host_ptr_(NULL) {
23 } 23 }
24 24
25 void ExtensionMessagePort::DispatchOnConnect( 25 void ExtensionMessagePort::DispatchOnConnect(
26 int dest_port_id, 26 int dest_port_id,
27 const std::string& channel_name, 27 const std::string& channel_name,
28 const base::DictionaryValue& source_tab, 28 const base::DictionaryValue& source_tab,
29 int source_frame_id,
29 const std::string& source_extension_id, 30 const std::string& source_extension_id,
30 const std::string& target_extension_id, 31 const std::string& target_extension_id,
31 const GURL& source_url, 32 const GURL& source_url,
32 const std::string& tls_channel_id) { 33 const std::string& tls_channel_id) {
33 ExtensionMsg_ExternalConnectionInfo info; 34 ExtensionMsg_ExternalConnectionInfo info;
34 info.target_id = target_extension_id; 35 info.target_id = target_extension_id;
35 info.source_id = source_extension_id; 36 info.source_id = source_extension_id;
37 info.source_frame_id = source_frame_id;
36 info.source_url = source_url; 38 info.source_url = source_url;
37 process_->Send(new ExtensionMsg_DispatchOnConnect( 39 process_->Send(new ExtensionMsg_DispatchOnConnect(
38 routing_id_, dest_port_id, channel_name, source_tab, info, 40 routing_id_, dest_port_id, channel_name, source_tab, info,
39 tls_channel_id)); 41 tls_channel_id));
40 } 42 }
41 43
42 void ExtensionMessagePort::DispatchOnDisconnect( 44 void ExtensionMessagePort::DispatchOnDisconnect(
43 int source_port_id, 45 int source_port_id,
44 const std::string& error_message) { 46 const std::string& error_message) {
45 process_->Send(new ExtensionMsg_DispatchOnDisconnect( 47 process_->Send(new ExtensionMsg_DispatchOnDisconnect(
(...skipping 26 matching lines...) Expand all
72 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id_); 74 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id_);
73 if (host && host == background_host_ptr_) 75 if (host && host == background_host_ptr_)
74 pm->DecrementLazyKeepaliveCount(host->extension()); 76 pm->DecrementLazyKeepaliveCount(host->extension());
75 } 77 }
76 78
77 content::RenderProcessHost* ExtensionMessagePort::GetRenderProcessHost() { 79 content::RenderProcessHost* ExtensionMessagePort::GetRenderProcessHost() {
78 return process_; 80 return process_;
79 } 81 }
80 82
81 } // namespace extensions 83 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698