| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 media capture devices (video supported | 5 // MediaStreamManager is used to open media capture devices (video supported |
| 6 // now). Call flow: | 6 // 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 const std::string& security_origin, std::string* label); | 62 const std::string& security_origin, std::string* label); |
| 63 | 63 |
| 64 // Cancels all non-finished GenerateStream request, i.e. request for which | 64 // Cancels all non-finished GenerateStream request, i.e. request for which |
| 65 // StreamGenerated hasn't been called. | 65 // StreamGenerated hasn't been called. |
| 66 void CancelRequests(MediaStreamRequester* requester); | 66 void CancelRequests(MediaStreamRequester* requester); |
| 67 | 67 |
| 68 // Closes generated stream. | 68 // Closes generated stream. |
| 69 void StopGeneratedStream(const std::string& label); | 69 void StopGeneratedStream(const std::string& label); |
| 70 | 70 |
| 71 // Implements MediaStreamProviderListener. | 71 // Implements MediaStreamProviderListener. |
| 72 virtual void Opened(MediaStreamType stream_type, int capture_session_id); | 72 virtual void Opened(MediaStreamType stream_type, |
| 73 virtual void Closed(MediaStreamType stream_type, int capture_session_id); | 73 int capture_session_id) OVERRIDE; |
| 74 virtual void Closed(MediaStreamType stream_type, |
| 75 int capture_session_id) OVERRIDE; |
| 74 virtual void DevicesEnumerated(MediaStreamType stream_type, | 76 virtual void DevicesEnumerated(MediaStreamType stream_type, |
| 75 const StreamDeviceInfoArray& devices); | 77 const StreamDeviceInfoArray& devices) OVERRIDE; |
| 76 virtual void Error(MediaStreamType stream_type, int capture_session_id, | 78 virtual void Error(MediaStreamType stream_type, |
| 77 MediaStreamProviderError error); | 79 int capture_session_id, |
| 80 MediaStreamProviderError error) OVERRIDE; |
| 78 | 81 |
| 79 // Implements SettingsRequester. | 82 // Implements SettingsRequester. |
| 80 virtual void GetDevices(const std::string& label, | 83 virtual void GetDevices(const std::string& label, |
| 81 MediaStreamType stream_type); | 84 MediaStreamType stream_type) OVERRIDE; |
| 82 virtual void DevicesAccepted(const std::string& label, | 85 virtual void DevicesAccepted(const std::string& label, |
| 83 const StreamDeviceInfoArray& devices); | 86 const StreamDeviceInfoArray& devices) OVERRIDE; |
| 84 virtual void SettingsError(const std::string& label); | 87 virtual void SettingsError(const std::string& label) OVERRIDE; |
| 85 | 88 |
| 86 // Used by unit test to make sure fake devices are used instead of a real | 89 // Used by unit test to make sure fake devices are used instead of a real |
| 87 // devices, which is needed for server based testing. | 90 // devices, which is needed for server based testing. |
| 88 void UseFakeDevice(); | 91 void UseFakeDevice(); |
| 89 | 92 |
| 90 private: | 93 private: |
| 91 // Contains all data needed to keep track of requests. | 94 // Contains all data needed to keep track of requests. |
| 92 struct DeviceRequest; | 95 struct DeviceRequest; |
| 93 | 96 |
| 94 // Helpers. | 97 // Helpers. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 106 // All non-closed request. | 109 // All non-closed request. |
| 107 typedef std::map<std::string, DeviceRequest> DeviceRequests; | 110 typedef std::map<std::string, DeviceRequest> DeviceRequests; |
| 108 DeviceRequests requests_; | 111 DeviceRequests requests_; |
| 109 | 112 |
| 110 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 113 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
| 111 }; | 114 }; |
| 112 | 115 |
| 113 } // namespace media_stream | 116 } // namespace media_stream |
| 114 | 117 |
| 115 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 118 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
| OLD | NEW |