Disable ContentSettingBubbleModelTest.RPHAllow which is flaky.
[chromium-blink-merge.git] / content / renderer / pepper / pepper_platform_video_capture_impl.h
bloba198133d0a46e594e631208804bdbc1b5b23d4bd
1 // Copyright (c) 2012 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_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "media/video/capture/video_capture.h"
15 #include "media/video/capture/video_capture_types.h"
16 #include "webkit/plugins/ppapi/plugin_delegate.h"
18 namespace media {
19 class VideoCaptureHandlerProxy;
22 namespace content {
24 class PepperPluginDelegateImpl;
26 class PepperPlatformVideoCaptureImpl
27 : public webkit::ppapi::PluginDelegate::PlatformVideoCapture,
28 public media::VideoCapture::EventHandler {
29 public:
30 PepperPlatformVideoCaptureImpl(
31 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate,
32 const std::string& device_id,
33 webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler);
35 // webkit::ppapi::PluginDelegate::PlatformVideoCapture implementation.
36 virtual void StartCapture(
37 media::VideoCapture::EventHandler* handler,
38 const media::VideoCaptureCapability& capability) OVERRIDE;
39 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE;
40 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE;
41 virtual bool CaptureStarted() OVERRIDE;
42 virtual int CaptureWidth() OVERRIDE;
43 virtual int CaptureHeight() OVERRIDE;
44 virtual int CaptureFrameRate() OVERRIDE;
45 virtual void DetachEventHandler() OVERRIDE;
47 // media::VideoCapture::EventHandler implementation
48 virtual void OnStarted(VideoCapture* capture) OVERRIDE;
49 virtual void OnStopped(VideoCapture* capture) OVERRIDE;
50 virtual void OnPaused(VideoCapture* capture) OVERRIDE;
51 virtual void OnError(VideoCapture* capture, int error_code) OVERRIDE;
52 virtual void OnRemoved(VideoCapture* capture) OVERRIDE;
53 virtual void OnBufferReady(VideoCapture* capture,
54 scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE;
55 virtual void OnDeviceInfoReceived(
56 VideoCapture* capture,
57 const media::VideoCaptureParams& device_info) OVERRIDE;
59 protected:
60 virtual ~PepperPlatformVideoCaptureImpl();
62 private:
63 void Initialize();
65 void OnDeviceOpened(int request_id,
66 bool succeeded,
67 const std::string& label);
69 base::WeakPtr<PepperPluginDelegateImpl> plugin_delegate_;
71 std::string device_id_;
72 std::string label_;
73 int session_id_;
75 scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_;
77 webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler* handler_;
79 media::VideoCapture* video_capture_;
81 // StartCapture() must be balanced by StopCapture(), otherwise this object
82 // will leak.
83 bool unbalanced_start_;
85 DISALLOW_COPY_AND_ASSIGN(PepperPlatformVideoCaptureImpl);
88 } // namespace content
90 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_VIDEO_CAPTURE_IMPL_H_