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

Unified Diff: content/browser/renderer_host/media/media_capture_devices_impl.h

Issue 183743021: Implement MediaCaptureDevices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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/renderer_host/media/media_capture_devices_impl.h
diff --git a/content/browser/renderer_host/media/media_capture_devices_impl.h b/content/browser/renderer_host/media/media_capture_devices_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..b16a6efd0ed27d13bdb82e5006fbab0961d0823c
--- /dev/null
+++ b/content/browser/renderer_host/media/media_capture_devices_impl.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
Sergey Ulanov 2014/03/06 08:26:40 nit: don't need (c)
michaelbai 2014/03/06 19:27:20 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_CAPTURE_DEVICES_H
+#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_CAPTURE_DEVICES_H
+
+#include "base/memory/singleton.h"
+#include "base/observer_list.h"
Sergey Ulanov 2014/03/06 08:26:40 this header is not used.
michaelbai 2014/03/06 19:27:20 Done.
+#include "content/public/browser/media_capture_devices.h"
+#include "content/public/browser/media_observer.h"
+
+namespace content {
+
+class MediaCaptureDevicesImpl : public MediaCaptureDevices {
+ public:
+ static MediaCaptureDevicesImpl* GetInstance();
Sergey Ulanov 2014/03/06 08:26:40 Is this necessary, given that there is MediaCaptur
michaelbai 2014/03/06 19:27:20 Yes, it is required by Singleton<> implementation.
+
+ // Overriden from MediaCaptureDevices
+ virtual const MediaStreamDevices& GetAudioCaptureDevices() OVERRIDE;
+ virtual const MediaStreamDevices& GetVideoCaptureDevices() OVERRIDE;
+
+ // Called by MediaStreamManager to notify the change of media capture
+ // devices, these 2 methods are called in IO thread.
+ void OnAudioCaptureDevicesChanged(const MediaStreamDevices& devices);
+ void OnVideoCaptureDevicesChanged(const MediaStreamDevices& devices);
+
+ private:
+ friend struct DefaultSingletonTraits<MediaCaptureDevicesImpl>;
+ MediaCaptureDevicesImpl();
+ virtual ~MediaCaptureDevicesImpl();
+
+ // Called by the MediaObserver() functions, executed on UI thread.
+ void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices);
+ void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices);
+
+ // Flag to indicate if device enumeration has been done/doing.
+ // Only accessed on UI thread.
+ bool devices_enumerated_;
+
+ // A list of cached audio capture devices.
+ MediaStreamDevices audio_devices_;
+
+ // A list of cached video capture devices.
+ MediaStreamDevices video_devices_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_CAPTURE_DEVICES_H

Powered by Google App Engine
This is Rietveld 408576698