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

Side by Side Diff: content/browser/media/capture/web_contents_video_capture_device.h

Issue 364123002: [Cross-Site Isolation] Migrate entire MediaStream verticals to be per-RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: It's random enough. + REBASE Created 6 years, 5 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
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_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_
6 #define CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_ 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "media/video/capture/video_capture_device.h" 12 #include "media/video/capture/video_capture_device.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class ContentVideoCaptureDeviceCore; 16 class ContentVideoCaptureDeviceCore;
17 17
18 // A virtualized VideoCaptureDevice that mirrors the displayed contents of a 18 // A virtualized VideoCaptureDevice that mirrors the displayed contents of a
19 // tab (accessed via its associated WebContents instance), producing a stream of 19 // tab (accessed via its associated WebContents instance), producing a stream of
20 // video frames. 20 // video frames.
21 // 21 //
22 // An instance is created by providing a device_id. The device_id contains the 22 // An instance is created by providing a device_id. The device_id contains
23 // routing ID for a RenderViewHost, and from the RenderViewHost instance, a 23 // information necessary for finding a WebContents instance. From then on,
24 // reference to its associated WebContents instance is acquired. From then on,
25 // WebContentsVideoCaptureDevice will capture from whatever render view is 24 // WebContentsVideoCaptureDevice will capture from whatever render view is
26 // currently associated with that WebContents instance. This allows the 25 // currently associated with that WebContents instance. This allows the
27 // underlying render view to be swapped out (e.g., due to navigation or 26 // underlying render view to be swapped out (e.g., due to navigation or
28 // crashes/reloads), without any interruption in capturing. 27 // crashes/reloads), without any interruption in capturing.
28 //
29 // TODO(miu): In a soon upcoming change, the cross-site isolation migration of
30 // this code will be completed such that the main RenderFrameHost is tracked
31 // instead of the RenderViewHost.
29 class CONTENT_EXPORT WebContentsVideoCaptureDevice 32 class CONTENT_EXPORT WebContentsVideoCaptureDevice
30 : public media::VideoCaptureDevice { 33 : public media::VideoCaptureDevice {
31 public: 34 public:
32 // Construct from a |device_id| string of the form: 35 // Create a WebContentsVideoCaptureDevice instance from the given
33 // "virtual-media-stream://render_process_id:render_view_id", where 36 // |device_id|. Returns NULL if |device_id| is invalid.
34 // |render_process_id| and |render_view_id| are decimal integers.
35 // |destroy_cb| is invoked on an outside thread once all outstanding objects
36 // are completely destroyed -- this will be some time after the
37 // WebContentsVideoCaptureDevice is itself deleted.
38 static media::VideoCaptureDevice* Create(const std::string& device_id); 37 static media::VideoCaptureDevice* Create(const std::string& device_id);
39 38
40 virtual ~WebContentsVideoCaptureDevice(); 39 virtual ~WebContentsVideoCaptureDevice();
41 40
42 // VideoCaptureDevice implementation. 41 // VideoCaptureDevice implementation.
43 virtual void AllocateAndStart(const media::VideoCaptureParams& params, 42 virtual void AllocateAndStart(const media::VideoCaptureParams& params,
44 scoped_ptr<Client> client) OVERRIDE; 43 scoped_ptr<Client> client) OVERRIDE;
45 virtual void StopAndDeAllocate() OVERRIDE; 44 virtual void StopAndDeAllocate() OVERRIDE;
46 45
47 private: 46 private:
48 WebContentsVideoCaptureDevice(int render_process_id, int render_view_id); 47 WebContentsVideoCaptureDevice(
48 int render_process_id, int main_render_frame_id);
49 49
50 const scoped_ptr<ContentVideoCaptureDeviceCore> core_; 50 const scoped_ptr<ContentVideoCaptureDeviceCore> core_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(WebContentsVideoCaptureDevice); 52 DISALLOW_COPY_AND_ASSIGN(WebContentsVideoCaptureDevice);
53 }; 53 };
54 54
55 55
56 } // namespace content 56 } // namespace content
57 57
58 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_ 58 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698