| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 typedef std::map<MediaStreamType, MediaStreamDevices> MediaStreamDeviceMap; | 197 typedef std::map<MediaStreamType, MediaStreamDevices> MediaStreamDeviceMap; |
| 198 | 198 |
| 199 // Represents a request for media streams (audio/video). | 199 // Represents a request for media streams (audio/video). |
| 200 // TODO(vrk): Decouple MediaStreamDevice from this header file so that | 200 // TODO(vrk): Decouple MediaStreamDevice from this header file so that |
| 201 // media_stream_options.h no longer depends on this file. | 201 // media_stream_options.h no longer depends on this file. |
| 202 // TODO(vrk,justinlin,wjia): Figure out a way to share this code cleanly between | 202 // TODO(vrk,justinlin,wjia): Figure out a way to share this code cleanly between |
| 203 // vanilla WebRTC, Tab Capture, and Pepper Video Capture. Right now there is | 203 // vanilla WebRTC, Tab Capture, and Pepper Video Capture. Right now there is |
| 204 // Tab-only stuff and Pepper-only stuff being passed around to all clients, | 204 // Tab-only stuff and Pepper-only stuff being passed around to all clients, |
| 205 // which is icky. | 205 // which is icky. |
| 206 struct CONTENT_EXPORT MediaStreamRequest { | 206 struct CONTENT_EXPORT MediaStreamRequest { |
| 207 MediaStreamRequest( | 207 MediaStreamRequest(int render_process_id, |
| 208 int render_process_id, | 208 int render_frame_id, |
| 209 int render_frame_id, | 209 int page_request_id, |
| 210 int page_request_id, | 210 const GURL& security_origin, |
| 211 const GURL& security_origin, | 211 bool user_gesture, |
| 212 bool user_gesture, | 212 MediaStreamRequestType request_type, |
| 213 MediaStreamRequestType request_type, | 213 const std::string& requested_audio_device_id, |
| 214 const std::string& requested_audio_device_id, | 214 const std::string& requested_video_device_id, |
| 215 const std::string& requested_video_device_id, | 215 MediaStreamType audio_type, |
| 216 MediaStreamType audio_type, | 216 MediaStreamType video_type, |
| 217 MediaStreamType video_type); | 217 bool disable_local_echo); |
| 218 | 218 |
| 219 MediaStreamRequest(const MediaStreamRequest& other); | 219 MediaStreamRequest(const MediaStreamRequest& other); |
| 220 | 220 |
| 221 ~MediaStreamRequest(); | 221 ~MediaStreamRequest(); |
| 222 | 222 |
| 223 // This is the render process id for the renderer associated with generating | 223 // This is the render process id for the renderer associated with generating |
| 224 // frames for a MediaStream. Any indicators associated with a capture will be | 224 // frames for a MediaStream. Any indicators associated with a capture will be |
| 225 // displayed for this renderer. | 225 // displayed for this renderer. |
| 226 int render_process_id; | 226 int render_process_id; |
| 227 | 227 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 249 // Stores the requested raw device id for physical audio or video devices. | 249 // Stores the requested raw device id for physical audio or video devices. |
| 250 std::string requested_audio_device_id; | 250 std::string requested_audio_device_id; |
| 251 std::string requested_video_device_id; | 251 std::string requested_video_device_id; |
| 252 | 252 |
| 253 // Flag to indicate if the request contains audio. | 253 // Flag to indicate if the request contains audio. |
| 254 MediaStreamType audio_type; | 254 MediaStreamType audio_type; |
| 255 | 255 |
| 256 // Flag to indicate if the request contains video. | 256 // Flag to indicate if the request contains video. |
| 257 MediaStreamType video_type; | 257 MediaStreamType video_type; |
| 258 | 258 |
| 259 // Flag for desktop or tab share to indicate whether to prevent the captured |
| 260 // audio being played out locally. |
| 261 bool disable_local_echo; |
| 262 |
| 259 // True if all ancestors of the requesting frame have the same origin. | 263 // True if all ancestors of the requesting frame have the same origin. |
| 260 bool all_ancestors_have_same_origin; | 264 bool all_ancestors_have_same_origin; |
| 261 }; | 265 }; |
| 262 | 266 |
| 263 // Interface used by the content layer to notify chrome about changes in the | 267 // Interface used by the content layer to notify chrome about changes in the |
| 264 // state of a media stream. Instances of this class are passed to content layer | 268 // state of a media stream. Instances of this class are passed to content layer |
| 265 // when MediaStream access is approved using MediaResponseCallback. | 269 // when MediaStream access is approved using MediaResponseCallback. |
| 266 class MediaStreamUI { | 270 class MediaStreamUI { |
| 267 public: | 271 public: |
| 268 virtual ~MediaStreamUI() {} | 272 virtual ~MediaStreamUI() {} |
| 269 | 273 |
| 270 // Called when MediaStream capturing is started. Chrome layer can call |stop| | 274 // Called when MediaStream capturing is started. Chrome layer can call |stop| |
| 271 // to stop the stream. Returns the platform-dependent window ID for the UI, or | 275 // to stop the stream. Returns the platform-dependent window ID for the UI, or |
| 272 // 0 if not applicable. | 276 // 0 if not applicable. |
| 273 virtual gfx::NativeViewId OnStarted(const base::Closure& stop) = 0; | 277 virtual gfx::NativeViewId OnStarted(const base::Closure& stop) = 0; |
| 274 }; | 278 }; |
| 275 | 279 |
| 276 // Callback used return results of media access requests. | 280 // Callback used return results of media access requests. |
| 277 typedef base::Callback<void(const MediaStreamDevices& devices, | 281 typedef base::Callback<void(const MediaStreamDevices& devices, |
| 278 content::MediaStreamRequestResult result, | 282 content::MediaStreamRequestResult result, |
| 279 std::unique_ptr<MediaStreamUI> ui)> | 283 std::unique_ptr<MediaStreamUI> ui)> |
| 280 MediaResponseCallback; | 284 MediaResponseCallback; |
| 281 | 285 |
| 282 } // namespace content | 286 } // namespace content |
| 283 | 287 |
| 284 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ | 288 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ |
| OLD | NEW |