feat: add event.senderId property to IPCs sent via ipcRenderer.sendTo (#14395)

This commit is contained in:
Milan Burda 2018-09-01 03:13:51 +02:00 committed by Charles Kerr
parent b89848d683
commit c17a1b37ea
11 changed files with 90 additions and 31 deletions

View file

@ -1556,10 +1556,17 @@ void WebContents::TabTraverse(bool reverse) {
bool WebContents::SendIPCMessage(bool all_frames,
const std::string& channel,
const base::ListValue& args) {
return SendIPCMessageWithSender(all_frames, channel, args);
}
bool WebContents::SendIPCMessageWithSender(bool all_frames,
const std::string& channel,
const base::ListValue& args,
int32_t sender_id) {
auto* frame_host = web_contents()->GetMainFrame();
if (frame_host) {
return frame_host->Send(new AtomFrameMsg_Message(
frame_host->GetRoutingID(), all_frames, channel, args));
frame_host->GetRoutingID(), all_frames, channel, args, sender_id));
}
return false;
}
@ -2090,7 +2097,7 @@ void WebContents::OnRendererMessageTo(content::RenderFrameHost* frame_host,
isolate(), web_contents_id);
if (web_contents) {
web_contents->SendIPCMessage(send_to_all, channel, args);
web_contents->SendIPCMessageWithSender(send_to_all, channel, args, ID());
}
}