OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
6 #define CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
| 12 #include <string> |
12 | 13 |
13 #include "base/callback.h" | 14 #include "base/callback.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
16 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
17 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
18 #include "content/public/browser/media_observer.h" | 19 #include "content/public/browser/media_observer.h" |
19 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
20 #include "content/public/common/media_stream_request.h" | 21 #include "content/public/common/media_stream_request.h" |
21 | 22 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Helper to get the default devices which can be used by the media request. | 103 // Helper to get the default devices which can be used by the media request. |
103 // Uses the first available devices if the default devices are not available. | 104 // Uses the first available devices if the default devices are not available. |
104 // If the return list is empty, it means there is no available device on the | 105 // If the return list is empty, it means there is no available device on the |
105 // OS. | 106 // OS. |
106 // Called on the UI thread. | 107 // Called on the UI thread. |
107 void GetDefaultDevicesForProfile(Profile* profile, | 108 void GetDefaultDevicesForProfile(Profile* profile, |
108 bool audio, | 109 bool audio, |
109 bool video, | 110 bool video, |
110 content::MediaStreamDevices* devices); | 111 content::MediaStreamDevices* devices); |
111 | 112 |
| 113 // Helper to get default device IDs. If the returned value is an empty string, |
| 114 // it means that there is no default device for the given device |type|. The |
| 115 // only supported |type| values are content::MEDIA_DEVICE_AUDIO_CAPTURE and |
| 116 // content::MEDIA_DEVICE_VIDEO_CAPTURE. |
| 117 // Must be called on the UI thread. |
| 118 std::string GetDefaultDeviceIdForProfile(Profile* profile, |
| 119 content::MediaStreamType type); |
| 120 |
112 // Helpers for picking particular requested devices, identified by raw id. | 121 // Helpers for picking particular requested devices, identified by raw id. |
113 // If the device requested is not available it will return NULL. | 122 // If the device requested is not available it will return NULL. |
114 const content::MediaStreamDevice* | 123 const content::MediaStreamDevice* |
115 GetRequestedAudioDevice(const std::string& requested_audio_device_id); | 124 GetRequestedAudioDevice(const std::string& requested_audio_device_id); |
116 const content::MediaStreamDevice* | 125 const content::MediaStreamDevice* |
117 GetRequestedVideoDevice(const std::string& requested_video_device_id); | 126 GetRequestedVideoDevice(const std::string& requested_video_device_id); |
118 | 127 |
119 // Returns the first available audio or video device, or NULL if no devices | 128 // Returns the first available audio or video device, or NULL if no devices |
120 // are available. | 129 // are available. |
121 const content::MediaStreamDevice* GetFirstAvailableAudioDevice(); | 130 const content::MediaStreamDevice* GetFirstAvailableAudioDevice(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 206 |
198 std::unique_ptr<DesktopStreamsRegistry> desktop_streams_registry_; | 207 std::unique_ptr<DesktopStreamsRegistry> desktop_streams_registry_; |
199 | 208 |
200 // Handlers for processing media access requests. | 209 // Handlers for processing media access requests. |
201 ScopedVector<MediaAccessHandler> media_access_handlers_; | 210 ScopedVector<MediaAccessHandler> media_access_handlers_; |
202 | 211 |
203 DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesDispatcher); | 212 DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesDispatcher); |
204 }; | 213 }; |
205 | 214 |
206 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 215 #endif // CHROME_BROWSER_MEDIA_WEBRTC_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
OLD | NEW |