OLD | NEW |
1 // Copyright (c) 2011 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_PPB_VIDEO_CAPTURE_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_ |
7 | 7 |
| 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "ppapi/c/pp_instance.h" | 11 #include "ppapi/c/pp_instance.h" |
11 #include "ppapi/proxy/interface_proxy.h" | 12 #include "ppapi/proxy/interface_proxy.h" |
| 13 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
12 #include "ppapi/proxy/serialized_structs.h" | 14 #include "ppapi/proxy/serialized_structs.h" |
| 15 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
| 16 #include "ppapi/utility/completion_callback_factory.h" |
13 | 17 |
14 struct PPP_VideoCapture_Dev; | 18 struct PPP_VideoCapture_Dev; |
15 struct PP_VideoCaptureDeviceInfo_Dev; | 19 struct PP_VideoCaptureDeviceInfo_Dev; |
16 | 20 |
17 namespace ppapi { | 21 namespace ppapi { |
18 | 22 |
19 class HostResource; | 23 class HostResource; |
20 | 24 |
21 namespace proxy { | 25 namespace proxy { |
22 | 26 |
23 class PPB_VideoCapture_Proxy : public InterfaceProxy { | 27 class PPB_VideoCapture_Proxy : public InterfaceProxy { |
24 public: | 28 public: |
25 explicit PPB_VideoCapture_Proxy(Dispatcher* dispatcher); | 29 explicit PPB_VideoCapture_Proxy(Dispatcher* dispatcher); |
26 virtual ~PPB_VideoCapture_Proxy(); | 30 virtual ~PPB_VideoCapture_Proxy(); |
27 | 31 |
28 static PP_Resource CreateProxyResource(PP_Instance instance); | 32 static PP_Resource CreateProxyResource(PP_Instance instance); |
29 | 33 |
30 // InterfaceProxy implementation. | 34 // InterfaceProxy implementation. |
31 virtual bool OnMessageReceived(const IPC::Message& msg); | 35 virtual bool OnMessageReceived(const IPC::Message& msg); |
32 | 36 |
33 static const ApiID kApiID = API_ID_PPB_VIDEO_CAPTURE_DEV; | 37 static const ApiID kApiID = API_ID_PPB_VIDEO_CAPTURE_DEV; |
34 | 38 |
35 private: | 39 private: |
36 // Message handlers. | 40 // Message handlers in the renderer process. |
37 void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result_resource); | 41 void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result_resource); |
38 void OnMsgStartCapture(const ppapi::HostResource& resource, | 42 void OnMsgEnumerateDevices(const ppapi::HostResource& resource); |
39 const PP_VideoCaptureDeviceInfo_Dev& info, | 43 void OnMsgOpen(const ppapi::HostResource& resource, |
40 uint32_t buffers); | 44 const std::string& device_id, |
| 45 const PP_VideoCaptureDeviceInfo_Dev& info, |
| 46 uint32_t buffers); |
| 47 void OnMsgStartCapture(const ppapi::HostResource& resource); |
41 void OnMsgReuseBuffer(const ppapi::HostResource& resource, | 48 void OnMsgReuseBuffer(const ppapi::HostResource& resource, |
42 uint32_t buffer); | 49 uint32_t buffer); |
43 void OnMsgStopCapture(const ppapi::HostResource& resource); | 50 void OnMsgStopCapture(const ppapi::HostResource& resource); |
| 51 void OnMsgClose(const ppapi::HostResource& resource); |
| 52 void OnMsgStartCapture0_1(const ppapi::HostResource& resource, |
| 53 const PP_VideoCaptureDeviceInfo_Dev& info, |
| 54 uint32_t buffers); |
| 55 |
| 56 // Message handlers in the plugin process. |
| 57 void OnMsgEnumerateDevicesACK( |
| 58 const ppapi::HostResource& resource, |
| 59 int32_t result, |
| 60 const std::vector<ppapi::DeviceRefData>& devices); |
| 61 void OnMsgOpenACK(const ppapi::HostResource& resource, int32_t result); |
| 62 |
| 63 void EnumerateDevicesACKInHost(int32_t result, |
| 64 const ppapi::HostResource& resource); |
| 65 void OpenACKInHost(int32_t result, const ppapi::HostResource& resource); |
| 66 |
| 67 pp::CompletionCallbackFactory<PPB_VideoCapture_Proxy, |
| 68 ProxyNonThreadSafeRefCount> callback_factory_; |
44 | 69 |
45 DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Proxy); | 70 DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Proxy); |
46 }; | 71 }; |
47 | 72 |
48 class PPP_VideoCapture_Proxy : public InterfaceProxy { | 73 class PPP_VideoCapture_Proxy : public InterfaceProxy { |
49 public: | 74 public: |
50 explicit PPP_VideoCapture_Proxy(Dispatcher* dispatcher); | 75 explicit PPP_VideoCapture_Proxy(Dispatcher* dispatcher); |
51 virtual ~PPP_VideoCapture_Proxy(); | 76 virtual ~PPP_VideoCapture_Proxy(); |
52 | 77 |
53 static const Info* GetInfo(); | 78 static const Info* GetInfo(); |
(...skipping 20 matching lines...) Expand all Loading... |
74 // In the host, this value is always NULL. | 99 // In the host, this value is always NULL. |
75 const PPP_VideoCapture_Dev* ppp_video_capture_impl_; | 100 const PPP_VideoCapture_Dev* ppp_video_capture_impl_; |
76 | 101 |
77 DISALLOW_COPY_AND_ASSIGN(PPP_VideoCapture_Proxy); | 102 DISALLOW_COPY_AND_ASSIGN(PPP_VideoCapture_Proxy); |
78 }; | 103 }; |
79 | 104 |
80 } // namespace proxy | 105 } // namespace proxy |
81 } // namespace ppapi | 106 } // namespace ppapi |
82 | 107 |
83 #endif // PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_ | 108 #endif // PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_ |
OLD | NEW |