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

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

Issue 10323002: Move message handlers that don't belong in RenderProcessHostImpl to their own files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months 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 | Annotate | Revision Log
OLDNEW
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 29 matching lines...) Expand all
40 #include "base/threading/thread_restrictions.h" 40 #include "base/threading/thread_restrictions.h"
41 #include "base/tracked_objects.h" 41 #include "base/tracked_objects.h"
42 #include "content/browser/appcache/appcache_dispatcher_host.h" 42 #include "content/browser/appcache/appcache_dispatcher_host.h"
43 #include "content/browser/appcache/chrome_appcache_service.h" 43 #include "content/browser/appcache/chrome_appcache_service.h"
44 #include "content/browser/browser_main.h" 44 #include "content/browser/browser_main.h"
45 #include "content/browser/browser_main_loop.h" 45 #include "content/browser/browser_main_loop.h"
46 #include "content/browser/child_process_security_policy_impl.h" 46 #include "content/browser/child_process_security_policy_impl.h"
47 #include "content/browser/device_orientation/message_filter.h" 47 #include "content/browser/device_orientation/message_filter.h"
48 #include "content/browser/dom_storage/dom_storage_context_impl.h" 48 #include "content/browser/dom_storage/dom_storage_context_impl.h"
49 #include "content/browser/dom_storage/dom_storage_message_filter.h" 49 #include "content/browser/dom_storage/dom_storage_message_filter.h"
50 #include "content/browser/download/mhtml_generation_manager.h"
51 #include "content/browser/fileapi/chrome_blob_storage_context.h" 50 #include "content/browser/fileapi/chrome_blob_storage_context.h"
52 #include "content/browser/fileapi/fileapi_message_filter.h" 51 #include "content/browser/fileapi/fileapi_message_filter.h"
53 #include "content/browser/geolocation/geolocation_dispatcher_host.h" 52 #include "content/browser/geolocation/geolocation_dispatcher_host.h"
54 #include "content/browser/gpu/gpu_data_manager_impl.h" 53 #include "content/browser/gpu/gpu_data_manager_impl.h"
55 #include "content/browser/gpu/gpu_process_host.h" 54 #include "content/browser/gpu/gpu_process_host.h"
56 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" 55 #include "content/browser/in_process_webkit/indexed_db_context_impl.h"
57 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" 56 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h"
58 #include "content/browser/mime_registry_message_filter.h" 57 #include "content/browser/mime_registry_message_filter.h"
59 #include "content/browser/plugin_service_impl.h" 58 #include "content/browser/plugin_service_impl.h"
60 #include "content/browser/profiler_message_filter.h" 59 #include "content/browser/profiler_message_filter.h"
61 #include "content/browser/renderer_host/clipboard_message_filter.h" 60 #include "content/browser/renderer_host/clipboard_message_filter.h"
62 #include "content/browser/renderer_host/database_message_filter.h" 61 #include "content/browser/renderer_host/database_message_filter.h"
63 #include "content/browser/renderer_host/file_utilities_message_filter.h" 62 #include "content/browser/renderer_host/file_utilities_message_filter.h"
64 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" 63 #include "content/browser/renderer_host/gamepad_browser_message_filter.h"
65 #include "content/browser/renderer_host/gpu_message_filter.h" 64 #include "content/browser/renderer_host/gpu_message_filter.h"
66 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" 65 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
67 #include "content/browser/renderer_host/media/audio_renderer_host.h" 66 #include "content/browser/renderer_host/media/audio_renderer_host.h"
68 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" 67 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h"
69 #include "content/browser/renderer_host/media/video_capture_host.h" 68 #include "content/browser/renderer_host/media/video_capture_host.h"
69 #include "content/browser/renderer_host/mhtml_generation_message_filter.h"
70 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" 70 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h"
71 #include "content/browser/renderer_host/pepper_file_message_filter.h" 71 #include "content/browser/renderer_host/pepper_file_message_filter.h"
72 #include "content/browser/renderer_host/pepper_message_filter.h" 72 #include "content/browser/renderer_host/pepper_message_filter.h"
73 #include "content/browser/renderer_host/quota_dispatcher_host.h" 73 #include "content/browser/renderer_host/quota_dispatcher_host.h"
74 #include "content/browser/renderer_host/render_message_filter.h" 74 #include "content/browser/renderer_host/render_message_filter.h"
75 #include "content/browser/renderer_host/render_view_host_impl.h" 75 #include "content/browser/renderer_host/render_view_host_impl.h"
76 #include "content/browser/renderer_host/render_widget_helper.h" 76 #include "content/browser/renderer_host/render_widget_helper.h"
77 #include "content/browser/renderer_host/resource_message_filter.h" 77 #include "content/browser/renderer_host/resource_message_filter.h"
78 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" 78 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h"
79 #include "content/browser/renderer_host/text_input_client_message_filter.h" 79 #include "content/browser/renderer_host/text_input_client_message_filter.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 channel_->AddFilter(new TraceMessageFilter()); 536 channel_->AddFilter(new TraceMessageFilter());
537 channel_->AddFilter(new ResolveProxyMsgHelper( 537 channel_->AddFilter(new ResolveProxyMsgHelper(
538 browser_context->GetRequestContextForRenderProcess(GetID()))); 538 browser_context->GetRequestContextForRenderProcess(GetID())));
539 channel_->AddFilter(new QuotaDispatcherHost( 539 channel_->AddFilter(new QuotaDispatcherHost(
540 GetID(), 540 GetID(),
541 content::BrowserContext::GetQuotaManager(browser_context), 541 content::BrowserContext::GetQuotaManager(browser_context),
542 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); 542 content::GetContentClient()->browser()->CreateQuotaPermissionContext()));
543 channel_->AddFilter(new content::GamepadBrowserMessageFilter(this)); 543 channel_->AddFilter(new content::GamepadBrowserMessageFilter(this));
544 channel_->AddFilter(new content::ProfilerMessageFilter( 544 channel_->AddFilter(new content::ProfilerMessageFilter(
545 content::PROCESS_TYPE_RENDERER)); 545 content::PROCESS_TYPE_RENDERER));
546 channel_->AddFilter(new content::MHTMLGenerationMessageFilter());
546 } 547 }
547 548
548 int RenderProcessHostImpl::GetNextRoutingID() { 549 int RenderProcessHostImpl::GetNextRoutingID() {
549 return widget_helper_->GetNextRoutingID(); 550 return widget_helper_->GetNextRoutingID();
550 } 551 }
551 552
552 void RenderProcessHostImpl::CancelResourceRequests(int render_widget_id) { 553 void RenderProcessHostImpl::CancelResourceRequests(int render_widget_id) {
553 widget_helper_->CancelResourceRequests(render_widget_id); 554 widget_helper_->CancelResourceRequests(render_widget_id);
554 } 555 }
555 556
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 bool msg_is_ok = true; 895 bool msg_is_ok = true;
895 IPC_BEGIN_MESSAGE_MAP_EX(RenderProcessHostImpl, msg, msg_is_ok) 896 IPC_BEGIN_MESSAGE_MAP_EX(RenderProcessHostImpl, msg, msg_is_ok)
896 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 897 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
897 OnShutdownRequest) 898 OnShutdownRequest)
898 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, 899 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone,
899 OnDumpHandlesDone) 900 OnDumpHandlesDone)
900 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, 901 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged,
901 SuddenTerminationChanged) 902 SuddenTerminationChanged)
902 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, 903 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
903 OnUserMetricsRecordAction) 904 OnUserMetricsRecordAction)
904 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) 905 // Do not add more handlers here for your service! Rather, create a
905 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) 906 // message filter and add it in CreateMessageFilters().
jam 2012/05/02 18:15:00 I agree if there are a few messages for a feature.
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 content::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); 914 content::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH"));
914 ReceivedBadMessage(); 915 ReceivedBadMessage();
915 } 916 }
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 Send(queued_messages_.front()); 1336 Send(queued_messages_.front());
1336 queued_messages_.pop(); 1337 queued_messages_.pop();
1337 } 1338 }
1338 } 1339 }
1339 1340
1340 void RenderProcessHostImpl::OnUserMetricsRecordAction( 1341 void RenderProcessHostImpl::OnUserMetricsRecordAction(
1341 const std::string& action) { 1342 const std::string& action) {
1342 content::RecordComputedAction(action); 1343 content::RecordComputedAction(action);
1343 } 1344 }
1344 1345
1345 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) {
1346 // Only honor the request if appropriate persmissions are granted.
1347 if (ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(GetID(),
1348 path))
1349 content::GetContentClient()->browser()->OpenItem(path);
1350 }
1351
1352 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) {
1353 MHTMLGenerationManager::GetInstance()->MHTMLGenerated(job_id, data_size);
1354 }
1355
1356 void RenderProcessHostImpl::OnCompositorSurfaceBuffersSwappedNoHost( 1346 void RenderProcessHostImpl::OnCompositorSurfaceBuffersSwappedNoHost(
1357 int32 surface_id, 1347 int32 surface_id,
1358 uint64 surface_handle, 1348 uint64 surface_handle,
1359 int32 route_id, 1349 int32 route_id,
1360 int32 gpu_process_host_id) { 1350 int32 gpu_process_host_id) {
1361 TRACE_EVENT0("renderer_host", 1351 TRACE_EVENT0("renderer_host",
1362 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); 1352 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost");
1363 RenderWidgetHostImpl::AcknowledgeSwapBuffers(route_id, 1353 RenderWidgetHostImpl::AcknowledgeSwapBuffers(route_id,
1364 gpu_process_host_id); 1354 gpu_process_host_id);
1365 } 1355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698