[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 1 | // Copyright 2013 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. |
| 4 | |
| 5 | #ifndef PPAPI_PROXY_PPB_TCP_SOCKET_PROXY_H_ |
| 6 | #define PPAPI_PROXY_PPB_TCP_SOCKET_PROXY_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "base/basictypes.h" |
| 11 | #include "ppapi/c/pp_instance.h" |
| 12 | #include "ppapi/c/pp_resource.h" |
| 13 | #include "ppapi/proxy/interface_proxy.h" |
| 14 | #include "ppapi/proxy/ppapi_proxy_export.h" |
| 15 | |
| 16 | struct PP_NetAddress_Private; |
| 17 | |
| 18 | namespace ppapi { |
| 19 | namespace proxy { |
| 20 | |
| 21 | class PPB_TCPSocket_Proxy : public InterfaceProxy { |
| 22 | public: |
| 23 | explicit PPB_TCPSocket_Proxy(Dispatcher* dispatcher); |
| 24 | virtual ~PPB_TCPSocket_Proxy(); |
| 25 | |
| 26 | static PP_Resource CreateProxyResource(PP_Instance instance); |
| 27 | |
| 28 | // InterfaceProxy implementation. |
| 29 | virtual bool OnMessageReceived(const IPC::Message& msg); |
| 30 | |
| 31 | static const ApiID kApiID = API_ID_PPB_TCPSOCKET; |
| 32 | |
| 33 | private: |
| 34 | // Browser->plugin message handlers. |
| 35 | void OnMsgConnectACK(uint32 plugin_dispatcher_id, |
| 36 | uint32 socket_id, |
[email protected] | d981043 | 2013-06-20 21:24:08 | [diff] [blame] | 37 | int32_t result, |
[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 38 | const PP_NetAddress_Private& local_addr, |
| 39 | const PP_NetAddress_Private& remote_addr); |
| 40 | void OnMsgReadACK(uint32 plugin_dispatcher_id, |
| 41 | uint32 socket_id, |
[email protected] | d981043 | 2013-06-20 21:24:08 | [diff] [blame] | 42 | int32_t result, |
[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 43 | const std::string& data); |
| 44 | void OnMsgWriteACK(uint32 plugin_dispatcher_id, |
| 45 | uint32 socket_id, |
[email protected] | d981043 | 2013-06-20 21:24:08 | [diff] [blame] | 46 | int32_t result); |
| 47 | void OnMsgSetOptionACK(uint32 plugin_dispatcher_id, |
| 48 | uint32 socket_id, |
| 49 | int32_t result); |
[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 50 | |
| 51 | DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Proxy); |
| 52 | }; |
| 53 | |
| 54 | } // namespace proxy |
| 55 | } // namespace ppapi |
| 56 | |
| 57 | #endif // PPAPI_PROXY_PPB_TCP_SOCKET_PROXY_H_ |