| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_DESKTOP_CAPTURE_DEVICE_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ | 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/desktop_media_id.h" | 14 #include "content/public/browser/desktop_media_id.h" |
| 15 #include "media/capture/video/video_capture_device.h" | 15 #include "device/capture/video/video_capture_device.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class SingleThreadTaskRunner; | 19 class SingleThreadTaskRunner; |
| 20 class Thread; | 20 class Thread; |
| 21 } // namespace base | 21 } // namespace base |
| 22 | 22 |
| 23 namespace webrtc { | 23 namespace webrtc { |
| 24 class DesktopCapturer; | 24 class DesktopCapturer; |
| 25 } // namespace webrtc | 25 } // namespace webrtc |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 // DesktopCaptureDevice implements VideoCaptureDevice for screens and windows. | 29 // DesktopCaptureDevice implements VideoCaptureDevice for screens and windows. |
| 30 // It's essentially an adapter between webrtc::DesktopCapturer and | 30 // It's essentially an adapter between webrtc::DesktopCapturer and |
| 31 // VideoCaptureDevice. | 31 // VideoCaptureDevice. |
| 32 class CONTENT_EXPORT DesktopCaptureDevice : public media::VideoCaptureDevice { | 32 class CONTENT_EXPORT DesktopCaptureDevice : public device::VideoCaptureDevice { |
| 33 public: | 33 public: |
| 34 // Creates capturer for the specified |source| and then creates | 34 // Creates capturer for the specified |source| and then creates |
| 35 // DesktopCaptureDevice for it. May return NULL in case of a failure (e.g. if | 35 // DesktopCaptureDevice for it. May return NULL in case of a failure (e.g. if |
| 36 // requested window was destroyed). | 36 // requested window was destroyed). |
| 37 static std::unique_ptr<media::VideoCaptureDevice> Create( | 37 static std::unique_ptr<device::VideoCaptureDevice> Create( |
| 38 const DesktopMediaID& source); | 38 const DesktopMediaID& source); |
| 39 | 39 |
| 40 ~DesktopCaptureDevice() override; | 40 ~DesktopCaptureDevice() override; |
| 41 | 41 |
| 42 // VideoCaptureDevice interface. | 42 // VideoCaptureDevice interface. |
| 43 void AllocateAndStart(const media::VideoCaptureParams& params, | 43 void AllocateAndStart(const media::VideoCaptureParams& params, |
| 44 std::unique_ptr<Client> client) override; | 44 std::unique_ptr<Client> client) override; |
| 45 void StopAndDeAllocate() override; | 45 void StopAndDeAllocate() override; |
| 46 | 46 |
| 47 // Set the platform-dependent window id for the notification window. | 47 // Set the platform-dependent window id for the notification window. |
| 48 void SetNotificationWindowId(gfx::NativeViewId window_id); | 48 void SetNotificationWindowId(gfx::NativeViewId window_id); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 friend class DesktopCaptureDeviceTest; | 51 friend class DesktopCaptureDeviceTest; |
| 52 class Core; | 52 class Core; |
| 53 | 53 |
| 54 DesktopCaptureDevice( | 54 DesktopCaptureDevice( |
| 55 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer, | 55 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer, |
| 56 DesktopMediaID::Type type); | 56 DesktopMediaID::Type type); |
| 57 | 57 |
| 58 base::Thread thread_; | 58 base::Thread thread_; |
| 59 std::unique_ptr<Core> core_; | 59 std::unique_ptr<Core> core_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDevice); | 61 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDevice); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace content | 64 } // namespace content |
| 65 | 65 |
| 66 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ | 66 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_ |
| OLD | NEW |