OLD | NEW |
---|---|
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/macros.h" | 10 #include "base/macros.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 // | 21 // |
22 // An instance is created by providing a device_id. The device_id contains | 22 // An instance is created by providing a device_id. The device_id contains |
23 // information necessary for finding a WebContents instance. From then on, | 23 // information necessary for finding a WebContents instance. From then on, |
24 // WebContentsVideoCaptureDevice will capture from the RenderWidgetHost that | 24 // WebContentsVideoCaptureDevice will capture from the RenderWidgetHost that |
25 // encompasses the currently active RenderFrameHost tree for that that | 25 // encompasses the currently active RenderFrameHost tree for that that |
26 // WebContents instance. As the RenderFrameHost tree mutates (e.g., due to page | 26 // WebContents instance. As the RenderFrameHost tree mutates (e.g., due to page |
27 // navigations, or crashes/reloads), capture will continue without interruption. | 27 // navigations, or crashes/reloads), capture will continue without interruption. |
28 class CONTENT_EXPORT WebContentsVideoCaptureDevice | 28 class CONTENT_EXPORT WebContentsVideoCaptureDevice |
29 : public media::VideoCaptureDevice { | 29 : public media::VideoCaptureDevice { |
30 public: | 30 public: |
31 enum JavaScriptType { | |
miu
2016/03/24 20:51:03
This is an abstraction violation. There's no reas
GeorgeZ
2016/03/25 16:35:04
Thanks for pointing this out.
I was asked to mimi
| |
32 CHROME_TAB_CAPTURE, | |
33 CHROME_CHOOSE_DESKTOP_MEDIA, | |
34 NONE_TYPE | |
35 }; | |
36 | |
31 // Create a WebContentsVideoCaptureDevice instance from the given | 37 // Create a WebContentsVideoCaptureDevice instance from the given |
32 // |device_id|. Returns NULL if |device_id| is invalid. | 38 // |device_id|. Returns NULL if |device_id| is invalid. |
33 static media::VideoCaptureDevice* Create(const std::string& device_id); | 39 static media::VideoCaptureDevice* Create(const std::string& device_id, |
40 JavaScriptType type); | |
34 | 41 |
35 ~WebContentsVideoCaptureDevice() override; | 42 ~WebContentsVideoCaptureDevice() override; |
36 | 43 |
37 // VideoCaptureDevice implementation. | 44 // VideoCaptureDevice implementation. |
38 void AllocateAndStart(const media::VideoCaptureParams& params, | 45 void AllocateAndStart(const media::VideoCaptureParams& params, |
39 scoped_ptr<Client> client) override; | 46 scoped_ptr<Client> client) override; |
40 void StopAndDeAllocate() override; | 47 void StopAndDeAllocate() override; |
41 | 48 |
42 private: | 49 private: |
43 WebContentsVideoCaptureDevice( | 50 WebContentsVideoCaptureDevice(int render_process_id, |
44 int render_process_id, | 51 int main_render_frame_id, |
45 int main_render_frame_id, | 52 bool enable_auto_throttling, |
46 bool enable_auto_throttling); | 53 JavaScriptType type); |
47 | 54 |
48 const scoped_ptr<media::ScreenCaptureDeviceCore> core_; | 55 const scoped_ptr<media::ScreenCaptureDeviceCore> core_; |
49 | 56 |
50 DISALLOW_COPY_AND_ASSIGN(WebContentsVideoCaptureDevice); | 57 DISALLOW_COPY_AND_ASSIGN(WebContentsVideoCaptureDevice); |
51 }; | 58 }; |
52 | 59 |
53 | 60 |
54 } // namespace content | 61 } // namespace content |
55 | 62 |
56 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_ | 63 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |