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.
4 
5 #ifndef REMOTING_HOST_DESKTOP_CAPTURER_CHECKER_H_
6 #define REMOTING_HOST_DESKTOP_CAPTURER_CHECKER_H_
7 
8 #include <memory>
9 
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
13 
14 namespace remoting {
15 
16 // DesktopCapturerChecker is a simple DesktopCapturer that captures a single
17 // screen image (which is ignored). The purpose of this class is to trigger
18 // the native API's permission check when a screen capture is attempted.
19 class DesktopCapturerChecker : public webrtc::DesktopCapturer::Callback {
20  public:
21   DesktopCapturerChecker();
22   ~DesktopCapturerChecker() override;
23 
24   void TriggerSingleCapture();
25 
26  private:
27   // webrtc::DesktopCapturer::Callback implementation.
28   void OnCaptureResult(webrtc::DesktopCapturer::Result result,
29                        std::unique_ptr<webrtc::DesktopFrame> frame) override;
30 
31   std::unique_ptr<webrtc::DesktopCapturer> capturer_;
32   DISALLOW_COPY_AND_ASSIGN(DesktopCapturerChecker);
33 };
34 
35 }  // namespace remoting
36 
37 #endif  // REMOTING_HOST_DESKTOP_CAPTURER_CHECKER_H_
38