Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / renderer_host / media / screen_capture_device.h
blobc8b47aab788fa4f6032a403a6834656837fe2804
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_RENDERER_HOST_MEDIA_SCREEN_CAPTURE_DEVICE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_SCREEN_CAPTURE_DEVICE_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h"
11 #include "media/video/capture/video_capture_device.h"
13 namespace base {
14 class SequencedTaskRunner;
15 } // namespace base
17 namespace webrtc {
18 class ScreenCapturer;
19 } // namespace webrtc
21 namespace content {
23 // ScreenCaptureDevice implements VideoCaptureDevice for the screen. It's
24 // essentially an adapter between ScreenCapturer and VideoCaptureDevice.
25 class CONTENT_EXPORT ScreenCaptureDevice : public media::VideoCaptureDevice {
26 public:
27 explicit ScreenCaptureDevice(
28 scoped_refptr<base::SequencedTaskRunner> task_runner);
29 virtual ~ScreenCaptureDevice();
31 // Helper used in tests to supply a fake capturer.
32 void SetScreenCapturerForTest(
33 scoped_ptr<webrtc::ScreenCapturer> capturer);
35 // VideoCaptureDevice interface.
36 virtual void Allocate(int width, int height,
37 int frame_rate,
38 EventHandler* event_handler) OVERRIDE;
39 virtual void Start() OVERRIDE;
40 virtual void Stop() OVERRIDE;
41 virtual void DeAllocate() OVERRIDE;
42 virtual const Name& device_name() OVERRIDE;
44 private:
45 class Core;
46 scoped_refptr<Core> core_;
47 Name name_;
49 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureDevice);
52 } // namespace content
54 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_SCREEN_CAPTURE_DEVICE_H_