Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: content/public/common/media_stream_request.h

Issue 11446042: Make sure that all OpenDevice requests are scrutinized against the audio and video policies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased again... Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 16 matching lines...) Expand all
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 MediaStreamDeviceType audio_type, 78 MediaStreamDeviceType audio_type,
70 MediaStreamDeviceType video_type); 79 MediaStreamDeviceType video_type);
71 80
72 ~MediaStreamRequest(); 81 ~MediaStreamRequest();
73 82
74 // The render process id generating this request. 83 // The render process id generating this request.
75 int render_process_id; 84 int render_process_id;
76 85
77 // The render view id generating this request. 86 // The render view id generating this request.
78 int render_view_id; 87 int render_view_id;
79 88
80 // The WebKit security origin for the current request (e.g. "html5rocks.com"). 89 // The WebKit security origin for the current request (e.g. "html5rocks.com").
81 GURL security_origin; 90 GURL security_origin;
82 91
92 // Stores the type of request that was made to the media controller. Right now
93 // this is only used to destinguish between WebRTC and Pepper requests, as the
94 // latter should not be subject to user approval but only to policy check.
95 // Pepper requests are signified by the |MEDIA_OPEN_DEVICE| value.
96 MediaStreamRequestType request_type;
97
83 // Flag to indicate if the request contains audio. 98 // Flag to indicate if the request contains audio.
84 MediaStreamDeviceType audio_type; 99 MediaStreamDeviceType audio_type;
85 100
86 // Flag to indicate if the request contains video. 101 // Flag to indicate if the request contains video.
87 MediaStreamDeviceType video_type; 102 MediaStreamDeviceType video_type;
88 }; 103 };
89 104
90 } // namespace content 105 } // namespace content
91 106
92 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ 107 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698