| 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 WEBKIT_PLUGINS_PPAPI_PPB_FLASH_NET_CONNECTOR_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FLASH_NET_CONNECTOR_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FLASH_NET_CONNECTOR_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FLASH_NET_CONNECTOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "ppapi/c/private/ppb_flash_net_connector.h" | 11 #include "ppapi/c/private/ppb_flash_net_connector.h" |
| 12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
| 13 #include "ppapi/thunk/ppb_flash_net_connector_api.h" | 13 #include "ppapi/thunk/ppb_flash_net_connector_api.h" |
| 14 #include "webkit/plugins/ppapi/callbacks.h" | 14 #include "webkit/plugins/ppapi/callbacks.h" |
| 15 #include "webkit/plugins/webkit_plugins_export.h" |
| 15 | 16 |
| 16 namespace webkit { | 17 namespace webkit { |
| 17 namespace ppapi { | 18 namespace ppapi { |
| 18 | 19 |
| 19 class PPB_Flash_NetConnector_Impl | 20 class PPB_Flash_NetConnector_Impl |
| 20 : public ::ppapi::Resource, | 21 : public ::ppapi::Resource, |
| 21 public ::ppapi::thunk::PPB_Flash_NetConnector_API { | 22 public ::ppapi::thunk::PPB_Flash_NetConnector_API { |
| 22 public: | 23 public: |
| 23 explicit PPB_Flash_NetConnector_Impl(PP_Instance instance); | 24 explicit PPB_Flash_NetConnector_Impl(PP_Instance instance); |
| 24 virtual ~PPB_Flash_NetConnector_Impl(); | 25 virtual ~PPB_Flash_NetConnector_Impl(); |
| 25 | 26 |
| 26 // Resource override. | 27 // Resource override. |
| 27 virtual ::ppapi::thunk::PPB_Flash_NetConnector_API* | 28 virtual ::ppapi::thunk::PPB_Flash_NetConnector_API* |
| 28 AsPPB_Flash_NetConnector_API() OVERRIDE; | 29 AsPPB_Flash_NetConnector_API() OVERRIDE; |
| 29 | 30 |
| 30 // PPB_Flash_NetConnector implementation. | 31 // PPB_Flash_NetConnector implementation. |
| 31 virtual int32_t ConnectTcp(const char* host, | 32 virtual int32_t ConnectTcp(const char* host, |
| 32 uint16_t port, | 33 uint16_t port, |
| 33 PP_FileHandle* socket_out, | 34 PP_FileHandle* socket_out, |
| 34 PP_NetAddress_Private* local_addr_out, | 35 PP_NetAddress_Private* local_addr_out, |
| 35 PP_NetAddress_Private* remote_addr_out, | 36 PP_NetAddress_Private* remote_addr_out, |
| 36 PP_CompletionCallback callback) OVERRIDE; | 37 PP_CompletionCallback callback) OVERRIDE; |
| 37 virtual int32_t ConnectTcpAddress(const PP_NetAddress_Private* addr, | 38 virtual int32_t ConnectTcpAddress(const PP_NetAddress_Private* addr, |
| 38 PP_FileHandle* socket_out, | 39 PP_FileHandle* socket_out, |
| 39 PP_NetAddress_Private* local_addr_out, | 40 PP_NetAddress_Private* local_addr_out, |
| 40 PP_NetAddress_Private* remote_addr_out, | 41 PP_NetAddress_Private* remote_addr_out, |
| 41 PP_CompletionCallback callback) OVERRIDE; | 42 PP_CompletionCallback callback) OVERRIDE; |
| 42 | 43 |
| 43 // Called to complete |ConnectTcp()| and |ConnectTcpAddress()|. | 44 // Called to complete |ConnectTcp()| and |ConnectTcpAddress()|. |
| 44 void CompleteConnectTcp(PP_FileHandle socket, | 45 WEBKIT_PLUGINS_EXPORT void CompleteConnectTcp( |
| 45 const PP_NetAddress_Private& local_addr, | 46 PP_FileHandle socket, |
| 46 const PP_NetAddress_Private& remote_addr); | 47 const PP_NetAddress_Private& local_addr, |
| 48 const PP_NetAddress_Private& remote_addr); |
| 47 | 49 |
| 48 private: | 50 private: |
| 49 // Any pending callback (for |ConnectTcp()| or |ConnectTcpAddress()|). | 51 // Any pending callback (for |ConnectTcp()| or |ConnectTcpAddress()|). |
| 50 scoped_refptr<TrackedCompletionCallback> callback_; | 52 scoped_refptr<TrackedCompletionCallback> callback_; |
| 51 | 53 |
| 52 // Output buffers to be filled in when the callback is completed successfully | 54 // Output buffers to be filled in when the callback is completed successfully |
| 53 // (|{local,remote}_addr_out| are optional and may be null). | 55 // (|{local,remote}_addr_out| are optional and may be null). |
| 54 PP_FileHandle* socket_out_; | 56 PP_FileHandle* socket_out_; |
| 55 PP_NetAddress_Private* local_addr_out_; | 57 PP_NetAddress_Private* local_addr_out_; |
| 56 PP_NetAddress_Private* remote_addr_out_; | 58 PP_NetAddress_Private* remote_addr_out_; |
| 57 | 59 |
| 58 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_NetConnector_Impl); | 60 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_NetConnector_Impl); |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 } // namespace ppapi | 63 } // namespace ppapi |
| 62 } // namespace webkit | 64 } // namespace webkit |
| 63 | 65 |
| 64 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FLASH_NET_CONNECTOR_IMPL_H_ | 66 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FLASH_NET_CONNECTOR_IMPL_H_ |
| OLD | NEW |