OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 AddFilter(new MemoryMessageFilter(this)); | 1018 AddFilter(new MemoryMessageFilter(this)); |
1019 AddFilter(new PushMessagingMessageFilter( | 1019 AddFilter(new PushMessagingMessageFilter( |
1020 GetID(), storage_partition_impl_->GetServiceWorkerContext())); | 1020 GetID(), storage_partition_impl_->GetServiceWorkerContext())); |
1021 #if defined(OS_ANDROID) | 1021 #if defined(OS_ANDROID) |
1022 AddFilter(new ScreenOrientationMessageFilterAndroid()); | 1022 AddFilter(new ScreenOrientationMessageFilterAndroid()); |
1023 #endif | 1023 #endif |
1024 } | 1024 } |
1025 | 1025 |
1026 void RenderProcessHostImpl::RegisterMojoInterfaces() { | 1026 void RenderProcessHostImpl::RegisterMojoInterfaces() { |
1027 #if !defined(OS_ANDROID) | 1027 #if !defined(OS_ANDROID) |
1028 mojo_application_host_->service_registry()->AddService( | 1028 GetInterfaceRegistry()->AddInterface( |
1029 base::Bind(&device::BatteryMonitorImpl::Create)); | 1029 base::Bind(&device::BatteryMonitorImpl::Create)); |
1030 #endif | 1030 #endif |
1031 | 1031 |
1032 mojo_application_host_->service_registry()->AddService( | 1032 GetInterfaceRegistry()->AddInterface( |
1033 base::Bind(&PermissionServiceContext::CreateService, | 1033 base::Bind(&PermissionServiceContext::CreateService, |
1034 base::Unretained(permission_service_context_.get()))); | 1034 base::Unretained(permission_service_context_.get()))); |
1035 | 1035 |
1036 // TODO(mcasas): finalize arguments. | 1036 // TODO(mcasas): finalize arguments. |
1037 mojo_application_host_->service_registry()->AddService( | 1037 GetInterfaceRegistry()->AddInterface( |
1038 base::Bind(&ImageCaptureImpl::Create)); | 1038 base::Bind(&ImageCaptureImpl::Create)); |
1039 | 1039 |
1040 mojo_application_host_->service_registry()->AddService( | 1040 GetInterfaceRegistry()->AddInterface( |
1041 base::Bind(&OffscreenCanvasSurfaceImpl::Create)); | 1041 base::Bind(&OffscreenCanvasSurfaceImpl::Create)); |
1042 | 1042 |
1043 mojo_application_host_->service_registry()->AddService(base::Bind( | 1043 GetInterfaceRegistry()->AddInterface(base::Bind( |
1044 &BackgroundSyncContext::CreateService, | 1044 &BackgroundSyncContext::CreateService, |
1045 base::Unretained(storage_partition_impl_->GetBackgroundSyncContext()))); | 1045 base::Unretained(storage_partition_impl_->GetBackgroundSyncContext()))); |
1046 | 1046 |
1047 mojo_application_host_->service_registry()->AddService(base::Bind( | 1047 GetInterfaceRegistry()->AddInterface(base::Bind( |
1048 &PlatformNotificationContextImpl::CreateService, | 1048 &PlatformNotificationContextImpl::CreateService, |
1049 base::Unretained( | 1049 base::Unretained( |
1050 storage_partition_impl_->GetPlatformNotificationContext()), GetID())); | 1050 storage_partition_impl_->GetPlatformNotificationContext()), GetID())); |
1051 | 1051 |
1052 mojo_application_host_->service_registry()->AddService( | 1052 GetInterfaceRegistry()->AddInterface( |
1053 base::Bind(&RenderProcessHostImpl::CreateStoragePartitionService, | 1053 base::Bind(&RenderProcessHostImpl::CreateStoragePartitionService, |
1054 base::Unretained(this))); | 1054 base::Unretained(this))); |
1055 | 1055 |
1056 mojo_application_host_->service_registry()->AddService( | 1056 GetInterfaceRegistry()->AddInterface( |
1057 base::Bind(&MimeRegistryImpl::Create), | 1057 base::Bind(&MimeRegistryImpl::Create), |
1058 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 1058 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
1059 | 1059 |
1060 #if defined(OS_ANDROID) | 1060 #if defined(OS_ANDROID) |
1061 ServiceRegistrarAndroid::RegisterProcessHostServices( | 1061 ServiceRegistrarAndroid::RegisterProcessHostServices( |
1062 mojo_application_host_->service_registry_android()); | 1062 mojo_application_host_->service_registry_android()); |
1063 #endif | 1063 #endif |
1064 | 1064 |
1065 GetContentClient()->browser()->RegisterRenderProcessMojoServices( | 1065 GetContentClient()->browser()->ExposeInterfacesToRenderer( |
1066 mojo_application_host_->service_registry(), this); | 1066 mojo_application_host_->interface_registry(), this); |
1067 } | 1067 } |
1068 | 1068 |
1069 void RenderProcessHostImpl::CreateStoragePartitionService( | 1069 void RenderProcessHostImpl::CreateStoragePartitionService( |
1070 mojo::InterfaceRequest<mojom::StoragePartitionService> request) { | 1070 mojo::InterfaceRequest<mojom::StoragePartitionService> request) { |
1071 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! | 1071 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! |
1072 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1072 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1073 switches::kMojoLocalStorage)) { | 1073 switches::kMojoLocalStorage)) { |
1074 storage_partition_impl_->Bind(std::move(request)); | 1074 storage_partition_impl_->Bind(std::move(request)); |
1075 } | 1075 } |
1076 } | 1076 } |
1077 | 1077 |
1078 int RenderProcessHostImpl::GetNextRoutingID() { | 1078 int RenderProcessHostImpl::GetNextRoutingID() { |
1079 return widget_helper_->GetNextRoutingID(); | 1079 return widget_helper_->GetNextRoutingID(); |
1080 } | 1080 } |
1081 | 1081 |
1082 void RenderProcessHostImpl::ResumeDeferredNavigation( | 1082 void RenderProcessHostImpl::ResumeDeferredNavigation( |
1083 const GlobalRequestID& request_id) { | 1083 const GlobalRequestID& request_id) { |
1084 widget_helper_->ResumeDeferredNavigation(request_id); | 1084 widget_helper_->ResumeDeferredNavigation(request_id); |
1085 } | 1085 } |
1086 | 1086 |
1087 void RenderProcessHostImpl::NotifyTimezoneChange(const std::string& zone_id) { | 1087 void RenderProcessHostImpl::NotifyTimezoneChange(const std::string& zone_id) { |
1088 Send(new ViewMsg_TimezoneChange(zone_id)); | 1088 Send(new ViewMsg_TimezoneChange(zone_id)); |
1089 } | 1089 } |
1090 | 1090 |
1091 ServiceRegistry* RenderProcessHostImpl::GetServiceRegistry() { | 1091 shell::InterfaceRegistry* RenderProcessHostImpl::GetInterfaceRegistry() { |
1092 DCHECK(mojo_application_host_); | 1092 DCHECK(mojo_application_host_); |
1093 return mojo_application_host_->service_registry(); | 1093 return mojo_application_host_->interface_registry(); |
| 1094 } |
| 1095 |
| 1096 shell::InterfaceProvider* RenderProcessHostImpl::GetRemoteInterfaces() { |
| 1097 DCHECK(mojo_application_host_); |
| 1098 return mojo_application_host_->remote_interfaces(); |
1094 } | 1099 } |
1095 | 1100 |
1096 shell::Connection* RenderProcessHostImpl::GetChildConnection() { | 1101 shell::Connection* RenderProcessHostImpl::GetChildConnection() { |
1097 DCHECK(mojo_child_connection_); | 1102 DCHECK(mojo_child_connection_); |
1098 return mojo_child_connection_->connection(); | 1103 return mojo_child_connection_->connection(); |
1099 } | 1104 } |
1100 | 1105 |
1101 std::unique_ptr<base::SharedPersistentMemoryAllocator> | 1106 std::unique_ptr<base::SharedPersistentMemoryAllocator> |
1102 RenderProcessHostImpl::TakeMetricsAllocator() { | 1107 RenderProcessHostImpl::TakeMetricsAllocator() { |
1103 return std::move(metrics_allocator_); | 1108 return std::move(metrics_allocator_); |
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2814 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2819 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2815 | 2820 |
2816 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2821 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
2817 // enough information here so that we can determine what the bad message was. | 2822 // enough information here so that we can determine what the bad message was. |
2818 base::debug::Alias(&error); | 2823 base::debug::Alias(&error); |
2819 bad_message::ReceivedBadMessage(process.get(), | 2824 bad_message::ReceivedBadMessage(process.get(), |
2820 bad_message::RPH_MOJO_PROCESS_ERROR); | 2825 bad_message::RPH_MOJO_PROCESS_ERROR); |
2821 } | 2826 } |
2822 | 2827 |
2823 } // namespace content | 2828 } // namespace content |
OLD | NEW |