Index: content/browser/renderer_host/render_process_host_impl.cc |
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
index 108514ab9659e979d8413bd0420beca7aa3b2ec0..60206d69f72aaa26af5a85cb66e9157acf656443 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -884,6 +884,7 @@ bool RenderProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { |
OnUserMetricsRecordAction) |
IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) |
IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) |
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SendPostMessage, OnSendPostMessage) |
IPC_MESSAGE_UNHANDLED_ERROR() |
IPC_END_MESSAGE_MAP_EX() |
@@ -1310,3 +1311,33 @@ void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
MHTMLGenerated(job_id, data_size); |
} |
+ |
+void RenderProcessHostImpl::OnSendPostMessage( |
+ int64 content_frame_id, |
+ const ViewMsg_PostMessage_Params& params) { |
+ DLOG(WARNING) << "OnSendPostMessage"; |
+ content::FrameMap* frame_mapper = GetBrowserContext()->frame_mapper(); |
+ content::ContentFrame* frame = |
+ frame_mapper->FindFrame(content_frame_id); |
+ |
+ // Until we remove the proxy when a frame is closed, there might be a proxy |
+ // for a frame that no longer exists. If that's the case, just drop the msg. |
+ if (!frame) |
+ return; |
+ |
+ const content::WebKitFrameIdentifier webkitFrameId = |
+ frame->active_webkit_frame(); |
+ |
+ RenderViewHost *rvh = RenderViewHost::FromID(webkitFrameId.process_host_id, |
+ webkitFrameId.route_id); |
+ |
+ // TODO(supersat): Temporary workaround for frames not being removed from |
+ // the mapper properly. |
+ if (!rvh) { |
+ return; |
+ } |
+ |
+ rvh->Send(new ViewMsg_PostMessage(rvh->routing_id(), |
+ webkitFrameId.frame_id, |
+ params)); |
+} |