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

Side by Side Diff: content/renderer/pepper/pepper_platform_camera_device.cc

Issue 2882133002: Block insecure pepper media requests in the renderer (Closed)
Patch Set: Block insecure pepper media requests Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/renderer/pepper/pepper_platform_camera_device.h" 5 #include "content/renderer/pepper/pepper_platform_camera_device.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/renderer/media/video_capture_impl_manager.h" 10 #include "content/renderer/media/video_capture_impl_manager.h"
11 #include "content/renderer/pepper/gfx_conversion.h" 11 #include "content/renderer/pepper/gfx_conversion.h"
12 #include "content/renderer/pepper/pepper_camera_device_host.h" 12 #include "content/renderer/pepper/pepper_camera_device_host.h"
13 #include "content/renderer/pepper/pepper_media_device_manager.h" 13 #include "content/renderer/pepper/pepper_media_device_manager.h"
14 #include "content/renderer/render_frame_impl.h" 14 #include "content/renderer/render_frame_impl.h"
15 #include "content/renderer/render_thread_impl.h" 15 #include "content/renderer/render_thread_impl.h"
16 #include "media/base/bind_to_current_loop.h" 16 #include "media/base/bind_to_current_loop.h"
17 #include "url/gurl.h"
18 17
19 namespace content { 18 namespace content {
20 19
21 PepperPlatformCameraDevice::PepperPlatformCameraDevice( 20 PepperPlatformCameraDevice::PepperPlatformCameraDevice(
22 int render_frame_id, 21 int render_frame_id,
23 const std::string& device_id, 22 const std::string& device_id,
24 const GURL& document_url,
25 PepperCameraDeviceHost* handler) 23 PepperCameraDeviceHost* handler)
26 : render_frame_id_(render_frame_id), 24 : render_frame_id_(render_frame_id),
27 device_id_(device_id), 25 device_id_(device_id),
28 session_id_(0), 26 session_id_(0),
29 handler_(handler), 27 handler_(handler),
30 pending_open_device_(false), 28 pending_open_device_(false),
31 pending_open_device_id_(-1), 29 pending_open_device_id_(-1),
32 weak_factory_(this) { 30 weak_factory_(this) {
33 // We need to open the device and obtain the label and session ID before 31 // We need to open the device and obtain the label and session ID before
34 // initializing. 32 // initializing.
35 PepperMediaDeviceManager* const device_manager = GetMediaDeviceManager(); 33 PepperMediaDeviceManager* const device_manager = GetMediaDeviceManager();
36 if (device_manager) { 34 if (device_manager) {
37 pending_open_device_id_ = device_manager->OpenDevice( 35 pending_open_device_id_ = device_manager->OpenDevice(
38 PP_DEVICETYPE_DEV_VIDEOCAPTURE, device_id, document_url, 36 PP_DEVICETYPE_DEV_VIDEOCAPTURE, device_id, handler->pp_instance(),
39 base::Bind(&PepperPlatformCameraDevice::OnDeviceOpened, 37 base::Bind(&PepperPlatformCameraDevice::OnDeviceOpened,
40 weak_factory_.GetWeakPtr())); 38 weak_factory_.GetWeakPtr()));
41 pending_open_device_ = true; 39 pending_open_device_ = true;
42 } 40 }
43 } 41 }
44 42
45 void PepperPlatformCameraDevice::GetSupportedVideoCaptureFormats() { 43 void PepperPlatformCameraDevice::GetSupportedVideoCaptureFormats() {
46 DCHECK(thread_checker_.CalledOnValidThread()); 44 DCHECK(thread_checker_.CalledOnValidThread());
47 VideoCaptureImplManager* manager = 45 VideoCaptureImplManager* manager =
48 RenderThreadImpl::current()->video_capture_impl_manager(); 46 RenderThreadImpl::current()->video_capture_impl_manager();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 119
122 PepperMediaDeviceManager* PepperPlatformCameraDevice::GetMediaDeviceManager() { 120 PepperMediaDeviceManager* PepperPlatformCameraDevice::GetMediaDeviceManager() {
123 RenderFrameImpl* const render_frame = 121 RenderFrameImpl* const render_frame =
124 RenderFrameImpl::FromRoutingID(render_frame_id_); 122 RenderFrameImpl::FromRoutingID(render_frame_id_);
125 return render_frame 123 return render_frame
126 ? PepperMediaDeviceManager::GetForRenderFrame(render_frame).get() 124 ? PepperMediaDeviceManager::GetForRenderFrame(render_frame).get()
127 : NULL; 125 : NULL;
128 } 126 }
129 127
130 } // namespace content 128 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_platform_camera_device.h ('k') | content/renderer/pepper/pepper_platform_video_capture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698