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