From 060ffdbd222874de5208580d4a1e33e021a34375 Mon Sep 17 00:00:00 2001 From: "michaelbai@chromium.org" Date: Fri, 14 Mar 2014 21:09:37 +0000 Subject: 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 --- .../media/media_capture_devices_impl.h | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 content/browser/renderer_host/media/media_capture_devices_impl.h (limited to '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 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(); + 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 -- cgit v1.1