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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 #include "base/tracked_objects.h" | 43 #include "base/tracked_objects.h" |
44 #include "build/build_config.h" | 44 #include "build/build_config.h" |
45 #include "cc/base/switches.h" | 45 #include "cc/base/switches.h" |
46 #include "components/scheduler/common/scheduler_switches.h" | 46 #include "components/scheduler/common/scheduler_switches.h" |
47 #include "components/tracing/tracing_switches.h" | 47 #include "components/tracing/tracing_switches.h" |
48 #include "content/browser/appcache/appcache_dispatcher_host.h" | 48 #include "content/browser/appcache/appcache_dispatcher_host.h" |
49 #include "content/browser/appcache/chrome_appcache_service.h" | 49 #include "content/browser/appcache/chrome_appcache_service.h" |
50 #include "content/browser/background_sync/background_sync_service_impl.h" | 50 #include "content/browser/background_sync/background_sync_service_impl.h" |
51 #include "content/browser/bad_message.h" | 51 #include "content/browser/bad_message.h" |
52 #include "content/browser/blob_storage/blob_dispatcher_host.h" | 52 #include "content/browser/blob_storage/blob_dispatcher_host.h" |
53 #include "content/browser/bluetooth/bluetooth_dispatcher_host.h" | |
54 #include "content/browser/browser_child_process_host_impl.h" | 53 #include "content/browser/browser_child_process_host_impl.h" |
55 #include "content/browser/browser_main.h" | 54 #include "content/browser/browser_main.h" |
56 #include "content/browser/browser_main_loop.h" | 55 #include "content/browser/browser_main_loop.h" |
57 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" | 56 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" |
58 #include "content/browser/cache_storage/cache_storage_context_impl.h" | 57 #include "content/browser/cache_storage/cache_storage_context_impl.h" |
59 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" | 58 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" |
60 #include "content/browser/child_process_security_policy_impl.h" | 59 #include "content/browser/child_process_security_policy_impl.h" |
61 #include "content/browser/device_sensors/device_light_message_filter.h" | 60 #include "content/browser/device_sensors/device_light_message_filter.h" |
62 #include "content/browser/device_sensors/device_motion_message_filter.h" | 61 #include "content/browser/device_sensors/device_motion_message_filter.h" |
63 #include "content/browser/device_sensors/device_orientation_absolute_message_fil ter.h" | 62 #include "content/browser/device_sensors/device_orientation_absolute_message_fil ter.h" |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
805 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 804 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( |
806 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( | 805 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( |
807 content::BrowserThread::IO)); | 806 content::BrowserThread::IO)); |
808 #endif | 807 #endif |
809 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); | 808 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); |
810 return channel; | 809 return channel; |
811 } | 810 } |
812 | 811 |
813 void RenderProcessHostImpl::CreateMessageFilters() { | 812 void RenderProcessHostImpl::CreateMessageFilters() { |
814 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 813 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
815 const base::CommandLine& browser_command_line = | |
816 *base::CommandLine::ForCurrentProcess(); | |
817 AddFilter(new ResourceSchedulerFilter(GetID())); | 814 AddFilter(new ResourceSchedulerFilter(GetID())); |
818 MediaInternals* media_internals = MediaInternals::GetInstance(); | 815 MediaInternals* media_internals = MediaInternals::GetInstance(); |
819 media::AudioManager* audio_manager = | 816 media::AudioManager* audio_manager = |
820 BrowserMainLoop::GetInstance()->audio_manager(); | 817 BrowserMainLoop::GetInstance()->audio_manager(); |
821 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages | 818 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages |
822 // from guests. | 819 // from guests. |
823 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( | 820 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( |
824 new BrowserPluginMessageFilter(GetID())); | 821 new BrowserPluginMessageFilter(GetID())); |
825 AddFilter(bp_message_filter.get()); | 822 AddFilter(bp_message_filter.get()); |
826 | 823 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1001 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); | 998 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); |
1002 AddFilter(new HistogramMessageFilter()); | 999 AddFilter(new HistogramMessageFilter()); |
1003 AddFilter(new MemoryMessageFilter(this)); | 1000 AddFilter(new MemoryMessageFilter(this)); |
1004 AddFilter(new PushMessagingMessageFilter( | 1001 AddFilter(new PushMessagingMessageFilter( |
1005 GetID(), storage_partition_impl_->GetServiceWorkerContext())); | 1002 GetID(), storage_partition_impl_->GetServiceWorkerContext())); |
1006 #if defined(OS_ANDROID) | 1003 #if defined(OS_ANDROID) |
1007 AddFilter(new ScreenOrientationMessageFilterAndroid()); | 1004 AddFilter(new ScreenOrientationMessageFilterAndroid()); |
1008 #endif | 1005 #endif |
1009 AddFilter(new GeofencingDispatcherHost( | 1006 AddFilter(new GeofencingDispatcherHost( |
1010 storage_partition_impl_->GetGeofencingManager())); | 1007 storage_partition_impl_->GetGeofencingManager())); |
1011 | |
1012 bool enable_web_bluetooth = | |
1013 browser_command_line.HasSwitch(switches::kEnableWebBluetooth); | |
1014 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | |
1015 enable_web_bluetooth = true; | |
1016 #endif | |
1017 | |
1018 if (enable_web_bluetooth) { | |
1019 bluetooth_dispatcher_host_ = new BluetoothDispatcherHost(GetID()); | |
1020 AddFilter(bluetooth_dispatcher_host_.get()); | |
1021 } | |
1022 } | 1008 } |
1023 | 1009 |
1024 void RenderProcessHostImpl::RegisterMojoServices() { | 1010 void RenderProcessHostImpl::RegisterMojoServices() { |
1025 #if !defined(OS_ANDROID) | 1011 #if !defined(OS_ANDROID) |
1026 mojo_application_host_->service_registry()->AddService( | 1012 mojo_application_host_->service_registry()->AddService( |
1027 base::Bind(&device::BatteryMonitorImpl::Create)); | 1013 base::Bind(&device::BatteryMonitorImpl::Create)); |
1028 | 1014 |
1029 mojo_application_host_->service_registry()->AddService( | 1015 mojo_application_host_->service_registry()->AddService( |
1030 base::Bind(&device::VibrationManagerImpl::Create)); | 1016 base::Bind(&device::VibrationManagerImpl::Create)); |
1031 #endif | 1017 #endif |
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2739 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) | 2725 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) |
2740 .AddExtension(kEventLogFileNameAddition); | 2726 .AddExtension(kEventLogFileNameAddition); |
2741 } | 2727 } |
2742 #endif // defined(ENABLE_WEBRTC) | 2728 #endif // defined(ENABLE_WEBRTC) |
2743 | 2729 |
2744 void RenderProcessHostImpl::GetAudioOutputControllers( | 2730 void RenderProcessHostImpl::GetAudioOutputControllers( |
2745 const GetAudioOutputControllersCallback& callback) const { | 2731 const GetAudioOutputControllersCallback& callback) const { |
2746 audio_renderer_host()->GetOutputControllers(callback); | 2732 audio_renderer_host()->GetOutputControllers(callback); |
2747 } | 2733 } |
2748 | 2734 |
2749 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2735 BluetoothAdapterFactoryWrapper* |
Jeffrey Yasskin
2016/05/13 04:41:59
You can just return a BluetoothAdapterFactoryWrapp
ortuno
2016/05/13 20:11:18
Done.
Jeffrey Yasskin
2016/05/13 21:36:55
You did this in WebBluetoothServiceImpl but not he
ortuno
2016/05/13 22:14:38
Oops. Done.
| |
2750 return bluetooth_dispatcher_host_.get(); | 2736 RenderProcessHostImpl::GetBluetoothAdapterFactoryWrapper() { |
2737 return &bluetooth_adapter_factory_wrapper_; | |
2751 } | 2738 } |
2752 | 2739 |
2753 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { | 2740 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { |
2754 // We are updating all widgets including swapped out ones. | 2741 // We are updating all widgets including swapped out ones. |
2755 std::unique_ptr<RenderWidgetHostIterator> widgets( | 2742 std::unique_ptr<RenderWidgetHostIterator> widgets( |
2756 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); | 2743 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); |
2757 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 2744 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
2758 RenderViewHost* rvh = RenderViewHost::From(widget); | 2745 RenderViewHost* rvh = RenderViewHost::From(widget); |
2759 if (!rvh) | 2746 if (!rvh) |
2760 continue; | 2747 continue; |
2761 | 2748 |
2762 // Skip widgets in other processes. | 2749 // Skip widgets in other processes. |
2763 if (rvh->GetProcess()->GetID() != GetID()) | 2750 if (rvh->GetProcess()->GetID() != GetID()) |
2764 continue; | 2751 continue; |
2765 | 2752 |
2766 rvh->OnWebkitPreferencesChanged(); | 2753 rvh->OnWebkitPreferencesChanged(); |
2767 } | 2754 } |
2768 } | 2755 } |
2769 | 2756 |
2770 } // namespace content | 2757 } // namespace content |
OLD | NEW |