summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/media/media_capture_devices_impl.h
diff options
context:
space:
mode:
authormichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 21:09:37 +0000
committermichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 21:09:37 +0000
commit060ffdbd222874de5208580d4a1e33e021a34375 (patch)
tree02a3431ec33936b956f19de149740d70fd4b04ef /content/browser/renderer_host/media/media_capture_devices_impl.h
parent29957af3773acac8b16aa37d33d4bde727a32a21 (diff)
downloadchromium_src-060ffdbd222874de5208580d4a1e33e021a34375.zip
chromium_src-060ffdbd222874de5208580d4a1e33e021a34375.tar.gz
chromium_src-060ffdbd222874de5208580d4a1e33e021a34375.tar.bz2
Implement MediaCaptureDevices.
- Added MediaCaptureDevices to cache the MediaCaptureDevice in content layer. - Removed the correspoding methods in MediaObserver. - Removed the MediaDevicesMonitor APIs. BUG=348867 TBR=mnissler Review URL: https://codereview.chromium.org/183743021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257198 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/media/media_capture_devices_impl.h')
-rw-r--r--content/browser/renderer_host/media/media_capture_devices_impl.h49
1 files changed, 49 insertions, 0 deletions
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 0000000..078f659
--- /dev/null
+++ b/content/browser/renderer_host/media/media_capture_devices_impl.h
@@ -0,0 +1,49 @@
+// Copyright 2014 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.
+
+#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 "content/public/browser/media_capture_devices.h"
+
+namespace content {
+
+class MediaCaptureDevicesImpl : public MediaCaptureDevices {
+ public:
+ static MediaCaptureDevicesImpl* GetInstance();
+
+ // 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();
+
+ 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