| OLD | NEW |
| 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 #ifndef REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ | 5 #ifndef REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ |
| 6 #define REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ | 6 #define REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } // namespace webrtc | 22 } // namespace webrtc |
| 23 | 23 |
| 24 namespace remoting { | 24 namespace remoting { |
| 25 | 25 |
| 26 namespace protocol { | 26 namespace protocol { |
| 27 class CursorShapeInfo; | 27 class CursorShapeInfo; |
| 28 } // namespace protocol | 28 } // namespace protocol |
| 29 | 29 |
| 30 // DesktopCapturerProxy is responsible for calling webrtc::DesktopCapturer on | 30 // DesktopCapturerProxy is responsible for calling webrtc::DesktopCapturer on |
| 31 // the capturer thread and then returning results to the caller's thread. | 31 // the capturer thread and then returning results to the caller's thread. |
| 32 // GetSourceList() and SelectSource() functions are not implemented by this |
| 33 // class, they always return false. |
| 32 class DesktopCapturerProxy : public webrtc::DesktopCapturer { | 34 class DesktopCapturerProxy : public webrtc::DesktopCapturer { |
| 33 public: | 35 public: |
| 34 explicit DesktopCapturerProxy( | 36 explicit DesktopCapturerProxy( |
| 35 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner); | 37 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner); |
| 36 ~DesktopCapturerProxy() override; | 38 ~DesktopCapturerProxy() override; |
| 37 | 39 |
| 38 // CreateCapturer() should be used if the capturer needs to be created on the | 40 // CreateCapturer() should be used if the capturer needs to be created on the |
| 39 // capturer thread. Alternatively the capturer can be passed to | 41 // capturer thread. Alternatively the capturer can be passed to |
| 40 // set_capturer(). | 42 // set_capturer(). |
| 41 void CreateCapturer(const webrtc::DesktopCaptureOptions& options); | 43 void CreateCapturer(const webrtc::DesktopCaptureOptions& options); |
| 42 void set_capturer(std::unique_ptr<webrtc::DesktopCapturer> capturer); | 44 void set_capturer(std::unique_ptr<webrtc::DesktopCapturer> capturer); |
| 43 | 45 |
| 44 // webrtc::DesktopCapturer interface. | 46 // webrtc::DesktopCapturer interface. |
| 45 void Start(Callback* callback) override; | 47 void Start(Callback* callback) override; |
| 46 void SetSharedMemoryFactory(std::unique_ptr<webrtc::SharedMemoryFactory> | 48 void SetSharedMemoryFactory(std::unique_ptr<webrtc::SharedMemoryFactory> |
| 47 shared_memory_factory) override; | 49 shared_memory_factory) override; |
| 48 void CaptureFrame() override; | 50 void CaptureFrame() override; |
| 51 bool GetSourceList(SourceList* sources) override; |
| 52 bool SelectSource(SourceId id) override; |
| 49 | 53 |
| 50 private: | 54 private: |
| 51 class Core; | 55 class Core; |
| 52 | 56 |
| 53 void OnFrameCaptured(webrtc::DesktopCapturer::Result result, | 57 void OnFrameCaptured(webrtc::DesktopCapturer::Result result, |
| 54 std::unique_ptr<webrtc::DesktopFrame> frame); | 58 std::unique_ptr<webrtc::DesktopFrame> frame); |
| 55 | 59 |
| 56 base::ThreadChecker thread_checker_; | 60 base::ThreadChecker thread_checker_; |
| 57 | 61 |
| 58 std::unique_ptr<Core> core_; | 62 std::unique_ptr<Core> core_; |
| 59 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; | 63 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; |
| 60 webrtc::DesktopCapturer::Callback* callback_; | 64 webrtc::DesktopCapturer::Callback* callback_; |
| 61 | 65 |
| 62 base::WeakPtrFactory<DesktopCapturerProxy> weak_factory_; | 66 base::WeakPtrFactory<DesktopCapturerProxy> weak_factory_; |
| 63 | 67 |
| 64 DISALLOW_COPY_AND_ASSIGN(DesktopCapturerProxy); | 68 DISALLOW_COPY_AND_ASSIGN(DesktopCapturerProxy); |
| 65 }; | 69 }; |
| 66 | 70 |
| 67 } // namespace remoting | 71 } // namespace remoting |
| 68 | 72 |
| 69 #endif // REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ | 73 #endif // REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ |
| OLD | NEW |