OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, | 896 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, |
897 OnShutdownRequest) | 897 OnShutdownRequest) |
898 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, | 898 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, |
899 OnDumpHandlesDone) | 899 OnDumpHandlesDone) |
900 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, | 900 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, |
901 SuddenTerminationChanged) | 901 SuddenTerminationChanged) |
902 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, | 902 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, |
903 OnUserMetricsRecordAction) | 903 OnUserMetricsRecordAction) |
904 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) | 904 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) |
905 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) | 905 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) |
| 906 IPC_MESSAGE_HANDLER(ViewHostMsg_SendPostMessage, OnSendPostMessage) |
906 IPC_MESSAGE_UNHANDLED_ERROR() | 907 IPC_MESSAGE_UNHANDLED_ERROR() |
907 IPC_END_MESSAGE_MAP_EX() | 908 IPC_END_MESSAGE_MAP_EX() |
908 | 909 |
909 if (!msg_is_ok) { | 910 if (!msg_is_ok) { |
910 // The message had a handler, but its de-serialization failed. | 911 // The message had a handler, but its de-serialization failed. |
911 // We consider this a capital crime. Kill the renderer if we have one. | 912 // We consider this a capital crime. Kill the renderer if we have one. |
912 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer."; | 913 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer."; |
913 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); | 914 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); |
914 ReceivedBadMessage(); | 915 ReceivedBadMessage(); |
915 } | 916 } |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1311 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
1311 // Only honor the request if appropriate persmissions are granted. | 1312 // Only honor the request if appropriate persmissions are granted. |
1312 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1313 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
1313 content::GetContentClient()->browser()->OpenItem(path); | 1314 content::GetContentClient()->browser()->OpenItem(path); |
1314 } | 1315 } |
1315 | 1316 |
1316 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1317 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
1317 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1318 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
1318 MHTMLGenerated(job_id, data_size); | 1319 MHTMLGenerated(job_id, data_size); |
1319 } | 1320 } |
| 1321 |
| 1322 void RenderProcessHostImpl::OnSendPostMessage(int64 browsing_instance_frame_id, |
| 1323 const ViewMsg_PostMessage_Params&
params) { |
| 1324 DLOG(WARNING) << "OnSendPostMessage"; |
| 1325 content::FrameMapper& frame_mapper = GetBrowserContext()->frame_mapper(); |
| 1326 content::BrowsingInstanceFrame* frame = |
| 1327 frame_mapper.FindById(browsing_instance_frame_id); |
| 1328 |
| 1329 // Until we remove the proxy when a frame is closed, there might be a proxy |
| 1330 // for a frame that no longer exists. If that's the case, just drop the msg. |
| 1331 if (!frame) { |
| 1332 return; |
| 1333 } |
| 1334 |
| 1335 RenderViewHost *rvh = RenderViewHost::FromID(frame->current_process_host_id(), |
| 1336 frame->current_route_id()); |
| 1337 |
| 1338 // TODO(supersat): Temporary workaround for frames not being removed from |
| 1339 // the mapper properly. |
| 1340 if (!rvh) { |
| 1341 return; |
| 1342 } |
| 1343 |
| 1344 rvh->Send(new ViewMsg_PostMessage(rvh->routing_id(), |
| 1345 frame->current_frame_id(), |
| 1346 params)); |
| 1347 } |
OLD | NEW |