Chromium Code Reviews| 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 CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ | 6 #define CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 MEDIA_DEVICE_AUDIO_CAPTURE, | 23 MEDIA_DEVICE_AUDIO_CAPTURE, |
| 24 MEDIA_DEVICE_VIDEO_CAPTURE, | 24 MEDIA_DEVICE_VIDEO_CAPTURE, |
| 25 | 25 |
| 26 // Mirroring of a browser tab. | 26 // Mirroring of a browser tab. |
| 27 MEDIA_TAB_AUDIO_CAPTURE, | 27 MEDIA_TAB_AUDIO_CAPTURE, |
| 28 MEDIA_TAB_VIDEO_CAPTURE, | 28 MEDIA_TAB_VIDEO_CAPTURE, |
| 29 | 29 |
| 30 NUM_MEDIA_TYPES | 30 NUM_MEDIA_TYPES |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 enum MediaStreamRequestType { | |
| 34 MEDIA_DEVICE_ACCESS = 0, | |
| 35 MEDIA_GENERATE_STREAM, | |
| 36 MEDIA_ENUMERATE_DEVICES, | |
| 37 MEDIA_OPEN_DEVICE | |
| 38 }; | |
| 39 | |
| 33 // Convenience predicates to determine whether the given type represents some | 40 // Convenience predicates to determine whether the given type represents some |
| 34 // audio or some video device. | 41 // audio or some video device. |
| 35 CONTENT_EXPORT bool IsAudioMediaType(MediaStreamDeviceType type); | 42 CONTENT_EXPORT bool IsAudioMediaType(MediaStreamDeviceType type); |
| 36 CONTENT_EXPORT bool IsVideoMediaType(MediaStreamDeviceType type); | 43 CONTENT_EXPORT bool IsVideoMediaType(MediaStreamDeviceType type); |
| 37 | 44 |
| 38 // TODO(xians): Change the structs to classes. | 45 // TODO(xians): Change the structs to classes. |
| 39 // Represents one device in a request for media stream(s). | 46 // Represents one device in a request for media stream(s). |
| 40 struct CONTENT_EXPORT MediaStreamDevice { | 47 struct CONTENT_EXPORT MediaStreamDevice { |
| 41 MediaStreamDevice( | 48 MediaStreamDevice( |
| 42 MediaStreamDeviceType type, | 49 MediaStreamDeviceType type, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 58 typedef std::vector<MediaStreamDevice> MediaStreamDevices; | 65 typedef std::vector<MediaStreamDevice> MediaStreamDevices; |
| 59 | 66 |
| 60 typedef std::map<MediaStreamDeviceType, MediaStreamDevices> | 67 typedef std::map<MediaStreamDeviceType, MediaStreamDevices> |
| 61 MediaStreamDeviceMap; | 68 MediaStreamDeviceMap; |
| 62 | 69 |
| 63 // Represents a request for media streams (audio/video). | 70 // Represents a request for media streams (audio/video). |
| 64 struct CONTENT_EXPORT MediaStreamRequest { | 71 struct CONTENT_EXPORT MediaStreamRequest { |
| 65 MediaStreamRequest( | 72 MediaStreamRequest( |
| 66 int render_process_id, | 73 int render_process_id, |
| 67 int render_view_id, | 74 int render_view_id, |
| 68 const GURL& security_origin); | 75 const GURL& security_origin, |
| 76 MediaStreamRequestType request_type); | |
| 69 | 77 |
| 70 ~MediaStreamRequest(); | 78 ~MediaStreamRequest(); |
| 71 | 79 |
| 72 // The render process id generating this request. | 80 // The render process id generating this request. |
| 73 int render_process_id; | 81 int render_process_id; |
| 74 | 82 |
| 75 // The render view id generating this request. | 83 // The render view id generating this request. |
| 76 int render_view_id; | 84 int render_view_id; |
| 77 | 85 |
| 78 // The WebKit security origin for the current request (e.g. "html5rocks.com"). | 86 // The WebKit security origin for the current request (e.g. "html5rocks.com"). |
| 79 GURL security_origin; | 87 GURL security_origin; |
| 80 | 88 |
| 89 // Whether the request should be verified against the rules for denial only or | |
|
Jói
2012/12/12 14:18:18
It's not clear here what happens for each of the d
pastarmovj
2012/12/12 14:52:52
Done.
| |
| 90 // whether the user should be explicitly asked for permission too. | |
| 91 MediaStreamRequestType request_type; | |
| 92 | |
| 81 // A list of devices present on the user's computer, for each device type | 93 // A list of devices present on the user's computer, for each device type |
| 82 // requested. | 94 // requested. |
| 83 // All the elements in this map will be deleted in ~MediaStreamRequest(). | 95 // All the elements in this map will be deleted in ~MediaStreamRequest(). |
| 84 MediaStreamDeviceMap devices; | 96 MediaStreamDeviceMap devices; |
| 85 }; | 97 }; |
| 86 | 98 |
| 87 } // namespace content | 99 } // namespace content |
| 88 | 100 |
| 89 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ | 101 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ |
| OLD | NEW |