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

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 problem with that the ui_request_ was used for state updates. 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 // This is the render frame id for the renderer associated with generating 212 // This is the render frame id for the renderer associated with generating
213 // frames for a MediaStream. Any indicators associated with a capture will be 213 // frames for a MediaStream. Any indicators associated with a capture will be
214 // displayed for this renderer. 214 // displayed for this renderer.
215 int render_frame_id; 215 int render_frame_id;
216 216
217 // The unique id combined with render_process_id and render_frame_id for 217 // The unique id combined with render_process_id and render_frame_id for
218 // identifying this request. This is used for cancelling request. 218 // identifying this request. This is used for cancelling request.
219 int page_request_id; 219 int page_request_id;
220 220
221 // Used by tab capture.
222 std::string tab_capture_device_id;
223
224 // The WebKit security origin for the current request (e.g. "html5rocks.com"). 221 // The WebKit security origin for the current request (e.g. "html5rocks.com").
225 GURL security_origin; 222 GURL security_origin;
226 223
227 // Set to true if the call was made in the context of a user gesture. 224 // Set to true if the call was made in the context of a user gesture.
228 bool user_gesture; 225 bool user_gesture;
229 226
230 // Stores the type of request that was made to the media controller. Right now 227 // Stores the type of request that was made to the media controller. Right now
231 // this is only used to distinguish between WebRTC and Pepper requests, as the 228 // this is only used to distinguish between WebRTC and Pepper requests, as the
232 // latter should not be subject to user approval but only to policy check. 229 // latter should not be subject to user approval but only to policy check.
233 // Pepper requests are signified by the |MEDIA_OPEN_DEVICE| value. 230 // Pepper requests are signified by the |MEDIA_OPEN_DEVICE| value.
234 MediaStreamRequestType request_type; 231 MediaStreamRequestType request_type;
235 232
236 // Stores the requested raw device id for physical audio or video devices. 233 // Stores the requested raw device id for physical audio or video devices.
237 std::string requested_audio_device_id; 234 std::string requested_audio_device_id;
238 std::string requested_video_device_id; 235 std::string requested_video_device_id;
239 236
240 // Flag to indicate if the request contains audio. 237 // Flag to indicate if the request contains audio.
241 MediaStreamType audio_type; 238 MediaStreamType audio_type;
242 239
243 // Flag to indicate if the request contains video. 240 // Flag to indicate if the request contains video.
244 MediaStreamType video_type; 241 MediaStreamType video_type;
242
243 // True if all ancestors of the requesting frame have the same origin.
244 bool all_ancestors_have_same_origin;
245 }; 245 };
246 246
247 // Interface used by the content layer to notify chrome about changes in the 247 // 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 248 // state of a media stream. Instances of this class are passed to content layer
249 // when MediaStream access is approved using MediaResponseCallback. 249 // when MediaStream access is approved using MediaResponseCallback.
250 class MediaStreamUI { 250 class MediaStreamUI {
251 public: 251 public:
252 virtual ~MediaStreamUI() {} 252 virtual ~MediaStreamUI() {}
253 253
254 // Called when MediaStream capturing is started. Chrome layer can call |stop| 254 // 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 255 // to stop the stream. Returns the platform-dependent window ID for the UI, or
256 // 0 if not applicable. 256 // 0 if not applicable.
257 virtual gfx::NativeViewId OnStarted(const base::Closure& stop) = 0; 257 virtual gfx::NativeViewId OnStarted(const base::Closure& stop) = 0;
258 }; 258 };
259 259
260 // Callback used return results of media access requests. 260 // Callback used return results of media access requests.
261 typedef base::Callback<void( 261 typedef base::Callback<void(
262 const MediaStreamDevices& devices, 262 const MediaStreamDevices& devices,
263 content::MediaStreamRequestResult result, 263 content::MediaStreamRequestResult result,
264 scoped_ptr<MediaStreamUI> ui)> MediaResponseCallback; 264 scoped_ptr<MediaStreamUI> ui)> MediaResponseCallback;
265 265
266 } // namespace content 266 } // namespace content
267 267
268 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_ 268 #endif // CONTENT_PUBLIC_COMMON_MEDIA_STREAM_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698