| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "media/capture/content/screen_capture_device_core.h" | 13 #include "device/capture/content/screen_capture_device_core.h" |
| 14 #include "media/capture/video/video_capture_device.h" | 14 #include "device/capture/video/video_capture_device.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 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 // WebContents (i.e., the composition of an entire render frame tree), producing | 19 // WebContents (i.e., the composition of an entire render frame tree), producing |
| 20 // a stream of video frames. | 20 // a stream of video frames. |
| 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 device::VideoCaptureDevice { |
| 30 public: | 30 public: |
| 31 // Create a WebContentsVideoCaptureDevice instance from the given | 31 // Create a WebContentsVideoCaptureDevice instance from the given |
| 32 // |device_id|. Returns NULL if |device_id| is invalid. | 32 // |device_id|. Returns NULL if |device_id| is invalid. |
| 33 static media::VideoCaptureDevice* Create(const std::string& device_id); | 33 static device::VideoCaptureDevice* Create(const std::string& device_id); |
| 34 | 34 |
| 35 ~WebContentsVideoCaptureDevice() override; | 35 ~WebContentsVideoCaptureDevice() override; |
| 36 | 36 |
| 37 // VideoCaptureDevice implementation. | 37 // VideoCaptureDevice implementation. |
| 38 void AllocateAndStart(const media::VideoCaptureParams& params, | 38 void AllocateAndStart(const device::VideoCaptureParams& params, |
| 39 std::unique_ptr<Client> client) override; | 39 std::unique_ptr<Client> client) override; |
| 40 void RequestRefreshFrame() override; | 40 void RequestRefreshFrame() override; |
| 41 void StopAndDeAllocate() override; | 41 void StopAndDeAllocate() override; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 WebContentsVideoCaptureDevice( | 44 WebContentsVideoCaptureDevice( |
| 45 int render_process_id, | 45 int render_process_id, |
| 46 int main_render_frame_id, | 46 int main_render_frame_id, |
| 47 bool enable_auto_throttling); | 47 bool enable_auto_throttling); |
| 48 | 48 |
| 49 const std::unique_ptr<media::ScreenCaptureDeviceCore> core_; | 49 const std::unique_ptr<device::ScreenCaptureDeviceCore> core_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(WebContentsVideoCaptureDevice); | 51 DISALLOW_COPY_AND_ASSIGN(WebContentsVideoCaptureDevice); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 | 54 |
| 55 } // namespace content | 55 } // namespace content |
| 56 | 56 |
| 57 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_ | 57 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |