OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PPB_VIDEO_CAPTURE_PROXY_H_ | 5 #ifndef PPAPI_PPB_VIDEO_CAPTURE_PROXY_H_ |
6 #define PPAPI_PPB_VIDEO_CAPTURE_PROXY_H_ | 6 #define PPAPI_PPB_VIDEO_CAPTURE_PROXY_H_ |
7 | 7 |
8 #include "ppapi/c/pp_instance.h" | 8 #include "ppapi/c/pp_instance.h" |
9 #include "ppapi/proxy/interface_proxy.h" | 9 #include "ppapi/proxy/interface_proxy.h" |
10 #include "ppapi/proxy/serialized_structs.h" | 10 #include "ppapi/proxy/serialized_structs.h" |
11 | 11 |
12 struct PPB_VideoCapture_Dev; | 12 struct PPB_VideoCapture_Dev; |
13 struct PPP_VideoCapture_Dev; | 13 struct PPP_VideoCapture_Dev; |
14 struct PP_VideoCaptureDeviceInfo_Dev; | 14 struct PP_VideoCaptureDeviceInfo_Dev; |
15 | 15 |
| 16 namespace ppapi { |
| 17 class HostResource; |
| 18 } |
| 19 |
16 namespace pp { | 20 namespace pp { |
17 namespace proxy { | 21 namespace proxy { |
18 | 22 |
19 class HostResource; | |
20 | |
21 class PPB_VideoCapture_Proxy : public InterfaceProxy { | 23 class PPB_VideoCapture_Proxy : public InterfaceProxy { |
22 public: | 24 public: |
23 PPB_VideoCapture_Proxy(Dispatcher* dispatcher, const void* target_interface); | 25 PPB_VideoCapture_Proxy(Dispatcher* dispatcher, const void* target_interface); |
24 virtual ~PPB_VideoCapture_Proxy(); | 26 virtual ~PPB_VideoCapture_Proxy(); |
25 | 27 |
26 static const Info* GetInfo(); | 28 static const Info* GetInfo(); |
27 | 29 |
28 static PP_Resource CreateProxyResource(PP_Instance instance); | 30 static PP_Resource CreateProxyResource(PP_Instance instance); |
29 | 31 |
30 const PPB_VideoCapture_Dev* ppb_video_capture_target() const { | 32 const PPB_VideoCapture_Dev* ppb_video_capture_target() const { |
31 return static_cast<const PPB_VideoCapture_Dev*>(target_interface()); | 33 return static_cast<const PPB_VideoCapture_Dev*>(target_interface()); |
32 } | 34 } |
33 | 35 |
34 // InterfaceProxy implementation. | 36 // InterfaceProxy implementation. |
35 virtual bool OnMessageReceived(const IPC::Message& msg); | 37 virtual bool OnMessageReceived(const IPC::Message& msg); |
36 | 38 |
37 private: | 39 private: |
38 // Message handlers. | 40 // Message handlers. |
39 void OnMsgCreate(PP_Instance instance, HostResource* result_resource); | 41 void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result_resource); |
40 void OnMsgStartCapture(const HostResource& resource, | 42 void OnMsgStartCapture(const ppapi::HostResource& resource, |
41 const PP_VideoCaptureDeviceInfo_Dev& info, | 43 const PP_VideoCaptureDeviceInfo_Dev& info, |
42 uint32_t buffers); | 44 uint32_t buffers); |
43 void OnMsgReuseBuffer(const HostResource& resource, | 45 void OnMsgReuseBuffer(const ppapi::HostResource& resource, |
44 uint32_t buffer); | 46 uint32_t buffer); |
45 void OnMsgStopCapture(const HostResource& resource); | 47 void OnMsgStopCapture(const ppapi::HostResource& resource); |
46 }; | 48 }; |
47 | 49 |
48 class PPP_VideoCapture_Proxy : public InterfaceProxy { | 50 class PPP_VideoCapture_Proxy : public InterfaceProxy { |
49 public: | 51 public: |
50 PPP_VideoCapture_Proxy(Dispatcher* dispatcher, const void* target_interface); | 52 PPP_VideoCapture_Proxy(Dispatcher* dispatcher, const void* target_interface); |
51 virtual ~PPP_VideoCapture_Proxy(); | 53 virtual ~PPP_VideoCapture_Proxy(); |
52 | 54 |
53 static const Info* GetInfo(); | 55 static const Info* GetInfo(); |
54 | 56 |
55 const PPP_VideoCapture_Dev* ppp_video_capture_target() const { | 57 const PPP_VideoCapture_Dev* ppp_video_capture_target() const { |
56 return static_cast<const PPP_VideoCapture_Dev*>(target_interface()); | 58 return static_cast<const PPP_VideoCapture_Dev*>(target_interface()); |
57 } | 59 } |
58 | 60 |
59 // InterfaceProxy implementation. | 61 // InterfaceProxy implementation. |
60 virtual bool OnMessageReceived(const IPC::Message& msg); | 62 virtual bool OnMessageReceived(const IPC::Message& msg); |
61 | 63 |
62 private: | 64 private: |
63 // Message handlers. | 65 // Message handlers. |
64 void OnMsgOnDeviceInfo(const HostResource& video_capture, | 66 void OnMsgOnDeviceInfo(const ppapi::HostResource& video_capture, |
65 const PP_VideoCaptureDeviceInfo_Dev& info, | 67 const PP_VideoCaptureDeviceInfo_Dev& info, |
66 const std::vector<PPPVideoCapture_Buffer>& buffers); | 68 const std::vector<PPPVideoCapture_Buffer>& buffers); |
67 void OnMsgOnStatus(const HostResource& video_capture, | 69 void OnMsgOnStatus(const ppapi::HostResource& video_capture, |
68 uint32_t status); | 70 uint32_t status); |
69 void OnMsgOnError(const HostResource& video_capture, | 71 void OnMsgOnError(const ppapi::HostResource& video_capture, |
70 uint32_t error_code); | 72 uint32_t error_code); |
71 void OnMsgOnBufferReady(const HostResource& video_capture, | 73 void OnMsgOnBufferReady(const ppapi::HostResource& video_capture, |
72 uint32_t buffer); | 74 uint32_t buffer); |
73 }; | 75 }; |
74 | 76 |
75 } // namespace proxy | 77 } // namespace proxy |
76 } // namespace pp | 78 } // namespace pp |
77 | 79 |
78 #endif // PPAPI_PPB_VIDEO_CAPTURE_PROXY_H_ | 80 #endif // PPAPI_PPB_VIDEO_CAPTURE_PROXY_H_ |
OLD | NEW |