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

Unified Diff: content/renderer/media/media_devices_listener_impl.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month 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/renderer/media/media_devices_listener_impl.cc
diff --git a/content/renderer/media/media_devices_listener_impl.cc b/content/renderer/media/media_devices_listener_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..858803645cc4068f3359ea89f11b549933f4d340
--- /dev/null
+++ b/content/renderer/media/media_devices_listener_impl.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/media/media_devices_listener_impl.h"
+
+#include <utility>
+
+#include "base/memory/ptr_util.h"
+#include "content/public/renderer/render_frame.h"
+#include "content/renderer/media/media_devices_event_dispatcher.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
+namespace content {
+
+// static
+void MediaDevicesListenerImpl::Create(
+ int render_frame_id,
+ ::mojom::MediaDevicesListenerRequest request) {
+ mojo::MakeStrongBinding(
+ base::MakeUnique<MediaDevicesListenerImpl>(render_frame_id),
+ std::move(request));
+}
+
+MediaDevicesListenerImpl::MediaDevicesListenerImpl(int render_frame_id)
+ : render_frame_id_(render_frame_id) {}
+
+MediaDevicesListenerImpl::~MediaDevicesListenerImpl() = default;
+
+void MediaDevicesListenerImpl::OnDevicesChanged(
+ MediaDeviceType type,
+ uint32_t subscription_id,
+ const MediaDeviceInfoArray& device_infos) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ base::WeakPtr<MediaDevicesEventDispatcher> event_dispatcher =
+ MediaDevicesEventDispatcher::GetForRenderFrame(
+ RenderFrame::FromRoutingID(render_frame_id_));
+ if (event_dispatcher)
+ event_dispatcher->DispatchDevicesChangedEvent(type, device_infos);
+}
+
+} // namespace content
« no previous file with comments | « content/renderer/media/media_devices_listener_impl.h ('k') | content/renderer/media/user_media_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698