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); |
| 42 void OnMsgEnumerateDevices(const ppapi::HostResource& resource); |
38 void OnMsgStartCapture(const ppapi::HostResource& resource, | 43 void OnMsgStartCapture(const ppapi::HostResource& resource, |
| 44 const std::string& device_id, |
39 const PP_VideoCaptureDeviceInfo_Dev& info, | 45 const PP_VideoCaptureDeviceInfo_Dev& info, |
40 uint32_t buffers); | 46 uint32_t buffers); |
41 void OnMsgReuseBuffer(const ppapi::HostResource& resource, | 47 void OnMsgReuseBuffer(const ppapi::HostResource& resource, |
42 uint32_t buffer); | 48 uint32_t buffer); |
43 void OnMsgStopCapture(const ppapi::HostResource& resource); | 49 void OnMsgStopCapture(const ppapi::HostResource& resource); |
44 | 50 |
| 51 // Message handlers in the plugin process. |
| 52 void OnMsgEnumerateDevicesACK( |
| 53 const ppapi::HostResource& resource, |
| 54 int32_t result, |
| 55 const std::vector<ppapi::DeviceRefData>& devices); |
| 56 |
| 57 void EnumerateDevicesACKInHost(int32_t result, |
| 58 const ppapi::HostResource& resource); |
| 59 |
| 60 pp::CompletionCallbackFactory<PPB_VideoCapture_Proxy, |
| 61 ProxyNonThreadSafeRefCount> callback_factory_; |
| 62 |
45 DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Proxy); | 63 DISALLOW_COPY_AND_ASSIGN(PPB_VideoCapture_Proxy); |
46 }; | 64 }; |
47 | 65 |
48 class PPP_VideoCapture_Proxy : public InterfaceProxy { | 66 class PPP_VideoCapture_Proxy : public InterfaceProxy { |
49 public: | 67 public: |
50 explicit PPP_VideoCapture_Proxy(Dispatcher* dispatcher); | 68 explicit PPP_VideoCapture_Proxy(Dispatcher* dispatcher); |
51 virtual ~PPP_VideoCapture_Proxy(); | 69 virtual ~PPP_VideoCapture_Proxy(); |
52 | 70 |
53 static const Info* GetInfo(); | 71 static const Info* GetInfo(); |
54 | 72 |
(...skipping 19 matching lines...) Expand all Loading... |
74 // In the host, this value is always NULL. | 92 // In the host, this value is always NULL. |
75 const PPP_VideoCapture_Dev* ppp_video_capture_impl_; | 93 const PPP_VideoCapture_Dev* ppp_video_capture_impl_; |
76 | 94 |
77 DISALLOW_COPY_AND_ASSIGN(PPP_VideoCapture_Proxy); | 95 DISALLOW_COPY_AND_ASSIGN(PPP_VideoCapture_Proxy); |
78 }; | 96 }; |
79 | 97 |
80 } // namespace proxy | 98 } // namespace proxy |
81 } // namespace ppapi | 99 } // namespace ppapi |
82 | 100 |
83 #endif // PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_ | 101 #endif // PPAPI_PROXY_PPB_VIDEO_CAPTURE_PROXY_H_ |
OLD | NEW |