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