OLD | NEW |
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 // 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 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 bool msg_is_ok = true; | 894 bool msg_is_ok = true; |
895 IPC_BEGIN_MESSAGE_MAP_EX(RenderProcessHostImpl, msg, msg_is_ok) | 895 IPC_BEGIN_MESSAGE_MAP_EX(RenderProcessHostImpl, msg, msg_is_ok) |
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) | |
905 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) | 904 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) |
| 905 // Adding single handlers for your service here is fine, but once your |
| 906 // service needs more than one handler, please extract them into a new |
| 907 // message filter and add that filter to CreateMessageFilters(). |
906 IPC_MESSAGE_UNHANDLED_ERROR() | 908 IPC_MESSAGE_UNHANDLED_ERROR() |
907 IPC_END_MESSAGE_MAP_EX() | 909 IPC_END_MESSAGE_MAP_EX() |
908 | 910 |
909 if (!msg_is_ok) { | 911 if (!msg_is_ok) { |
910 // The message had a handler, but its de-serialization failed. | 912 // The message had a handler, but its de-serialization failed. |
911 // We consider this a capital crime. Kill the renderer if we have one. | 913 // We consider this a capital crime. Kill the renderer if we have one. |
912 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer."; | 914 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer."; |
913 content::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); | 915 content::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); |
914 ReceivedBadMessage(); | 916 ReceivedBadMessage(); |
915 } | 917 } |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 Send(queued_messages_.front()); | 1358 Send(queued_messages_.front()); |
1357 queued_messages_.pop(); | 1359 queued_messages_.pop(); |
1358 } | 1360 } |
1359 } | 1361 } |
1360 | 1362 |
1361 void RenderProcessHostImpl::OnUserMetricsRecordAction( | 1363 void RenderProcessHostImpl::OnUserMetricsRecordAction( |
1362 const std::string& action) { | 1364 const std::string& action) { |
1363 content::RecordComputedAction(action); | 1365 content::RecordComputedAction(action); |
1364 } | 1366 } |
1365 | 1367 |
1366 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | |
1367 // Only honor the request if appropriate persmissions are granted. | |
1368 if (ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(GetID(), | |
1369 path)) | |
1370 content::GetContentClient()->browser()->OpenItem(path); | |
1371 } | |
1372 | 1368 |
1373 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1369 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
1374 MHTMLGenerationManager::GetInstance()->MHTMLGenerated(job_id, data_size); | 1370 MHTMLGenerationManager::GetInstance()->MHTMLGenerated(job_id, data_size); |
1375 } | 1371 } |
1376 | 1372 |
1377 void RenderProcessHostImpl::OnCompositorSurfaceBuffersSwappedNoHost( | 1373 void RenderProcessHostImpl::OnCompositorSurfaceBuffersSwappedNoHost( |
1378 int32 surface_id, | 1374 int32 surface_id, |
1379 uint64 surface_handle, | 1375 uint64 surface_handle, |
1380 int32 route_id, | 1376 int32 route_id, |
1381 int32 gpu_process_host_id) { | 1377 int32 gpu_process_host_id) { |
1382 TRACE_EVENT0("renderer_host", | 1378 TRACE_EVENT0("renderer_host", |
1383 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1379 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
1384 RenderWidgetHostImpl::AcknowledgeSwapBuffers(route_id, | 1380 RenderWidgetHostImpl::AcknowledgeSwapBuffers(route_id, |
1385 gpu_process_host_id); | 1381 gpu_process_host_id); |
1386 } | 1382 } |
OLD | NEW |