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

Unified Diff: content/browser/renderer_host/media/media_stream_manager.cc

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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/media_stream_manager.cc
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc
index 2e0d77b2ebf1406c198a4cb19558fdeed7d4c268..e53c9c8512943564168c908b0c688ce6a2d44d3c 100644
--- a/content/browser/renderer_host/media/media_stream_manager.cc
+++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -267,6 +267,7 @@ class MediaStreamManager::DeviceRequest {
ui_request_.reset(new MediaStreamRequest(requesting_process_id,
requesting_frame_id,
page_request_id,
+ "",
security_origin,
user_gesture,
request_type,
@@ -285,6 +286,7 @@ class MediaStreamManager::DeviceRequest {
ui_request_.reset(new MediaStreamRequest(target_render_process_id,
target_render_frame_id,
page_request_id,
+ tab_capture_id,
security_origin,
user_gesture,
request_type,
@@ -292,10 +294,10 @@ class MediaStreamManager::DeviceRequest {
"",
audio_type_,
video_type_));
- ui_request_->tab_capture_device_id = tab_capture_id;
}
- const MediaStreamRequest* UIRequest() const { return ui_request_.get(); }
+ bool HasUIRequest() const { return ui_request_.get() != NULL; }
tommi (sloooow) - chröme 2015/01/23 10:44:04 nit: nullptr
perkj_chrome 2015/01/26 13:43:39 Done.
+ scoped_ptr<MediaStreamRequest> GetUIRequest() { return ui_request_.Pass(); }
tommi (sloooow) - chröme 2015/01/23 10:44:04 Since this transfers ownership I'd like to give it
perkj_chrome 2015/01/26 13:43:39 Done.
// Update the request state and notify observers.
void SetState(MediaStreamType stream_type, MediaRequestState new_state) {
@@ -365,6 +367,8 @@ class MediaStreamManager::DeviceRequest {
scoped_ptr<MediaStreamUIProxy> ui_proxy;
+ std::string tab_capture_device_id;
+
private:
std::vector<MediaRequestState> state_;
scoped_ptr<MediaStreamRequest> ui_request_;
@@ -1163,7 +1167,7 @@ void MediaStreamManager::DeleteRequest(const std::string& label) {
void MediaStreamManager::PostRequestToUI(const std::string& label,
DeviceRequest* request) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- DCHECK(request->UIRequest());
+ DCHECK(request->HasUIRequest());
DVLOG(1) << "PostRequestToUI({label= " << label << "})";
const MediaStreamType audio_type = request->audio_type();
@@ -1203,7 +1207,7 @@ void MediaStreamManager::PostRequestToUI(const std::string& label,
}
request->ui_proxy->RequestAccess(
- *request->UIRequest(),
+ request->GetUIRequest(),
base::Bind(&MediaStreamManager::HandleAccessRequestResponse,
base::Unretained(this), label));
}
@@ -1340,6 +1344,7 @@ bool MediaStreamManager::SetupTabCaptureRequest(DeviceRequest* request) {
request->video_type() != MEDIA_NO_SERVICE)) {
return false;
}
+ request->tab_capture_device_id = capture_device_id;
request->CreateTabCaptureUIRequest(target_render_process_id,
target_render_frame_id,
@@ -1913,7 +1918,7 @@ void MediaStreamManager::HandleAccessRequestResponse(
if (device_info.device.type == content::MEDIA_TAB_VIDEO_CAPTURE ||
device_info.device.type == content::MEDIA_TAB_AUDIO_CAPTURE) {
- device_info.device.id = request->UIRequest()->tab_capture_device_id;
+ device_info.device.id = request->tab_capture_device_id;
// Initialize the sample_rate and channel_layout here since for audio
// mirroring, we don't go through EnumerateDevices where these are usually
« no previous file with comments | « content/browser/frame_host/frame_tree_node.h ('k') | content/browser/renderer_host/media/media_stream_ui_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698