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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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/blob_storage/chrome_blob_storage_context.h" | 53 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
54 #include "content/browser/bluetooth/bluetooth_dispatcher_host.h" | |
55 #include "content/browser/browser_child_process_host_impl.h" | 54 #include "content/browser/browser_child_process_host_impl.h" |
56 #include "content/browser/browser_main.h" | 55 #include "content/browser/browser_main.h" |
57 #include "content/browser/browser_main_loop.h" | 56 #include "content/browser/browser_main_loop.h" |
58 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" | 57 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" |
59 #include "content/browser/cache_storage/cache_storage_context_impl.h" | 58 #include "content/browser/cache_storage/cache_storage_context_impl.h" |
60 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" | 59 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" |
61 #include "content/browser/child_process_security_policy_impl.h" | 60 #include "content/browser/child_process_security_policy_impl.h" |
62 #include "content/browser/device_sensors/device_light_message_filter.h" | 61 #include "content/browser/device_sensors/device_light_message_filter.h" |
63 #include "content/browser/device_sensors/device_motion_message_filter.h" | 62 #include "content/browser/device_sensors/device_motion_message_filter.h" |
64 #include "content/browser/device_sensors/device_orientation_absolute_message_fil
ter.h" | 63 #include "content/browser/device_sensors/device_orientation_absolute_message_fil
ter.h" |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 803 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( |
805 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( | 804 channel.get(), content::BrowserThread::GetMessageLoopProxyForThread( |
806 content::BrowserThread::IO)); | 805 content::BrowserThread::IO)); |
807 #endif | 806 #endif |
808 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); | 807 channel->Init(IPC::ChannelMojo::CreateServerFactory(std::move(handle)), true); |
809 return channel; | 808 return channel; |
810 } | 809 } |
811 | 810 |
812 void RenderProcessHostImpl::CreateMessageFilters() { | 811 void RenderProcessHostImpl::CreateMessageFilters() { |
813 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 812 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
814 const base::CommandLine& browser_command_line = | |
815 *base::CommandLine::ForCurrentProcess(); | |
816 AddFilter(new ResourceSchedulerFilter(GetID())); | 813 AddFilter(new ResourceSchedulerFilter(GetID())); |
817 MediaInternals* media_internals = MediaInternals::GetInstance(); | 814 MediaInternals* media_internals = MediaInternals::GetInstance(); |
818 media::AudioManager* audio_manager = | 815 media::AudioManager* audio_manager = |
819 BrowserMainLoop::GetInstance()->audio_manager(); | 816 BrowserMainLoop::GetInstance()->audio_manager(); |
820 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages | 817 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages |
821 // from guests. | 818 // from guests. |
822 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( | 819 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( |
823 new BrowserPluginMessageFilter(GetID())); | 820 new BrowserPluginMessageFilter(GetID())); |
824 AddFilter(bp_message_filter.get()); | 821 AddFilter(bp_message_filter.get()); |
825 | 822 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 AddFilter(new DeviceOrientationMessageFilter()); | 995 AddFilter(new DeviceOrientationMessageFilter()); |
999 AddFilter(new DeviceOrientationAbsoluteMessageFilter()); | 996 AddFilter(new DeviceOrientationAbsoluteMessageFilter()); |
1000 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); | 997 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); |
1001 AddFilter(new HistogramMessageFilter()); | 998 AddFilter(new HistogramMessageFilter()); |
1002 AddFilter(new MemoryMessageFilter(this)); | 999 AddFilter(new MemoryMessageFilter(this)); |
1003 AddFilter(new PushMessagingMessageFilter( | 1000 AddFilter(new PushMessagingMessageFilter( |
1004 GetID(), storage_partition_impl_->GetServiceWorkerContext())); | 1001 GetID(), storage_partition_impl_->GetServiceWorkerContext())); |
1005 #if defined(OS_ANDROID) | 1002 #if defined(OS_ANDROID) |
1006 AddFilter(new ScreenOrientationMessageFilterAndroid()); | 1003 AddFilter(new ScreenOrientationMessageFilterAndroid()); |
1007 #endif | 1004 #endif |
1008 | |
1009 bool enable_web_bluetooth = | |
1010 browser_command_line.HasSwitch(switches::kEnableWebBluetooth); | |
1011 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | |
1012 enable_web_bluetooth = true; | |
1013 #endif | |
1014 | |
1015 if (enable_web_bluetooth) { | |
1016 bluetooth_dispatcher_host_ = new BluetoothDispatcherHost(GetID()); | |
1017 AddFilter(bluetooth_dispatcher_host_.get()); | |
1018 } | |
1019 } | 1005 } |
1020 | 1006 |
1021 void RenderProcessHostImpl::RegisterMojoServices() { | 1007 void RenderProcessHostImpl::RegisterMojoServices() { |
1022 #if !defined(OS_ANDROID) | 1008 #if !defined(OS_ANDROID) |
1023 mojo_application_host_->service_registry()->AddService( | 1009 mojo_application_host_->service_registry()->AddService( |
1024 base::Bind(&device::BatteryMonitorImpl::Create)); | 1010 base::Bind(&device::BatteryMonitorImpl::Create)); |
1025 | 1011 |
1026 mojo_application_host_->service_registry()->AddService( | 1012 mojo_application_host_->service_registry()->AddService( |
1027 base::Bind(&device::VibrationManagerImpl::Create)); | 1013 base::Bind(&device::VibrationManagerImpl::Create)); |
1028 #endif | 1014 #endif |
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2742 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) | 2728 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) |
2743 .AddExtension(kEventLogFileNameAddition); | 2729 .AddExtension(kEventLogFileNameAddition); |
2744 } | 2730 } |
2745 #endif // defined(ENABLE_WEBRTC) | 2731 #endif // defined(ENABLE_WEBRTC) |
2746 | 2732 |
2747 void RenderProcessHostImpl::GetAudioOutputControllers( | 2733 void RenderProcessHostImpl::GetAudioOutputControllers( |
2748 const GetAudioOutputControllersCallback& callback) const { | 2734 const GetAudioOutputControllersCallback& callback) const { |
2749 audio_renderer_host()->GetOutputControllers(callback); | 2735 audio_renderer_host()->GetOutputControllers(callback); |
2750 } | 2736 } |
2751 | 2737 |
2752 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2738 BluetoothAdapterFactoryWrapper* |
2753 return bluetooth_dispatcher_host_.get(); | 2739 RenderProcessHostImpl::GetBluetoothAdapterFactoryWrapper() { |
| 2740 return &bluetooth_adapter_factory_wrapper_; |
2754 } | 2741 } |
2755 | 2742 |
2756 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { | 2743 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { |
2757 // We are updating all widgets including swapped out ones. | 2744 // We are updating all widgets including swapped out ones. |
2758 std::unique_ptr<RenderWidgetHostIterator> widgets( | 2745 std::unique_ptr<RenderWidgetHostIterator> widgets( |
2759 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); | 2746 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); |
2760 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 2747 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
2761 RenderViewHost* rvh = RenderViewHost::From(widget); | 2748 RenderViewHost* rvh = RenderViewHost::From(widget); |
2762 if (!rvh) | 2749 if (!rvh) |
2763 continue; | 2750 continue; |
2764 | 2751 |
2765 // Skip widgets in other processes. | 2752 // Skip widgets in other processes. |
2766 if (rvh->GetProcess()->GetID() != GetID()) | 2753 if (rvh->GetProcess()->GetID() != GetID()) |
2767 continue; | 2754 continue; |
2768 | 2755 |
2769 rvh->OnWebkitPreferencesChanged(); | 2756 rvh->OnWebkitPreferencesChanged(); |
2770 } | 2757 } |
2771 } | 2758 } |
2772 | 2759 |
2773 } // namespace content | 2760 } // namespace content |
OLD | NEW |