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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2380793002: Migrate MediaDevices.enumerateDevices to Mojo (Closed)
Patch Set: rebase, hta@ comments, fix tests, histograms.xml 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 865c2d937048285bfed1dabbb18b01306a388e9f..6d829c24772ea802b34334f194fb48d8aad39e26 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -20,6 +20,7 @@
#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h"
#include "content/browser/bluetooth/web_bluetooth_service_impl.h"
+#include "content/browser/browser_main_loop.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/download/mhtml_generation_manager.h"
@@ -43,6 +44,7 @@
#include "content/browser/presentation/presentation_service_impl.h"
#include "content/browser/renderer_host/input/input_router_impl.h"
#include "content/browser/renderer_host/input/timeout_monitor.h"
+#include "content/browser/renderer_host/media/media_devices_dispatcher_host.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_delegate_view.h"
@@ -74,6 +76,7 @@
#include "content/public/browser/permission_type.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
+#include "content/public/browser/resource_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/stream_handle.h"
#include "content/public/browser/user_metrics.h"
@@ -2216,6 +2219,24 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() {
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
}
+#if defined(ENABLE_WEBRTC)
+ // BrowserMainLoop::GetInstance() may be null on unit tests.
dcheng 2016/10/10 17:51:52 Out of curiosity, which unit tests does this trip
+ if (BrowserMainLoop::GetInstance()) {
+ MediaStreamManager* media_stream_manager =
+ BrowserMainLoop::GetInstance()->media_stream_manager();
+ GetInterfaceRegistry()->AddInterface(
+ base::Bind(&MediaDevicesDispatcherHost::Create, GetProcess()->GetID(),
+ GetRoutingID(), GetProcess()
+ ->GetBrowserContext()
+ ->GetResourceContext()
+ ->GetMediaDeviceIDSalt(),
+ base::Unretained(media_stream_manager),
alexmos 2016/10/10 17:56:13 Can you please explain (and add a comment about) w
Guido Urdaneta 2016/10/10 18:34:42 Done.
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUseFakeUIForMediaStream)),
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
+ }
+#endif
+
GetContentClient()->browser()->RegisterRenderFrameMojoInterfaces(
GetInterfaceRegistry(), this);
}

Powered by Google App Engine
This is Rietveld 408576698