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 // Types of media stream requests that can be made to the media controller. | |
34 enum MediaStreamRequestType { | |
35 MEDIA_DEVICE_ACCESS = 0, | |
36 MEDIA_GENERATE_STREAM, | |
37 MEDIA_ENUMERATE_DEVICES, | |
38 MEDIA_OPEN_DEVICE | |
39 }; | |
40 | |
33 // Convenience predicates to determine whether the given type represents some | 41 // Convenience predicates to determine whether the given type represents some |
34 // audio or some video device. | 42 // audio or some video device. |
35 CONTENT_EXPORT bool IsAudioMediaType(MediaStreamDeviceType type); | 43 CONTENT_EXPORT bool IsAudioMediaType(MediaStreamDeviceType type); |
36 CONTENT_EXPORT bool IsVideoMediaType(MediaStreamDeviceType type); | 44 CONTENT_EXPORT bool IsVideoMediaType(MediaStreamDeviceType type); |
37 | 45 |
38 // TODO(xians): Change the structs to classes. | 46 // TODO(xians): Change the structs to classes. |
39 // Represents one device in a request for media stream(s). | 47 // Represents one device in a request for media stream(s). |
40 struct CONTENT_EXPORT MediaStreamDevice { | 48 struct CONTENT_EXPORT MediaStreamDevice { |
41 MediaStreamDevice( | 49 MediaStreamDevice( |
42 MediaStreamDeviceType type, | 50 MediaStreamDeviceType type, |
(...skipping 15 matching lines...) Expand all Loading... | |
58 typedef std::vector<MediaStreamDevice> MediaStreamDevices; | 66 typedef std::vector<MediaStreamDevice> MediaStreamDevices; |
59 | 67 |
60 typedef std::map<MediaStreamDeviceType, MediaStreamDevices> | 68 typedef std::map<MediaStreamDeviceType, MediaStreamDevices> |
61 MediaStreamDeviceMap; | 69 MediaStreamDeviceMap; |
62 | 70 |
63 // Represents a request for media streams (audio/video). | 71 // Represents a request for media streams (audio/video). |
64 struct CONTENT_EXPORT MediaStreamRequest { | 72 struct CONTENT_EXPORT MediaStreamRequest { |
65 MediaStreamRequest( | 73 MediaStreamRequest( |
66 int render_process_id, | 74 int render_process_id, |
67 int render_view_id, | 75 int render_view_id, |
68 const GURL& security_origin); | 76 const GURL& security_origin, |
77 MediaStreamRequestType request_type); | |
69 | 78 |
70 ~MediaStreamRequest(); | 79 ~MediaStreamRequest(); |
71 | 80 |
72 // The render process id generating this request. | 81 // The render process id generating this request. |
73 int render_process_id; | 82 int render_process_id; |
74 | 83 |
75 // The render view id generating this request. | 84 // The render view id generating this request. |
76 int render_view_id; | 85 int render_view_id; |
77 | 86 |
78 // The WebKit security origin for the current request (e.g. "html5rocks.com"). | 87 // The WebKit security origin for the current request (e.g. "html5rocks.com"). |
79 GURL security_origin; | 88 GURL security_origin; |
80 | 89 |
90 // Stores the type of request that was made to the media controller. Right now | |
91 // this is only used to destinguish between WebRTC and Pepper requests, as the | |
92 // later should not be subject to user approval but only to policy check. | |
Jói
2012/12/12 14:58:12
later -> latter
| |
93 // Pepper requests are signified by the |MEDIA_OPEN_DEVICE| value. | |
94 MediaStreamRequestType request_type; | |
95 | |
81 // A list of devices present on the user's computer, for each device type | 96 // A list of devices present on the user's computer, for each device type |
82 // requested. | 97 // requested. |
83 // All the elements in this map will be deleted in ~MediaStreamRequest(). | 98 // All the elements in this map will be deleted in ~MediaStreamRequest(). |
84 MediaStreamDeviceMap devices; | 99 MediaStreamDeviceMap devices; |
85 }; | 100 }; |
86 | 101 |
87 } // namespace content | 102 } // namespace content |
88 | 103 |
89 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ | 104 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ |
OLD | NEW |