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

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: test: sender.tab.status = 'complete' 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 scoped_ptr<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) {
34 ExtensionMsg_TabConnectionInfo source;
35 if (source_tab)
36 source.tab.Swap(source_tab.get());
37 source.frame_id = source_frame_id;
38
33 ExtensionMsg_ExternalConnectionInfo info; 39 ExtensionMsg_ExternalConnectionInfo info;
34 info.target_id = target_extension_id; 40 info.target_id = target_extension_id;
35 info.source_id = source_extension_id; 41 info.source_id = source_extension_id;
36 info.source_url = source_url; 42 info.source_url = source_url;
43
37 process_->Send(new ExtensionMsg_DispatchOnConnect( 44 process_->Send(new ExtensionMsg_DispatchOnConnect(
38 routing_id_, dest_port_id, channel_name, source_tab, info, 45 routing_id_, dest_port_id, channel_name, source, info, tls_channel_id));
39 tls_channel_id));
40 } 46 }
41 47
42 void ExtensionMessagePort::DispatchOnDisconnect( 48 void ExtensionMessagePort::DispatchOnDisconnect(
43 int source_port_id, 49 int source_port_id,
44 const std::string& error_message) { 50 const std::string& error_message) {
45 process_->Send(new ExtensionMsg_DispatchOnDisconnect( 51 process_->Send(new ExtensionMsg_DispatchOnDisconnect(
46 routing_id_, source_port_id, error_message)); 52 routing_id_, source_port_id, error_message));
47 } 53 }
48 54
49 void ExtensionMessagePort::DispatchOnMessage(const Message& message, 55 void ExtensionMessagePort::DispatchOnMessage(const Message& message,
(...skipping 22 matching lines...) Expand all
72 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id_); 78 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id_);
73 if (host && host == background_host_ptr_) 79 if (host && host == background_host_ptr_)
74 pm->DecrementLazyKeepaliveCount(host->extension()); 80 pm->DecrementLazyKeepaliveCount(host->extension());
75 } 81 }
76 82
77 content::RenderProcessHost* ExtensionMessagePort::GetRenderProcessHost() { 83 content::RenderProcessHost* ExtensionMessagePort::GetRenderProcessHost() {
78 return process_; 84 return process_;
79 } 85 }
80 86
81 } // namespace extensions 87 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698