| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ | |
| 6 #define PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 10 #include "ppapi/shared_impl/resource.h" | 7 #include "ppapi/proxy/tcp_socket_base_resource.h" |
| 11 #include "ppapi/shared_impl/tcp_socket_shared.h" | |
| 12 #include "ppapi/thunk/ppb_tcp_socket_private_api.h" | 8 #include "ppapi/thunk/ppb_tcp_socket_private_api.h" |
| 13 | 9 |
| 14 namespace ppapi { | 10 namespace ppapi { |
| 11 namespace proxy { |
| 15 | 12 |
| 16 // This class provides the shared implementation of a | 13 class PPAPI_PROXY_EXPORT TCPSocketPrivateResource |
| 17 // PPB_TCPSocket_Private. The functions that actually send messages | |
| 18 // to browser are implemented differently for the proxied and | |
| 19 // non-proxied derived classes. | |
| 20 class PPAPI_SHARED_EXPORT TCPSocketPrivateImpl | |
| 21 : public thunk::PPB_TCPSocket_Private_API, | 14 : public thunk::PPB_TCPSocket_Private_API, |
| 22 public Resource, | 15 public TCPSocketBaseResource { |
| 23 public TCPSocketShared { | |
| 24 public: | 16 public: |
| 25 // C-tor used in Impl case. | 17 TCPSocketPrivateResource(Connection connection, PP_Instance instance); |
| 26 TCPSocketPrivateImpl(PP_Instance instance, uint32 socket_id); | 18 TCPSocketPrivateResource(Connection connection, |
| 27 // C-tor used in Proxy case. | 19 PP_Instance instance, |
| 28 TCPSocketPrivateImpl(const HostResource& resource, uint32 socket_id); | 20 int pending_resource_id, |
| 21 const PP_NetAddress_Private& local_addr, |
| 22 const PP_NetAddress_Private& remote_addr); |
| 23 virtual ~TCPSocketPrivateResource(); |
| 29 | 24 |
| 30 virtual ~TCPSocketPrivateImpl(); | 25 // PluginResource overrides. |
| 31 | |
| 32 // Resource overrides. | |
| 33 virtual PPB_TCPSocket_Private_API* AsPPB_TCPSocket_Private_API() OVERRIDE; | 26 virtual PPB_TCPSocket_Private_API* AsPPB_TCPSocket_Private_API() OVERRIDE; |
| 34 | 27 |
| 35 // PPB_TCPSocket_Private_API implementation. | 28 // PPB_TCPSocket_Private_API implementation. |
| 36 virtual int32_t Connect(const char* host, | 29 virtual int32_t Connect(const char* host, |
| 37 uint16_t port, | 30 uint16_t port, |
| 38 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 31 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 39 virtual int32_t ConnectWithNetAddress( | 32 virtual int32_t ConnectWithNetAddress( |
| 40 const PP_NetAddress_Private* addr, | 33 const PP_NetAddress_Private* addr, |
| 41 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 34 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 42 virtual PP_Bool GetLocalAddress(PP_NetAddress_Private* local_addr) OVERRIDE; | 35 virtual PP_Bool GetLocalAddress(PP_NetAddress_Private* local_addr) OVERRIDE; |
| 43 virtual PP_Bool GetRemoteAddress(PP_NetAddress_Private* remote_addr) OVERRIDE; | 36 virtual PP_Bool GetRemoteAddress(PP_NetAddress_Private* remote_addr) OVERRIDE; |
| 44 virtual int32_t SSLHandshake( | 37 virtual int32_t SSLHandshake( |
| 45 const char* server_name, | 38 const char* server_name, |
| 46 uint16_t server_port, | 39 uint16_t server_port, |
| 47 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 40 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 48 virtual PP_Resource GetServerCertificate() OVERRIDE; | 41 virtual PP_Resource GetServerCertificate() OVERRIDE; |
| 49 virtual PP_Bool AddChainBuildingCertificate(PP_Resource certificate, | 42 virtual PP_Bool AddChainBuildingCertificate(PP_Resource certificate, |
| 50 PP_Bool trusted) OVERRIDE; | 43 PP_Bool trusted) OVERRIDE; |
| 51 virtual int32_t Read(char* buffer, | 44 virtual int32_t Read(char* buffer, |
| 52 int32_t bytes_to_read, | 45 int32_t bytes_to_read, |
| 53 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 46 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 54 virtual int32_t Write(const char* buffer, | 47 virtual int32_t Write(const char* buffer, |
| 55 int32_t bytes_to_write, | 48 int32_t bytes_to_write, |
| 56 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 49 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 57 virtual void Disconnect() OVERRIDE; | 50 virtual void Disconnect() OVERRIDE; |
| 58 virtual int32_t SetOption(PP_TCPSocketOption_Private name, | 51 virtual int32_t SetOption(PP_TCPSocketOption_Private name, |
| 59 const PP_Var& value, | 52 const PP_Var& value, |
| 60 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 53 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 61 | 54 |
| 62 // TCPSocketShared implementation. | |
| 63 virtual Resource* GetOwnerResource() OVERRIDE; | |
| 64 | |
| 65 // TCPSocketShared overrides. | |
| 66 virtual int32_t OverridePPError(int32_t pp_error) OVERRIDE; | |
| 67 | |
| 68 private: | 55 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(TCPSocketPrivateImpl); | 56 DISALLOW_COPY_AND_ASSIGN(TCPSocketPrivateResource); |
| 70 }; | 57 }; |
| 71 | 58 |
| 59 } // namespace proxy |
| 72 } // namespace ppapi | 60 } // namespace ppapi |
| 73 | |
| 74 #endif // PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ | |
| OLD | NEW |