| 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 "content/public/renderer/render_view_observer.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 RenderViewObserver { |
| 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( | 20 static PP_Resource CreateConnectedSocket( |
| 21 PP_Instance instance, | 21 PP_Instance instance, |
| 22 uint32 socket_id, | 22 uint32 socket_id, |
| 23 const PP_NetAddress_Private& local_addr, | 23 const PP_NetAddress_Private& local_addr, |
| 24 const PP_NetAddress_Private& remote_addr); | 24 const PP_NetAddress_Private& remote_addr); |
| 25 | 25 |
| 26 virtual void SendConnect(const std::string& host, uint16_t port) OVERRIDE; | 26 virtual void SendConnect(const std::string& host, uint16_t port) OVERRIDE; |
| 27 virtual void SendConnectWithNetAddress( | 27 virtual void SendConnectWithNetAddress( |
| 28 const PP_NetAddress_Private& addr) OVERRIDE; | 28 const PP_NetAddress_Private& addr) OVERRIDE; |
| 29 virtual void SendSSLHandshake( | 29 virtual void SendSSLHandshake( |
| 30 const std::string& server_name, | 30 const std::string& server_name, |
| 31 uint16_t server_port, | 31 uint16_t server_port, |
| 32 const std::vector<std::vector<char> >& trusted_certs, | 32 const std::vector<std::vector<char> >& trusted_certs, |
| 33 const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE; | 33 const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE; |
| 34 virtual void SendRead(int32_t bytes_to_read) OVERRIDE; | 34 virtual void SendRead(int32_t bytes_to_read) OVERRIDE; |
| 35 virtual void SendWrite(const std::string& buffer) OVERRIDE; | 35 virtual void SendWrite(const std::string& buffer) OVERRIDE; |
| 36 virtual void SendDisconnect() OVERRIDE; | 36 virtual void SendDisconnect() OVERRIDE; |
| 37 virtual void SendSetOption(PP_TCPSocket_Option name, | 37 virtual void SendSetOption(PP_TCPSocket_Option name, |
| 38 const ::ppapi::SocketOptionData& value) OVERRIDE; | 38 const ::ppapi::SocketOptionData& value) OVERRIDE; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 PPB_TCPSocket_Private_Impl(PP_Instance instance, uint32 socket_id); | 41 PPB_TCPSocket_Private_Impl(PP_Instance instance, |
| 42 uint32 socket_id, |
| 43 RenderView* render_view); |
| 42 virtual ~PPB_TCPSocket_Private_Impl(); | 44 virtual ~PPB_TCPSocket_Private_Impl(); |
| 43 | 45 |
| 44 static PepperHelperImpl* GetHelper(PP_Instance instance); | 46 // RenderViewObserver implementation. |
| 47 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 48 |
| 49 void OnTCPSocketConnectACK(uint32 plugin_dispatcher_id, |
| 50 uint32 socket_id, |
| 51 int32_t result, |
| 52 const PP_NetAddress_Private& local_addr, |
| 53 const PP_NetAddress_Private& remote_addr); |
| 54 void OnTCPSocketSSLHandshakeACK( |
| 55 uint32 plugin_dispatcher_id, |
| 56 uint32 socket_id, |
| 57 bool succeeded, |
| 58 const ppapi::PPB_X509Certificate_Fields& certificate_fields); |
| 59 void OnTCPSocketReadACK(uint32 plugin_dispatcher_id, |
| 60 uint32 socket_id, |
| 61 int32_t result, |
| 62 const std::string& data); |
| 63 void OnTCPSocketWriteACK(uint32 plugin_dispatcher_id, |
| 64 uint32 socket_id, |
| 65 int32_t result); |
| 66 void OnTCPSocketSetOptionACK(uint32 plugin_dispatcher_id, |
| 67 uint32 socket_id, |
| 68 int32_t result); |
| 69 |
| 70 int routing_id_; |
| 45 | 71 |
| 46 DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Private_Impl); | 72 DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Private_Impl); |
| 47 }; | 73 }; |
| 48 | 74 |
| 49 } // namespace content | 75 } // namespace content |
| 50 | 76 |
| 51 #endif // CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ | 77 #endif // CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ |
| OLD | NEW |