Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / remoting / host / chromeos / aura_desktop_capturer.h
blob16c6f85fd4a3b69d6308a8df072cc86d63435782
1 // Copyright 2014 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_CHROMEOS_AURA_DESKTOP_CAPTURER_H_
6 #define REMOTING_HOST_CHROMEOS_AURA_DESKTOP_CAPTURER_H_
8 #include "base/memory/weak_ptr.h"
9 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
11 namespace cc {
12 class CopyOutputResult;
13 } // namespace cc
15 namespace aura {
16 class Window;
17 } // namespace aura
19 namespace remoting {
21 // A webrtc::DesktopCapturer that captures pixels from the root window of the
22 // Aura Shell. This is implemented by requesting the layer and its substree to
23 // be rendered to a given data structure. Start() and Capture() must be called
24 // on the Browser UI thread.
25 class AuraDesktopCapturer : public webrtc::DesktopCapturer {
26 public:
27 AuraDesktopCapturer();
28 ~AuraDesktopCapturer() override;
30 // webrtc::DesktopCapturer implementation.
31 void Start(webrtc::DesktopCapturer::Callback* callback) override;
32 void Capture(const webrtc::DesktopRegion& region) override;
34 private:
35 friend class AuraDesktopCapturerTest;
37 // Called when a copy of the layer is captured.
38 void OnFrameCaptured(scoped_ptr<cc::CopyOutputResult> result);
40 // Points to the callback passed to webrtc::DesktopCapturer::Start().
41 webrtc::DesktopCapturer::Callback* callback_;
43 // The root window of the Aura Shell.
44 aura::Window* desktop_window_;
46 base::WeakPtrFactory<AuraDesktopCapturer> weak_factory_;
48 DISALLOW_COPY_AND_ASSIGN(AuraDesktopCapturer);
51 } // namespace remoting
53 #endif // REMOTING_HOST_CHROMEOS_AURA_DESKTOP_CAPTURER_H_