Index: content/browser/renderer_host/media/desktop_capture_device_aura.h |
diff --git a/content/browser/renderer_host/media/desktop_capture_device_aura.h b/content/browser/renderer_host/media/desktop_capture_device_aura.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..94ea76580fdb2618ef674e46cd1c5373d05ba67e |
--- /dev/null |
+++ b/content/browser/renderer_host/media/desktop_capture_device_aura.h |
@@ -0,0 +1,73 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_DESKTOP_CAPTURE_DEVICE_AURA_H_ |
+#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_DESKTOP_CAPTURE_DEVICE_AURA_H_ |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/threading/thread_checker.h" |
+#include "content/browser/renderer_host/media/video_capture_oracle.h" |
+#include "content/common/content_export.h" |
+#include "content/public/browser/browser_thread.h" |
+#include "content/public/common/desktop_media_id.h" |
+#include "media/video/capture/video_capture_device.h" |
+ |
+namespace gfx { |
+class Display; |
+} |
+ |
+namespace ui { |
+class Compositor; |
+} |
+ |
+namespace content { |
+ |
+// A VideoCaptureDevice that mirrors the displayed contents of an Ash browser |
+// compositor, producing a stream of video frames. |
+class CONTENT_EXPORT DesktopCaptureDeviceAura |
+ : public media::VideoCaptureDevice { |
+ public: |
+ static media::VideoCaptureDevice* Create(const DesktopMediaID& source); |
+ virtual ~DesktopCaptureDeviceAura(); |
+ |
+ // media::VideoCaptureDevice implementation. |
+ virtual void Allocate(const media::VideoCaptureCapability& capture_format, |
+ VideoCaptureDevice::EventHandler* consumer) OVERRIDE; |
+ virtual void Start() OVERRIDE; |
+ virtual void Stop() OVERRIDE; |
+ virtual void DeAllocate() OVERRIDE; |
+ virtual const Name& device_name() OVERRIDE; |
+ |
+ // Report an error and go to error state. |
+ void ReportError(); |
+ |
+ private: |
+ enum State { |
+ kIdle, |
+ kAllocated, |
+ kCapturing, |
+ kError, |
+ }; |
+ |
+ class Impl; |
+ |
+ explicit DesktopCaptureDeviceAura(const Name& device_name); |
+ |
+ const base::ThreadChecker thread_checker_; |
+ const Name device_name_; |
+ State state_; |
+ |
+ // Weak factory and pointer for posting tasks back to this object on the |
+ // device_thread_. Outstanding pointers are invalidated on DeAllocate(). |
+ base::WeakPtrFactory<DesktopCaptureDeviceAura> weak_ptr_factory_; |
+ |
+ scoped_refptr<Impl> impl_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DesktopCaptureDeviceAura); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_DESKTOP_CAPTURE_DEVICE_AURA_H_ |