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 CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "ipc/ipc_listener.h" |
11 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" | 12 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 class PepperHelperImpl; | 16 class PPB_TCPSocket_Private_Impl : public ::ppapi::TCPSocketPrivateImpl, |
16 | 17 public IPC::Listener { |
17 class PPB_TCPSocket_Private_Impl : public ::ppapi::TCPSocketPrivateImpl { | |
18 public: | 18 public: |
19 static PP_Resource CreateResource(PP_Instance instance); | 19 static PP_Resource CreateResource(PP_Instance instance); |
20 static PP_Resource CreateConnectedSocket( | |
21 PP_Instance instance, | |
22 uint32 socket_id, | |
23 const PP_NetAddress_Private& local_addr, | |
24 const PP_NetAddress_Private& remote_addr); | |
25 | 20 |
26 virtual void SendConnect(const std::string& host, uint16_t port) OVERRIDE; | 21 virtual void SendConnect(const std::string& host, uint16_t port) OVERRIDE; |
27 virtual void SendConnectWithNetAddress( | 22 virtual void SendConnectWithNetAddress( |
28 const PP_NetAddress_Private& addr) OVERRIDE; | 23 const PP_NetAddress_Private& addr) OVERRIDE; |
29 virtual void SendSSLHandshake( | 24 virtual void SendSSLHandshake( |
30 const std::string& server_name, | 25 const std::string& server_name, |
31 uint16_t server_port, | 26 uint16_t server_port, |
32 const std::vector<std::vector<char> >& trusted_certs, | 27 const std::vector<std::vector<char> >& trusted_certs, |
33 const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE; | 28 const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE; |
34 virtual void SendRead(int32_t bytes_to_read) OVERRIDE; | 29 virtual void SendRead(int32_t bytes_to_read) OVERRIDE; |
35 virtual void SendWrite(const std::string& buffer) OVERRIDE; | 30 virtual void SendWrite(const std::string& buffer) OVERRIDE; |
36 virtual void SendDisconnect() OVERRIDE; | 31 virtual void SendDisconnect() OVERRIDE; |
37 virtual void SendSetOption(PP_TCPSocket_Option name, | 32 virtual void SendSetOption(PP_TCPSocket_Option name, |
38 const ::ppapi::SocketOptionData& value) OVERRIDE; | 33 const ::ppapi::SocketOptionData& value) OVERRIDE; |
39 | 34 |
40 private: | 35 private: |
41 PPB_TCPSocket_Private_Impl(PP_Instance instance, uint32 socket_id); | 36 PPB_TCPSocket_Private_Impl(PP_Instance instance, |
| 37 uint32 socket_id, |
| 38 int routing_id); |
42 virtual ~PPB_TCPSocket_Private_Impl(); | 39 virtual ~PPB_TCPSocket_Private_Impl(); |
43 | 40 |
44 static PepperHelperImpl* GetHelper(PP_Instance instance); | 41 // IPC::Listener implementation. |
| 42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 43 |
| 44 void OnTCPSocketConnectACK(uint32 plugin_dispatcher_id, |
| 45 uint32 socket_id, |
| 46 int32_t result, |
| 47 const PP_NetAddress_Private& local_addr, |
| 48 const PP_NetAddress_Private& remote_addr); |
| 49 void OnTCPSocketSSLHandshakeACK( |
| 50 uint32 plugin_dispatcher_id, |
| 51 uint32 socket_id, |
| 52 bool succeeded, |
| 53 const ppapi::PPB_X509Certificate_Fields& certificate_fields); |
| 54 void OnTCPSocketReadACK(uint32 plugin_dispatcher_id, |
| 55 uint32 socket_id, |
| 56 int32_t result, |
| 57 const std::string& data); |
| 58 void OnTCPSocketWriteACK(uint32 plugin_dispatcher_id, |
| 59 uint32 socket_id, |
| 60 int32_t result); |
| 61 void OnTCPSocketSetOptionACK(uint32 plugin_dispatcher_id, |
| 62 uint32 socket_id, |
| 63 int32_t result); |
| 64 |
| 65 int routing_id_; |
45 | 66 |
46 DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Private_Impl); | 67 DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Private_Impl); |
47 }; | 68 }; |
48 | 69 |
49 } // namespace content | 70 } // namespace content |
50 | 71 |
51 #endif // CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ | 72 #endif // CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ |
OLD | NEW |