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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 typedef std::map<MediaStreamType, MediaStreamDevices> MediaStreamDeviceMap; | 188 typedef std::map<MediaStreamType, MediaStreamDevices> MediaStreamDeviceMap; |
| 189 | 189 |
| 190 // Represents a request for media streams (audio/video). | 190 // Represents a request for media streams (audio/video). |
| 191 // TODO(vrk): Decouple MediaStreamDevice from this header file so that | 191 // TODO(vrk): Decouple MediaStreamDevice from this header file so that |
| 192 // media_stream_options.h no longer depends on this file. | 192 // media_stream_options.h no longer depends on this file. |
| 193 // TODO(vrk,justinlin,wjia): Figure out a way to share this code cleanly between | 193 // TODO(vrk,justinlin,wjia): Figure out a way to share this code cleanly between |
| 194 // vanilla WebRTC, Tab Capture, and Pepper Video Capture. Right now there is | 194 // vanilla WebRTC, Tab Capture, and Pepper Video Capture. Right now there is |
| 195 // Tab-only stuff and Pepper-only stuff being passed around to all clients, | 195 // Tab-only stuff and Pepper-only stuff being passed around to all clients, |
| 196 // which is icky. | 196 // which is icky. |
| 197 struct CONTENT_EXPORT MediaStreamRequest { | 197 struct CONTENT_EXPORT MediaStreamRequest { |
| 198 MediaStreamRequest( | 198 MediaStreamRequest(int render_process_id, |
| 199 int render_process_id, | 199 int render_frame_id, |
| 200 int render_frame_id, | 200 int page_request_id, |
| 201 int page_request_id, | 201 const GURL& security_origin, |
| 202 const GURL& security_origin, | 202 bool user_gesture, |
| 203 bool user_gesture, | 203 MediaStreamRequestType request_type, |
| 204 MediaStreamRequestType request_type, | 204 const std::string& requested_audio_device_id, |
| 205 const std::string& requested_audio_device_id, | 205 const std::string& requested_video_device_id, |
| 206 const std::string& requested_video_device_id, | 206 MediaStreamType audio_type, |
| 207 MediaStreamType audio_type, | 207 MediaStreamType video_type, |
| 208 MediaStreamType video_type); | 208 bool mute_source); |
|
miu
2016/09/07 21:10:03
Since the mute option is a part of the device ID,
qiangchen
2016/09/09 18:45:24
Ditto.
| |
| 209 | 209 |
| 210 MediaStreamRequest(const MediaStreamRequest& other); | 210 MediaStreamRequest(const MediaStreamRequest& other); |
| 211 | 211 |
| 212 ~MediaStreamRequest(); | 212 ~MediaStreamRequest(); |
| 213 | 213 |
| 214 // This is the render process id for the renderer associated with generating | 214 // This is the render process id for the renderer associated with generating |
| 215 // frames for a MediaStream. Any indicators associated with a capture will be | 215 // frames for a MediaStream. Any indicators associated with a capture will be |
| 216 // displayed for this renderer. | 216 // displayed for this renderer. |
| 217 int render_process_id; | 217 int render_process_id; |
| 218 | 218 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 240 // Stores the requested raw device id for physical audio or video devices. | 240 // Stores the requested raw device id for physical audio or video devices. |
| 241 std::string requested_audio_device_id; | 241 std::string requested_audio_device_id; |
| 242 std::string requested_video_device_id; | 242 std::string requested_video_device_id; |
| 243 | 243 |
| 244 // Flag to indicate if the request contains audio. | 244 // Flag to indicate if the request contains audio. |
| 245 MediaStreamType audio_type; | 245 MediaStreamType audio_type; |
| 246 | 246 |
| 247 // Flag to indicate if the request contains video. | 247 // Flag to indicate if the request contains video. |
| 248 MediaStreamType video_type; | 248 MediaStreamType video_type; |
| 249 | 249 |
| 250 // Flag for desktop share to indicate whether to mute the source audio during | |
| 251 // sharing. | |
| 252 bool mute_source; | |
| 253 | |
| 250 // True if all ancestors of the requesting frame have the same origin. | 254 // True if all ancestors of the requesting frame have the same origin. |
| 251 bool all_ancestors_have_same_origin; | 255 bool all_ancestors_have_same_origin; |
| 252 }; | 256 }; |
| 253 | 257 |
| 254 // Interface used by the content layer to notify chrome about changes in the | 258 // Interface used by the content layer to notify chrome about changes in the |
| 255 // state of a media stream. Instances of this class are passed to content layer | 259 // state of a media stream. Instances of this class are passed to content layer |
| 256 // when MediaStream access is approved using MediaResponseCallback. | 260 // when MediaStream access is approved using MediaResponseCallback. |
| 257 class MediaStreamUI { | 261 class MediaStreamUI { |
| 258 public: | 262 public: |
| 259 virtual ~MediaStreamUI() {} | 263 virtual ~MediaStreamUI() {} |
| 260 | 264 |
| 261 // Called when MediaStream capturing is started. Chrome layer can call |stop| | 265 // Called when MediaStream capturing is started. Chrome layer can call |stop| |
| 262 // to stop the stream. Returns the platform-dependent window ID for the UI, or | 266 // to stop the stream. Returns the platform-dependent window ID for the UI, or |
| 263 // 0 if not applicable. | 267 // 0 if not applicable. |
| 264 virtual gfx::NativeViewId OnStarted(const base::Closure& stop) = 0; | 268 virtual gfx::NativeViewId OnStarted(const base::Closure& stop) = 0; |
| 265 }; | 269 }; |
| 266 | 270 |
| 267 // Callback used return results of media access requests. | 271 // Callback used return results of media access requests. |
| 268 typedef base::Callback<void(const MediaStreamDevices& devices, | 272 typedef base::Callback<void(const MediaStreamDevices& devices, |
| 269 content::MediaStreamRequestResult result, | 273 content::MediaStreamRequestResult result, |
| 270 std::unique_ptr<MediaStreamUI> ui)> | 274 std::unique_ptr<MediaStreamUI> ui)> |
| 271 MediaResponseCallback; | 275 MediaResponseCallback; |
| 272 | 276 |
| 273 } // namespace content | 277 } // namespace content |
| 274 | 278 |
| 275 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ | 279 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ |
| OLD | NEW |