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

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 12150003: Remove extension scheme check in MediaStreamManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/browser/renderer_host/media/media_stream_manager.h" 5 #include "content/browser/renderer_host/media/media_stream_manager.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/public/common/media_stream_request.h" 25 #include "content/public/common/media_stream_request.h"
26 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
27 #include "media/audio/audio_manager_base.h" 27 #include "media/audio/audio_manager_base.h"
28 #include "media/audio/audio_util.h" 28 #include "media/audio/audio_util.h"
29 #include "media/base/channel_layout.h" 29 #include "media/base/channel_layout.h"
30 30
31 #if defined(OS_WIN) 31 #if defined(OS_WIN)
32 #include "base/win/scoped_com_initializer.h" 32 #include "base/win/scoped_com_initializer.h"
33 #endif 33 #endif
34 34
35 namespace {
36 const char kExtensionScheme[] = "chrome-extension";
37 } // namespace
38
39 namespace content { 35 namespace content {
40 36
41 // Creates a random label used to identify requests. 37 // Creates a random label used to identify requests.
42 static std::string RandomLabel() { 38 static std::string RandomLabel() {
43 // An earlier PeerConnection spec, 39 // An earlier PeerConnection spec,
44 // http://dev.w3.org/2011/webrtc/editor/webrtc.html, specified the 40 // http://dev.w3.org/2011/webrtc/editor/webrtc.html, specified the
45 // MediaStream::label alphabet as containing 36 characters from 41 // MediaStream::label alphabet as containing 36 characters from
46 // range: U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, 42 // range: U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E,
47 // U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E. 43 // U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
48 // Here we use a safe subset. 44 // Here we use a safe subset.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 234
239 std::string MediaStreamManager::GenerateStreamForDevice( 235 std::string MediaStreamManager::GenerateStreamForDevice(
240 MediaStreamRequester* requester, int render_process_id, int render_view_id, 236 MediaStreamRequester* requester, int render_process_id, int render_view_id,
241 const StreamOptions& options, const std::string& device_id, 237 const StreamOptions& options, const std::string& device_id,
242 const GURL& security_origin) { 238 const GURL& security_origin) {
243 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
244 240
245 int target_render_process_id = -1; 241 int target_render_process_id = -1;
246 int target_render_view_id = -1; 242 int target_render_view_id = -1;
247 243
248 // We will post the request to the target render view, not the source (i.e. 244 // We will post the request to the render view that is the target of the
249 // source is an extension, and target is the tab we want to capture). 245 // capture.
250 bool has_valid_device_id = WebContentsCaptureUtil::ExtractTabCaptureTarget( 246 bool has_valid_device_id = WebContentsCaptureUtil::ExtractTabCaptureTarget(
251 device_id, &target_render_process_id, &target_render_view_id); 247 device_id, &target_render_process_id, &target_render_view_id);
252 248
253 if (!has_valid_device_id || 249 if (!has_valid_device_id ||
254 !security_origin.SchemeIs(kExtensionScheme) ||
255 (options.audio_type != MEDIA_TAB_AUDIO_CAPTURE && 250 (options.audio_type != MEDIA_TAB_AUDIO_CAPTURE &&
256 options.audio_type != MEDIA_NO_SERVICE) || 251 options.audio_type != MEDIA_NO_SERVICE) ||
257 (options.video_type != MEDIA_TAB_VIDEO_CAPTURE && 252 (options.video_type != MEDIA_TAB_VIDEO_CAPTURE &&
258 options.video_type != MEDIA_NO_SERVICE)) { 253 options.video_type != MEDIA_NO_SERVICE)) {
259 LOG(ERROR) << "Invalid request or used tab capture outside extension API."; 254 LOG(ERROR) << "Invalid request.";
260 return std::string(); 255 return std::string();
261 } 256 }
262 257
263 // Create a new request based on options. 258 // Create a new request based on options.
264 DeviceRequest* request = new DeviceRequest(requester, options, 259 DeviceRequest* request = new DeviceRequest(requester, options,
265 MEDIA_GENERATE_STREAM, 260 MEDIA_GENERATE_STREAM,
266 target_render_process_id, 261 target_render_process_id,
267 target_render_view_id, 262 target_render_view_id,
268 security_origin); 263 security_origin);
269 const std::string& label = AddRequest(request); 264 const std::string& label = AddRequest(request);
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 } 1113 }
1119 1114
1120 // Always do enumeration even though some enumeration is in progress, 1115 // Always do enumeration even though some enumeration is in progress,
1121 // because those enumeration commands could be sent before these devices 1116 // because those enumeration commands could be sent before these devices
1122 // change. 1117 // change.
1123 ++active_enumeration_ref_count_[stream_type]; 1118 ++active_enumeration_ref_count_[stream_type];
1124 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); 1119 GetDeviceManager(stream_type)->EnumerateDevices(stream_type);
1125 } 1120 }
1126 1121
1127 } // namespace content 1122 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698