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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2380793002: Migrate MediaDevices.enumerateDevices to Mojo (Closed)
Patch Set: rebase Created 4 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/debug/dump_without_crashing.h" 12 #include "base/debug/dump_without_crashing.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
16 #include "base/process/kill.h" 16 #include "base/process/kill.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "content/browser/accessibility/accessibility_mode_helper.h" 19 #include "content/browser/accessibility/accessibility_mode_helper.h"
20 #include "content/browser/accessibility/ax_tree_id_registry.h" 20 #include "content/browser/accessibility/ax_tree_id_registry.h"
21 #include "content/browser/accessibility/browser_accessibility_manager.h" 21 #include "content/browser/accessibility/browser_accessibility_manager.h"
22 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 22 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
23 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" 23 #include "content/browser/bluetooth/web_bluetooth_service_impl.h"
24 #include "content/browser/browser_main_loop.h"
24 #include "content/browser/child_process_security_policy_impl.h" 25 #include "content/browser/child_process_security_policy_impl.h"
25 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 26 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
26 #include "content/browser/download/mhtml_generation_manager.h" 27 #include "content/browser/download/mhtml_generation_manager.h"
27 #include "content/browser/frame_host/cross_process_frame_connector.h" 28 #include "content/browser/frame_host/cross_process_frame_connector.h"
28 #include "content/browser/frame_host/debug_urls.h" 29 #include "content/browser/frame_host/debug_urls.h"
29 #include "content/browser/frame_host/frame_tree.h" 30 #include "content/browser/frame_host/frame_tree.h"
30 #include "content/browser/frame_host/frame_tree_node.h" 31 #include "content/browser/frame_host/frame_tree_node.h"
31 #include "content/browser/frame_host/navigation_entry_impl.h" 32 #include "content/browser/frame_host/navigation_entry_impl.h"
32 #include "content/browser/frame_host/navigation_handle_impl.h" 33 #include "content/browser/frame_host/navigation_handle_impl.h"
33 #include "content/browser/frame_host/navigation_request.h" 34 #include "content/browser/frame_host/navigation_request.h"
34 #include "content/browser/frame_host/navigator.h" 35 #include "content/browser/frame_host/navigator.h"
35 #include "content/browser/frame_host/navigator_impl.h" 36 #include "content/browser/frame_host/navigator_impl.h"
36 #include "content/browser/frame_host/render_frame_host_delegate.h" 37 #include "content/browser/frame_host/render_frame_host_delegate.h"
37 #include "content/browser/frame_host/render_frame_proxy_host.h" 38 #include "content/browser/frame_host/render_frame_proxy_host.h"
38 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 39 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
39 #include "content/browser/loader/resource_dispatcher_host_impl.h" 40 #include "content/browser/loader/resource_dispatcher_host_impl.h"
40 #include "content/browser/media/session/media_session_service_impl.h" 41 #include "content/browser/media/session/media_session_service_impl.h"
41 #include "content/browser/permissions/permission_service_context.h" 42 #include "content/browser/permissions/permission_service_context.h"
42 #include "content/browser/permissions/permission_service_impl.h" 43 #include "content/browser/permissions/permission_service_impl.h"
43 #include "content/browser/presentation/presentation_service_impl.h" 44 #include "content/browser/presentation/presentation_service_impl.h"
44 #include "content/browser/renderer_host/input/input_router_impl.h" 45 #include "content/browser/renderer_host/input/input_router_impl.h"
45 #include "content/browser/renderer_host/input/timeout_monitor.h" 46 #include "content/browser/renderer_host/input/timeout_monitor.h"
47 #include "content/browser/renderer_host/media/media_devices_dispatcher_host.h"
46 #include "content/browser/renderer_host/render_process_host_impl.h" 48 #include "content/browser/renderer_host/render_process_host_impl.h"
47 #include "content/browser/renderer_host/render_view_host_delegate.h" 49 #include "content/browser/renderer_host/render_view_host_delegate.h"
48 #include "content/browser/renderer_host/render_view_host_delegate_view.h" 50 #include "content/browser/renderer_host/render_view_host_delegate_view.h"
49 #include "content/browser/renderer_host/render_view_host_impl.h" 51 #include "content/browser/renderer_host/render_view_host_impl.h"
50 #include "content/browser/renderer_host/render_widget_host_delegate.h" 52 #include "content/browser/renderer_host/render_widget_host_delegate.h"
51 #include "content/browser/renderer_host/render_widget_host_impl.h" 53 #include "content/browser/renderer_host/render_widget_host_impl.h"
52 #include "content/browser/renderer_host/render_widget_host_view_base.h" 54 #include "content/browser/renderer_host/render_widget_host_view_base.h"
53 #include "content/browser/shared_worker/shared_worker_service_impl.h" 55 #include "content/browser/shared_worker/shared_worker_service_impl.h"
54 #include "content/browser/websockets/websocket_manager.h" 56 #include "content/browser/websockets/websocket_manager.h"
55 #include "content/browser/webui/web_ui_controller_factory_registry.h" 57 #include "content/browser/webui/web_ui_controller_factory_registry.h"
(...skipping 11 matching lines...) Expand all
67 #include "content/public/browser/ax_event_notification_details.h" 69 #include "content/public/browser/ax_event_notification_details.h"
68 #include "content/public/browser/browser_accessibility_state.h" 70 #include "content/public/browser/browser_accessibility_state.h"
69 #include "content/public/browser/browser_context.h" 71 #include "content/public/browser/browser_context.h"
70 #include "content/public/browser/browser_plugin_guest_manager.h" 72 #include "content/public/browser/browser_plugin_guest_manager.h"
71 #include "content/public/browser/browser_thread.h" 73 #include "content/public/browser/browser_thread.h"
72 #include "content/public/browser/content_browser_client.h" 74 #include "content/public/browser/content_browser_client.h"
73 #include "content/public/browser/permission_manager.h" 75 #include "content/public/browser/permission_manager.h"
74 #include "content/public/browser/permission_type.h" 76 #include "content/public/browser/permission_type.h"
75 #include "content/public/browser/render_process_host.h" 77 #include "content/public/browser/render_process_host.h"
76 #include "content/public/browser/render_widget_host_view.h" 78 #include "content/public/browser/render_widget_host_view.h"
79 #include "content/public/browser/resource_context.h"
77 #include "content/public/browser/storage_partition.h" 80 #include "content/public/browser/storage_partition.h"
78 #include "content/public/browser/stream_handle.h" 81 #include "content/public/browser/stream_handle.h"
79 #include "content/public/browser/user_metrics.h" 82 #include "content/public/browser/user_metrics.h"
80 #include "content/public/common/browser_side_navigation_policy.h" 83 #include "content/public/common/browser_side_navigation_policy.h"
81 #include "content/public/common/content_constants.h" 84 #include "content/public/common/content_constants.h"
82 #include "content/public/common/content_switches.h" 85 #include "content/public/common/content_switches.h"
83 #include "content/public/common/file_chooser_file_info.h" 86 #include "content/public/common/file_chooser_file_info.h"
84 #include "content/public/common/file_chooser_params.h" 87 #include "content/public/common/file_chooser_params.h"
85 #include "content/public/common/isolated_world_ids.h" 88 #include "content/public/common/isolated_world_ids.h"
86 #include "content/public/common/service_manager_connection.h" 89 #include "content/public/common/service_manager_connection.h"
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 GetInterfaceRegistry()->AddInterface<device::VRService>( 2205 GetInterfaceRegistry()->AddInterface<device::VRService>(
2203 base::Bind(&device::VRServiceImpl::BindRequest)); 2206 base::Bind(&device::VRServiceImpl::BindRequest));
2204 #endif 2207 #endif
2205 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2208 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2206 switches::kEnableGenericSensors)) { 2209 switches::kEnableGenericSensors)) {
2207 GetInterfaceRegistry()->AddInterface( 2210 GetInterfaceRegistry()->AddInterface(
2208 base::Bind(&device::SensorProviderImpl::Create), 2211 base::Bind(&device::SensorProviderImpl::Create),
2209 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); 2212 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
2210 } 2213 }
2211 2214
2215 #if defined(ENABLE_WEBRTC)
2216 // BrowserMainLoop::GetInstance() may be null on unit tests.
2217 if (BrowserMainLoop::GetInstance()) {
2218 // BrowserMainLoop, which owns MediaStreamManager, is alive for the lifetime
2219 // of Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(),
2220 // which shuts down Mojo). Hence, passing that MediaStreamManager instance
2221 // as a raw pointer here is safe.
2222 MediaStreamManager* media_stream_manager =
2223 BrowserMainLoop::GetInstance()->media_stream_manager();
2224 GetInterfaceRegistry()->AddInterface(
2225 base::Bind(&MediaDevicesDispatcherHost::Create, GetProcess()->GetID(),
2226 GetRoutingID(), GetProcess()
2227 ->GetBrowserContext()
2228 ->GetResourceContext()
2229 ->GetMediaDeviceIDSalt(),
2230 base::Unretained(media_stream_manager),
2231 base::CommandLine::ForCurrentProcess()->HasSwitch(
2232 switches::kUseFakeUIForMediaStream)),
2233 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
2234 }
2235 #endif
2236
2212 GetContentClient()->browser()->RegisterRenderFrameMojoInterfaces( 2237 GetContentClient()->browser()->RegisterRenderFrameMojoInterfaces(
2213 GetInterfaceRegistry(), this); 2238 GetInterfaceRegistry(), this);
2214 } 2239 }
2215 2240
2216 void RenderFrameHostImpl::ResetWaitingState() { 2241 void RenderFrameHostImpl::ResetWaitingState() {
2217 DCHECK(is_active()); 2242 DCHECK(is_active());
2218 2243
2219 // Whenever we reset the RFH state, we should not be waiting for beforeunload 2244 // Whenever we reset the RFH state, we should not be waiting for beforeunload
2220 // or close acks. We clear them here to be safe, since they can cause 2245 // or close acks. We clear them here to be safe, since they can cause
2221 // navigations to be ignored in OnDidCommitProvisionalLoad. 2246 // navigations to be ignored in OnDidCommitProvisionalLoad.
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 3139 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
3115 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 3140 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
3116 return web_bluetooth_service_.get(); 3141 return web_bluetooth_service_.get();
3117 } 3142 }
3118 3143
3119 void RenderFrameHostImpl::DeleteWebBluetoothService() { 3144 void RenderFrameHostImpl::DeleteWebBluetoothService() {
3120 web_bluetooth_service_.reset(); 3145 web_bluetooth_service_.reset();
3121 } 3146 }
3122 3147
3123 } // namespace content 3148 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bad_message.h ('k') | content/browser/renderer_host/media/media_devices_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698