1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_CAPTURE_DEVICES_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_CAPTURE_DEVICES_IMPL_H_
8 #include "base/memory/singleton.h"
9 #include "content/public/browser/media_capture_devices.h"
13 class MediaCaptureDevicesImpl
: public MediaCaptureDevices
{
15 static MediaCaptureDevicesImpl
* GetInstance();
17 // Overriden from MediaCaptureDevices
18 const MediaStreamDevices
& GetAudioCaptureDevices() override
;
19 const MediaStreamDevices
& GetVideoCaptureDevices() override
;
21 // Called by MediaStreamManager to notify the change of media capture
22 // devices, these 2 methods are called in IO thread.
23 void OnAudioCaptureDevicesChanged(const MediaStreamDevices
& devices
);
24 void OnVideoCaptureDevicesChanged(const MediaStreamDevices
& devices
);
27 friend struct DefaultSingletonTraits
<MediaCaptureDevicesImpl
>;
28 MediaCaptureDevicesImpl();
29 ~MediaCaptureDevicesImpl() override
;
31 void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices
& devices
);
32 void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices
& devices
);
34 // Flag to indicate if device enumeration has been done/doing.
35 // Only accessed on UI thread.
36 bool devices_enumerated_
;
38 // A list of cached audio capture devices.
39 MediaStreamDevices audio_devices_
;
41 // A list of cached video capture devices.
42 MediaStreamDevices video_devices_
;
44 DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesImpl
);
47 } // namespace content
49 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_CAPTURE_DEVICES_IMPL_H_