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 // MediaStreamManager is used to open/enumerate media capture devices (video | 5 // MediaStreamManager is used to open/enumerate media capture devices (video |
6 // supported now). Call flow: | 6 // supported now). Call flow: |
7 // 1. GenerateStream is called when a render process wants to use a capture | 7 // 1. GenerateStream is called when a render process wants to use a capture |
8 // device. | 8 // device. |
9 // 2. MediaStreamManager will ask MediaStreamDeviceSettings for permission to | 9 // 2. MediaStreamManager will ask MediaStreamDeviceSettings for permission to |
10 // use devices and for which device to use. | 10 // use devices and for which device to use. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 ~EnumerationCache(); | 179 ~EnumerationCache(); |
180 | 180 |
181 bool valid; | 181 bool valid; |
182 StreamDeviceInfoArray devices; | 182 StreamDeviceInfoArray devices; |
183 }; | 183 }; |
184 | 184 |
185 // Helpers for signaling the media observer that new capture devices are | 185 // Helpers for signaling the media observer that new capture devices are |
186 // opened/closed. | 186 // opened/closed. |
187 void NotifyObserverDevicesOpened(DeviceRequest* request); | 187 void NotifyObserverDevicesOpened(DeviceRequest* request); |
188 void NotifyObserverDevicesClosed(DeviceRequest* request); | 188 void NotifyObserverDevicesClosed(DeviceRequest* request); |
| 189 void NotifyObserverRequestStateChange(DeviceRequest* request, |
| 190 MediaStreamType media_type); |
189 void DevicesFromRequest(DeviceRequest* request, | 191 void DevicesFromRequest(DeviceRequest* request, |
190 content::MediaStreamDevices* devices); | 192 content::MediaStreamDevices* devices); |
191 | 193 |
192 // Helpers. | 194 // Helpers. |
193 bool RequestDone(const MediaStreamManager::DeviceRequest& request) const; | 195 bool RequestDone(const MediaStreamManager::DeviceRequest& request) const; |
194 MediaStreamProvider* GetDeviceManager(MediaStreamType stream_type); | 196 MediaStreamProvider* GetDeviceManager(MediaStreamType stream_type); |
195 void StartEnumeration(DeviceRequest* new_request, | 197 void StartEnumeration(DeviceRequest* new_request, |
196 std::string* label); | 198 std::string* label); |
197 void AddRequest(const DeviceRequest& new_request, std::string* label); | 199 void AddRequest(const DeviceRequest& new_request, std::string* label); |
198 bool HasEnumerationRequest(MediaStreamType type); | 200 bool HasEnumerationRequest(MediaStreamType type); |
199 bool HasEnumerationRequest(); | 201 bool HasEnumerationRequest(); |
200 void ClearEnumerationCache(EnumerationCache* cache); | 202 void ClearEnumerationCache(EnumerationCache* cache); |
| 203 void UpdateRequestState(DeviceRequest* device, |
| 204 MediaStreamType media_type, |
| 205 const content::MediaStreamRequest::RequestState); |
201 | 206 |
202 // Helper to create the device managers, if needed. Auto-starts the device | 207 // Helper to create the device managers, if needed. Auto-starts the device |
203 // thread and registers this as a listener with the device managers. | 208 // thread and registers this as a listener with the device managers. |
204 void EnsureDeviceManagersStarted(); | 209 void EnsureDeviceManagersStarted(); |
205 | 210 |
206 // Sends cached device list to a client corresponding to the request | 211 // Sends cached device list to a client corresponding to the request |
207 // identified by |label|. | 212 // identified by |label|. |
208 void SendCachedDeviceList(EnumerationCache* cache, const std::string& label); | 213 void SendCachedDeviceList(EnumerationCache* cache, const std::string& label); |
209 | 214 |
210 // Stop the request of enumerating devices indentified by |label|. | 215 // Stop the request of enumerating devices indentified by |label|. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 250 |
246 // Static members. | 251 // Static members. |
247 static bool always_use_fake_devices_; | 252 static bool always_use_fake_devices_; |
248 | 253 |
249 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 254 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
250 }; | 255 }; |
251 | 256 |
252 } // namespace media_stream | 257 } // namespace media_stream |
253 | 258 |
254 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 259 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |