OLD | NEW |
1 // Copyright 2013 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_PROXY_TCP_SOCKET_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ |
6 #define PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ | 6 #define PPAPI_PROXY_TCP_SOCKET_RESOURCE_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 "ppapi/proxy/tcp_socket_resource_base.h" | 10 #include "ppapi/proxy/tcp_socket_resource_base.h" |
11 #include "ppapi/thunk/ppb_tcp_socket_api.h" | 11 #include "ppapi/thunk/ppb_tcp_socket_api.h" |
12 | 12 |
13 namespace ppapi { | 13 namespace ppapi { |
14 | 14 |
15 enum TCPSocketVersion; | 15 enum TCPSocketVersion; |
16 | 16 |
17 namespace proxy { | 17 namespace proxy { |
18 | 18 |
19 class PPAPI_PROXY_EXPORT TCPSocketResource : public thunk::PPB_TCPSocket_API, | 19 class PPAPI_PROXY_EXPORT TCPSocketResource : public thunk::PPB_TCPSocket_API, |
20 public TCPSocketResourceBase { | 20 public TCPSocketResourceBase { |
21 public: | 21 public: |
22 // C-tor used for new sockets created. | 22 // C-tor used for new sockets created. |
23 TCPSocketResource(Connection connection, | 23 TCPSocketResource(Connection connection, |
24 PP_Instance instance, | 24 PP_Instance instance, |
25 TCPSocketVersion version); | 25 TCPSocketVersion version); |
26 | 26 |
27 virtual ~TCPSocketResource(); | 27 ~TCPSocketResource() override; |
28 | 28 |
29 // PluginResource overrides. | 29 // PluginResource overrides. |
30 virtual thunk::PPB_TCPSocket_API* AsPPB_TCPSocket_API() override; | 30 thunk::PPB_TCPSocket_API* AsPPB_TCPSocket_API() override; |
31 | 31 |
32 // thunk::PPB_TCPSocket_API implementation. | 32 // thunk::PPB_TCPSocket_API implementation. |
33 virtual int32_t Bind(PP_Resource addr, | 33 int32_t Bind(PP_Resource addr, |
34 scoped_refptr<TrackedCallback> callback) override; | 34 scoped_refptr<TrackedCallback> callback) override; |
35 virtual int32_t Connect(PP_Resource addr, | 35 int32_t Connect(PP_Resource addr, |
36 scoped_refptr<TrackedCallback> callback) override; | 36 scoped_refptr<TrackedCallback> callback) override; |
37 virtual PP_Resource GetLocalAddress() override; | 37 PP_Resource GetLocalAddress() override; |
38 virtual PP_Resource GetRemoteAddress() override; | 38 PP_Resource GetRemoteAddress() override; |
39 virtual int32_t Read(char* buffer, | 39 int32_t Read(char* buffer, |
40 int32_t bytes_to_read, | 40 int32_t bytes_to_read, |
41 scoped_refptr<TrackedCallback> callback) override; | 41 scoped_refptr<TrackedCallback> callback) override; |
42 virtual int32_t Write(const char* buffer, | 42 int32_t Write(const char* buffer, |
43 int32_t bytes_to_write, | 43 int32_t bytes_to_write, |
44 scoped_refptr<TrackedCallback> callback) override; | 44 scoped_refptr<TrackedCallback> callback) override; |
45 virtual int32_t Listen(int32_t backlog, | 45 int32_t Listen(int32_t backlog, |
46 scoped_refptr<TrackedCallback> callback) override; | 46 scoped_refptr<TrackedCallback> callback) override; |
47 virtual int32_t Accept(PP_Resource* accepted_tcp_socket, | 47 int32_t Accept(PP_Resource* accepted_tcp_socket, |
48 scoped_refptr<TrackedCallback> callback) override; | 48 scoped_refptr<TrackedCallback> callback) override; |
49 virtual void Close() override; | 49 void Close() override; |
50 virtual int32_t SetOption1_1( | 50 int32_t SetOption1_1( |
51 PP_TCPSocket_Option name, | 51 PP_TCPSocket_Option name, |
52 const PP_Var& value, | 52 const PP_Var& value, |
53 scoped_refptr<TrackedCallback> callback) override; | 53 scoped_refptr<TrackedCallback> callback) override; |
54 virtual int32_t SetOption(PP_TCPSocket_Option name, | 54 int32_t SetOption(PP_TCPSocket_Option name, |
55 const PP_Var& value, | 55 const PP_Var& value, |
56 scoped_refptr<TrackedCallback> callback) override; | 56 scoped_refptr<TrackedCallback> callback) override; |
57 | 57 |
58 // TCPSocketResourceBase implementation. | 58 // TCPSocketResourceBase implementation. |
59 virtual PP_Resource CreateAcceptedSocket( | 59 PP_Resource CreateAcceptedSocket( |
60 int pending_host_id, | 60 int pending_host_id, |
61 const PP_NetAddress_Private& local_addr, | 61 const PP_NetAddress_Private& local_addr, |
62 const PP_NetAddress_Private& remote_addr) override; | 62 const PP_NetAddress_Private& remote_addr) override; |
63 | 63 |
64 private: | 64 private: |
65 // C-tor used for accepted sockets. | 65 // C-tor used for accepted sockets. |
66 TCPSocketResource(Connection connection, | 66 TCPSocketResource(Connection connection, |
67 PP_Instance instance, | 67 PP_Instance instance, |
68 int pending_host_id, | 68 int pending_host_id, |
69 const PP_NetAddress_Private& local_addr, | 69 const PP_NetAddress_Private& local_addr, |
70 const PP_NetAddress_Private& remote_addr); | 70 const PP_NetAddress_Private& remote_addr); |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(TCPSocketResource); | 72 DISALLOW_COPY_AND_ASSIGN(TCPSocketResource); |
73 }; | 73 }; |
74 | 74 |
75 } // namespace proxy | 75 } // namespace proxy |
76 } // namespace ppapi | 76 } // namespace ppapi |
77 | 77 |
78 #endif // PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ | 78 #endif // PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ |
OLD | NEW |