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

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

Issue 795703003: Don't auto allow access to media devices unless a the security origin of the requester is the same … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win compile. Created 5 years, 11 months 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
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // media_stream_options.h no longer depends on this file. 187 // media_stream_options.h no longer depends on this file.
188 // TODO(vrk,justinlin,wjia): Figure out a way to share this code cleanly between 188 // TODO(vrk,justinlin,wjia): Figure out a way to share this code cleanly between
189 // vanilla WebRTC, Tab Capture, and Pepper Video Capture. Right now there is 189 // vanilla WebRTC, Tab Capture, and Pepper Video Capture. Right now there is
190 // Tab-only stuff and Pepper-only stuff being passed around to all clients, 190 // Tab-only stuff and Pepper-only stuff being passed around to all clients,
191 // which is icky. 191 // which is icky.
192 struct CONTENT_EXPORT MediaStreamRequest { 192 struct CONTENT_EXPORT MediaStreamRequest {
193 MediaStreamRequest( 193 MediaStreamRequest(
194 int render_process_id, 194 int render_process_id,
195 int render_frame_id, 195 int render_frame_id,
196 int page_request_id, 196 int page_request_id,
197 const std::string& tab_capture_device_id,
197 const GURL& security_origin, 198 const GURL& security_origin,
198 bool user_gesture, 199 bool user_gesture,
199 MediaStreamRequestType request_type, 200 MediaStreamRequestType request_type,
200 const std::string& requested_audio_device_id, 201 const std::string& requested_audio_device_id,
201 const std::string& requested_video_device_id, 202 const std::string& requested_video_device_id,
202 MediaStreamType audio_type, 203 MediaStreamType audio_type,
203 MediaStreamType video_type); 204 MediaStreamType video_type);
204 205
205 ~MediaStreamRequest(); 206 ~MediaStreamRequest();
206 207
(...skipping 28 matching lines...) Expand all
235 236
236 // Stores the requested raw device id for physical audio or video devices. 237 // Stores the requested raw device id for physical audio or video devices.
237 std::string requested_audio_device_id; 238 std::string requested_audio_device_id;
238 std::string requested_video_device_id; 239 std::string requested_video_device_id;
239 240
240 // Flag to indicate if the request contains audio. 241 // Flag to indicate if the request contains audio.
241 MediaStreamType audio_type; 242 MediaStreamType audio_type;
242 243
243 // Flag to indicate if the request contains video. 244 // Flag to indicate if the request contains video.
244 MediaStreamType video_type; 245 MediaStreamType video_type;
246
247 // True if all ancestors of the requesting frame have the same origin.
248 bool all_ancestors_have_same_origin;
245 }; 249 };
246 250
247 // Interface used by the content layer to notify chrome about changes in the 251 // Interface used by the content layer to notify chrome about changes in the
248 // state of a media stream. Instances of this class are passed to content layer 252 // state of a media stream. Instances of this class are passed to content layer
249 // when MediaStream access is approved using MediaResponseCallback. 253 // when MediaStream access is approved using MediaResponseCallback.
250 class MediaStreamUI { 254 class MediaStreamUI {
251 public: 255 public:
252 virtual ~MediaStreamUI() {} 256 virtual ~MediaStreamUI() {}
253 257
254 // Called when MediaStream capturing is started. Chrome layer can call |stop| 258 // Called when MediaStream capturing is started. Chrome layer can call |stop|
255 // to stop the stream. Returns the platform-dependent window ID for the UI, or 259 // to stop the stream. Returns the platform-dependent window ID for the UI, or
256 // 0 if not applicable. 260 // 0 if not applicable.
257 virtual gfx::NativeViewId OnStarted(const base::Closure& stop) = 0; 261 virtual gfx::NativeViewId OnStarted(const base::Closure& stop) = 0;
258 }; 262 };
259 263
260 // Callback used return results of media access requests. 264 // Callback used return results of media access requests.
261 typedef base::Callback<void( 265 typedef base::Callback<void(
262 const MediaStreamDevices& devices, 266 const MediaStreamDevices& devices,
263 content::MediaStreamRequestResult result, 267 content::MediaStreamRequestResult result,
264 scoped_ptr<MediaStreamUI> ui)> MediaResponseCallback; 268 scoped_ptr<MediaStreamUI> ui)> MediaResponseCallback;
265 269
266 } // namespace content 270 } // namespace content
267 271
268 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ 272 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698