Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / media / capture / desktop_capture_device.h
blob6b971597b757d424bff595bdf38735691d0839a2
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_
6 #define CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/threading/thread.h"
11 #include "content/common/content_export.h"
12 #include "content/public/browser/desktop_media_id.h"
13 #include "media/capture/video/video_capture_device.h"
14 #include "ui/gfx/native_widget_types.h"
16 namespace base {
17 class SingleThreadTaskRunner;
18 class Thread;
19 } // namespace base
21 namespace webrtc {
22 class DesktopCapturer;
23 } // namespace webrtc
25 namespace content {
27 // DesktopCaptureDevice implements VideoCaptureDevice for screens and windows.
28 // It's essentially an adapter between webrtc::DesktopCapturer and
29 // VideoCaptureDevice.
30 class CONTENT_EXPORT DesktopCaptureDevice : public media::VideoCaptureDevice {
31 public:
32 // Creates capturer for the specified |source| and then creates
33 // DesktopCaptureDevice for it. May return NULL in case of a failure (e.g. if
34 // requested window was destroyed).
35 static scoped_ptr<media::VideoCaptureDevice> Create(
36 const DesktopMediaID& source);
38 ~DesktopCaptureDevice() override;
40 // VideoCaptureDevice interface.
41 void AllocateAndStart(const media::VideoCaptureParams& params,
42 scoped_ptr<Client> client) override;
43 void StopAndDeAllocate() override;
45 // Set the platform-dependent window id for the notification window.
46 void SetNotificationWindowId(gfx::NativeViewId window_id);
48 private:
49 friend class DesktopCaptureDeviceTest;
50 class Core;
52 DesktopCaptureDevice(scoped_ptr<webrtc::DesktopCapturer> desktop_capturer,
53 DesktopMediaID::Type type);
55 base::Thread thread_;
56 scoped_ptr<Core> core_;
58 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDevice);
61 } // namespace content
63 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_DESKTOP_CAPTURE_DEVICE_H_