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
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_
6 #define REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/threading/thread_checker.h"
12 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
15 class SingleThreadTaskRunner
;
21 class CursorShapeInfo
;
22 } // namespace protocol
24 // DesktopCapturerProxy is responsible for calling webrtc::DesktopCapturer on
25 // the capturer thread and then returning results to the caller's thread.
26 class DesktopCapturerProxy
: public webrtc::DesktopCapturer
{
29 scoped_refptr
<base::SingleThreadTaskRunner
> capture_task_runner
,
30 scoped_ptr
<webrtc::DesktopCapturer
> capturer
);
31 ~DesktopCapturerProxy() override
;
33 // webrtc::DesktopCapturer interface.
34 void Start(Callback
* callback
) override
;
35 void Capture(const webrtc::DesktopRegion
& rect
) override
;
40 void OnFrameCaptured(scoped_ptr
<webrtc::DesktopFrame
> frame
);
42 base::ThreadChecker thread_checker_
;
44 scoped_ptr
<Core
> core_
;
45 scoped_refptr
<base::SingleThreadTaskRunner
> capture_task_runner_
;
46 webrtc::DesktopCapturer::Callback
* callback_
;
48 base::WeakPtrFactory
<DesktopCapturerProxy
> weak_factory_
;
50 DISALLOW_COPY_AND_ASSIGN(DesktopCapturerProxy
);
53 } // namespace remoting
55 #endif // REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_