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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 8760024: Cross-process postMessage (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: New patch, still not quite done Created 9 years 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) 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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 905 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
906 OnShutdownRequest) 906 OnShutdownRequest)
907 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, 907 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone,
908 OnDumpHandlesDone) 908 OnDumpHandlesDone)
909 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, 909 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged,
910 SuddenTerminationChanged) 910 SuddenTerminationChanged)
911 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, 911 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
912 OnUserMetricsRecordAction) 912 OnUserMetricsRecordAction)
913 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) 913 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS)
914 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) 914 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML)
915 IPC_MESSAGE_HANDLER(ViewHostMsg_SendPostMessage, OnSendPostMessage)
915 IPC_MESSAGE_UNHANDLED_ERROR() 916 IPC_MESSAGE_UNHANDLED_ERROR()
916 IPC_END_MESSAGE_MAP_EX() 917 IPC_END_MESSAGE_MAP_EX()
917 918
918 if (!msg_is_ok) { 919 if (!msg_is_ok) {
919 // The message had a handler, but its de-serialization failed. 920 // The message had a handler, but its de-serialization failed.
920 // We consider this a capital crime. Kill the renderer if we have one. 921 // We consider this a capital crime. Kill the renderer if we have one.
921 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer."; 922 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer.";
922 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); 923 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH"));
923 ReceivedBadMessage(); 924 ReceivedBadMessage();
924 } 925 }
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { 1323 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) {
1323 // Only honor the request if appropriate persmissions are granted. 1324 // Only honor the request if appropriate persmissions are granted.
1324 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) 1325 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path))
1325 content::GetContentClient()->browser()->OpenItem(path); 1326 content::GetContentClient()->browser()->OpenItem(path);
1326 } 1327 }
1327 1328
1328 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { 1329 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) {
1329 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> 1330 content::GetContentClient()->browser()->GetMHTMLGenerationManager()->
1330 MHTMLGenerated(job_id, data_size); 1331 MHTMLGenerated(job_id, data_size);
1331 } 1332 }
1333
1334 void RenderProcessHostImpl::OnSendPostMessage(int64 browsing_instance_frame_id,
1335 const ViewMsg_PostMessage_Params& params) {
Charlie Reis 2011/12/12 22:20:36 Line length
supersat 2011/12/15 19:30:49 Done.
1336 DLOG(WARNING) << "OnSendPostMessage";
1337 content::FrameMap& frame_mapper = GetBrowserContext()->frame_mapper();
1338 content::BrowsingInstanceFrame* frame =
1339 frame_mapper.FindById(browsing_instance_frame_id);
1340
1341 // Until we remove the proxy when a frame is closed, there might be a proxy
1342 // for a frame that no longer exists. If that's the case, just drop the msg.
1343 if (!frame) {
Charlie Reis 2011/12/12 22:20:36 No braces on a one line if.
supersat 2011/12/15 19:30:49 Done.
1344 return;
1345 }
1346
1347 RenderViewHost *rvh = RenderViewHost::FromID(frame->current_process_host_id(),
1348 frame->current_route_id());
1349
1350 // TODO(supersat): Temporary workaround for frames not being removed from
1351 // the mapper properly.
1352 if (!rvh) {
1353 return;
1354 }
1355
1356 rvh->Send(new ViewMsg_PostMessage(rvh->routing_id(),
1357 frame->current_frame_id(),
1358 params));
1359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698