OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_ |
6 #define PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_ | 6 #define PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "ppapi/c/dev/ppp_video_capture_dev.h" | 9 #include "ppapi/c/dev/ppp_video_capture_dev.h" |
10 #include "ppapi/proxy/device_enumeration_resource_helper.h" | 10 #include "ppapi/proxy/device_enumeration_resource_helper.h" |
11 #include "ppapi/proxy/plugin_resource.h" | 11 #include "ppapi/proxy/plugin_resource.h" |
12 #include "ppapi/thunk/ppb_video_capture_api.h" | 12 #include "ppapi/thunk/ppb_video_capture_api.h" |
13 | 13 |
14 namespace ppapi { | 14 namespace ppapi { |
15 namespace proxy { | 15 namespace proxy { |
16 | 16 |
17 class VideoCaptureResource | 17 class VideoCaptureResource |
18 : public PluginResource, | 18 : public PluginResource, |
19 public ::ppapi::thunk::PPB_VideoCapture_API { | 19 public ::ppapi::thunk::PPB_VideoCapture_API { |
20 public: | 20 public: |
21 VideoCaptureResource(Connection connection, | 21 VideoCaptureResource(Connection connection, |
22 PP_Instance instance, | 22 PP_Instance instance, |
23 PluginDispatcher* dispatcher); | 23 PluginDispatcher* dispatcher); |
24 virtual ~VideoCaptureResource(); | 24 virtual ~VideoCaptureResource(); |
25 | 25 |
26 // PluginResource override. | 26 // PluginResource override. |
27 virtual thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE { | 27 virtual thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() override { |
28 return this; | 28 return this; |
29 } | 29 } |
30 | 30 |
31 // PPB_VideoCapture_API implementation. | 31 // PPB_VideoCapture_API implementation. |
32 virtual int32_t EnumerateDevices( | 32 virtual int32_t EnumerateDevices( |
33 const PP_ArrayOutput& output, | 33 const PP_ArrayOutput& output, |
34 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 34 scoped_refptr<TrackedCallback> callback) override; |
35 virtual int32_t MonitorDeviceChange( | 35 virtual int32_t MonitorDeviceChange( |
36 PP_MonitorDeviceChangeCallback callback, | 36 PP_MonitorDeviceChangeCallback callback, |
37 void* user_data) OVERRIDE; | 37 void* user_data) override; |
38 virtual int32_t Open(const std::string& device_id, | 38 virtual int32_t Open(const std::string& device_id, |
39 const PP_VideoCaptureDeviceInfo_Dev& requested_info, | 39 const PP_VideoCaptureDeviceInfo_Dev& requested_info, |
40 uint32_t buffer_count, | 40 uint32_t buffer_count, |
41 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 41 scoped_refptr<TrackedCallback> callback) override; |
42 virtual int32_t StartCapture() OVERRIDE; | 42 virtual int32_t StartCapture() override; |
43 virtual int32_t ReuseBuffer(uint32_t buffer) OVERRIDE; | 43 virtual int32_t ReuseBuffer(uint32_t buffer) override; |
44 virtual int32_t StopCapture() OVERRIDE; | 44 virtual int32_t StopCapture() override; |
45 virtual void Close() OVERRIDE; | 45 virtual void Close() override; |
46 virtual int32_t EnumerateDevicesSync(const PP_ArrayOutput& devices) OVERRIDE; | 46 virtual int32_t EnumerateDevicesSync(const PP_ArrayOutput& devices) override; |
47 | 47 |
48 protected: | 48 protected: |
49 // Resource override. | 49 // Resource override. |
50 virtual void LastPluginRefWasDeleted() OVERRIDE; | 50 virtual void LastPluginRefWasDeleted() override; |
51 | 51 |
52 private: | 52 private: |
53 enum OpenState { | 53 enum OpenState { |
54 BEFORE_OPEN, | 54 BEFORE_OPEN, |
55 OPENED, | 55 OPENED, |
56 CLOSED | 56 CLOSED |
57 }; | 57 }; |
58 | 58 |
59 // PluginResource overrides. | 59 // PluginResource overrides. |
60 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, | 60 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, |
61 const IPC::Message& msg) OVERRIDE; | 61 const IPC::Message& msg) override; |
62 | 62 |
63 void OnPluginMsgOnDeviceInfo(const ResourceMessageReplyParams& params, | 63 void OnPluginMsgOnDeviceInfo(const ResourceMessageReplyParams& params, |
64 const struct PP_VideoCaptureDeviceInfo_Dev& info, | 64 const struct PP_VideoCaptureDeviceInfo_Dev& info, |
65 const std::vector<HostResource>& buffers, | 65 const std::vector<HostResource>& buffers, |
66 uint32_t buffer_size); | 66 uint32_t buffer_size); |
67 void OnPluginMsgOnStatus(const ResourceMessageReplyParams& params, | 67 void OnPluginMsgOnStatus(const ResourceMessageReplyParams& params, |
68 uint32_t status); | 68 uint32_t status); |
69 void OnPluginMsgOnError(const ResourceMessageReplyParams& params, | 69 void OnPluginMsgOnError(const ResourceMessageReplyParams& params, |
70 uint32_t error); | 70 uint32_t error); |
71 void OnPluginMsgOnBufferReady(const ResourceMessageReplyParams& params, | 71 void OnPluginMsgOnBufferReady(const ResourceMessageReplyParams& params, |
(...skipping 15 matching lines...) Expand all Loading... |
87 | 87 |
88 DeviceEnumerationResourceHelper enumeration_helper_; | 88 DeviceEnumerationResourceHelper enumeration_helper_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(VideoCaptureResource); | 90 DISALLOW_COPY_AND_ASSIGN(VideoCaptureResource); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace proxy | 93 } // namespace proxy |
94 } // namespace ppapi | 94 } // namespace ppapi |
95 | 95 |
96 #endif // PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_ | 96 #endif // PPAPI_PROXY_VIDEO_CAPTURE_RESOURCE_H_ |
OLD | NEW |