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_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
6 #define CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 6 #define CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // Helper for picking the device that was requested for an OpenDevice request. | 85 // Helper for picking the device that was requested for an OpenDevice request. |
86 // If the device requested is not available it will revert to using the first | 86 // If the device requested is not available it will revert to using the first |
87 // available one instead or will return an empty list if no devices of the | 87 // available one instead or will return an empty list if no devices of the |
88 // requested kind are present. | 88 // requested kind are present. |
89 void GetRequestedDevice(const std::string& requested_device_id, | 89 void GetRequestedDevice(const std::string& requested_device_id, |
90 bool audio, | 90 bool audio, |
91 bool video, | 91 bool video, |
92 content::MediaStreamDevices* devices); | 92 content::MediaStreamDevices* devices); |
93 | 93 |
| 94 // Unittests that do not require actual device enumeration should call this |
| 95 // API on the singleton. It is safe to call this multiple times on the |
| 96 // signleton. |
| 97 void DisableDeviceEnumerationForTesting(); |
| 98 |
94 // Overridden from content::MediaObserver: | 99 // Overridden from content::MediaObserver: |
95 virtual void OnAudioCaptureDevicesChanged( | 100 virtual void OnAudioCaptureDevicesChanged( |
96 const content::MediaStreamDevices& devices) OVERRIDE; | 101 const content::MediaStreamDevices& devices) OVERRIDE; |
97 virtual void OnVideoCaptureDevicesChanged( | 102 virtual void OnVideoCaptureDevicesChanged( |
98 const content::MediaStreamDevices& devices) OVERRIDE; | 103 const content::MediaStreamDevices& devices) OVERRIDE; |
99 virtual void OnMediaRequestStateChanged( | 104 virtual void OnMediaRequestStateChanged( |
100 int render_process_id, | 105 int render_process_id, |
101 int render_view_id, | 106 int render_view_id, |
102 const content::MediaStreamDevice& device, | 107 const content::MediaStreamDevice& device, |
103 content::MediaRequestState state) OVERRIDE; | 108 content::MediaRequestState state) OVERRIDE; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // A list of cached video capture devices. | 148 // A list of cached video capture devices. |
144 content::MediaStreamDevices video_devices_; | 149 content::MediaStreamDevices video_devices_; |
145 | 150 |
146 // A list of observers for the device update notifications. | 151 // A list of observers for the device update notifications. |
147 ObserverList<Observer> observers_; | 152 ObserverList<Observer> observers_; |
148 | 153 |
149 // Flag to indicate if device enumeration has been done/doing. | 154 // Flag to indicate if device enumeration has been done/doing. |
150 // Only accessed on UI thread. | 155 // Only accessed on UI thread. |
151 bool devices_enumerated_; | 156 bool devices_enumerated_; |
152 | 157 |
| 158 // Flag used by unittests to disable device enumeration. |
| 159 bool is_device_enumeration_disabled_; |
| 160 |
153 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; | 161 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; |
154 | 162 |
155 scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; | 163 scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; |
156 }; | 164 }; |
157 | 165 |
158 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 166 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
OLD | NEW |