OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CONTENT_PUBLIC_BROWSER_MEDIA_CAPTURE_DEVICES_H_ | |
6 #define CONTENT_PUBLIC_BROWSER_MEDIA_CAPTURE_DEVICES_H_ | |
7 | |
8 #include "content/public/common/media_stream_request.h" | |
9 | |
10 namespace content { | |
11 | |
12 // This is a singleton class, used to get Audio/Video devices, it also provides | |
13 // observer interface to notify the change of devices. | |
14 CONTENT_EXPORT class MediaCaptureDevices { | |
15 public: | |
16 class Observer { | |
jam
2014/03/05 08:45:04
i probably wasn't clear in the email thread, sorry
michaelbai
2014/03/05 21:55:46
Done.
| |
17 public: | |
18 // Handle an information update consisting of a up-to-date audio capture | |
19 // device lists. This happens when a microphone is plugged in or unplugged. | |
20 virtual void OnUpdateAudioDevices( | |
21 const content::MediaStreamDevices& devices) {} | |
22 | |
23 // Handle an information update consisting of a up-to-date video capture | |
24 // device lists. This happens when a camera is plugged in or unplugged. | |
25 virtual void OnUpdateVideoDevices( | |
26 const content::MediaStreamDevices& devices) {} | |
27 | |
28 virtual ~Observer() {} | |
29 }; | |
30 | |
31 // Get signleton instance of MediaCaptureDevices. | |
32 static MediaCaptureDevices* GetInstance(); | |
33 | |
34 // Add/Remove Observer must be called on UI thread. | |
35 virtual void AddObserver(Observer* observer) = 0; | |
36 virtual void RemoveObserver(Observer* observer) = 0; | |
37 | |
38 // Return all Audio/Video devices. | |
39 virtual const MediaStreamDevices& GetAudioCaptureDevices() = 0; | |
40 virtual const MediaStreamDevices& GetVideoCaptureDevices() = 0; | |
41 | |
42 // Only for testing, should be called in IO thread. | |
43 virtual void SetAudioCaptureDevices(const MediaStreamDevices& devices) = 0; | |
jam
2014/03/05 08:45:04
these test methods are called by chrome to fake th
michaelbai
2014/03/05 21:55:46
Done.
| |
44 virtual void SetVideoCaptureDevices(const MediaStreamDevices& devices) = 0; | |
45 // Unittests that do not require actual device enumeration should call this | |
46 // API on the singleton. It is safe to call this multiple times on the | |
47 // signleton. | |
48 virtual void DisableDeviceEnumerationForTesting() = 0; | |
49 | |
50 private: | |
51 // This interface should only be implemented inside content. | |
52 friend class MediaCaptureDevicesImpl; | |
53 MediaCaptureDevices() {} | |
54 virtual ~MediaCaptureDevices() {} | |
55 }; | |
56 | |
57 } // namespace content | |
58 | |
59 #endif // CONTENT_PUBLIC_BROWSER_MEDIA_CAPTURE_DEVICES_H_ | |
OLD | NEW |