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