OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_SOCKET_TCP_SOCKET_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SOCKET_TCP_SOCKET_H_ |
6 #define EXTENSIONS_BROWSER_API_SOCKET_TCP_SOCKET_H_ | 6 #define EXTENSIONS_BROWSER_API_SOCKET_TCP_SOCKET_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "extensions/browser/api/socket/socket.h" | 12 #include "extensions/browser/api/socket/socket.h" |
11 | 13 |
12 // This looks like it should be forward-declarable, but it does some tricky | 14 // This looks like it should be forward-declarable, but it does some tricky |
13 // moves that make it easier to just include it. | 15 // moves that make it easier to just include it. |
14 #include "net/socket/tcp_client_socket.h" | 16 #include "net/socket/tcp_client_socket.h" |
15 #include "net/socket/tcp_server_socket.h" | 17 #include "net/socket/tcp_server_socket.h" |
16 | 18 |
17 namespace net { | 19 namespace net { |
18 class Socket; | 20 class Socket; |
19 } | 21 } |
20 | 22 |
21 namespace extensions { | 23 namespace extensions { |
22 | 24 |
23 class TCPSocket : public Socket { | 25 class TCPSocket : public Socket { |
24 public: | 26 public: |
25 explicit TCPSocket(const std::string& owner_extension_id); | 27 explicit TCPSocket(const std::string& owner_extension_id); |
26 TCPSocket(net::TCPClientSocket* tcp_client_socket, | 28 TCPSocket(net::TCPClientSocket* tcp_client_socket, |
27 const std::string& owner_extension_id, | 29 const std::string& owner_extension_id, |
28 bool is_connected = false); | 30 bool is_connected = false); |
29 | 31 |
30 ~TCPSocket() override; | 32 ~TCPSocket() override; |
31 | 33 |
32 void Connect(const net::AddressList& address, | 34 void Connect(const net::AddressList& address, |
33 const CompletionCallback& callback) override; | 35 const CompletionCallback& callback) override; |
34 void Disconnect() override; | 36 void Disconnect() override; |
35 int Bind(const std::string& address, uint16 port) override; | 37 int Bind(const std::string& address, uint16_t port) override; |
36 void Read(int count, const ReadCompletionCallback& callback) override; | 38 void Read(int count, const ReadCompletionCallback& callback) override; |
37 void RecvFrom(int count, const RecvFromCompletionCallback& callback) override; | 39 void RecvFrom(int count, const RecvFromCompletionCallback& callback) override; |
38 void SendTo(scoped_refptr<net::IOBuffer> io_buffer, | 40 void SendTo(scoped_refptr<net::IOBuffer> io_buffer, |
39 int byte_count, | 41 int byte_count, |
40 const net::IPEndPoint& address, | 42 const net::IPEndPoint& address, |
41 const CompletionCallback& callback) override; | 43 const CompletionCallback& callback) override; |
42 bool SetKeepAlive(bool enable, int delay) override; | 44 bool SetKeepAlive(bool enable, int delay) override; |
43 bool SetNoDelay(bool no_delay) override; | 45 bool SetNoDelay(bool no_delay) override; |
44 int Listen(const std::string& address, | 46 int Listen(const std::string& address, |
45 uint16 port, | 47 uint16_t port, |
46 int backlog, | 48 int backlog, |
47 std::string* error_msg) override; | 49 std::string* error_msg) override; |
48 void Accept(const AcceptCompletionCallback& callback) override; | 50 void Accept(const AcceptCompletionCallback& callback) override; |
49 | 51 |
50 bool IsConnected() override; | 52 bool IsConnected() override; |
51 | 53 |
52 bool GetPeerAddress(net::IPEndPoint* address) override; | 54 bool GetPeerAddress(net::IPEndPoint* address) override; |
53 bool GetLocalAddress(net::IPEndPoint* address) override; | 55 bool GetLocalAddress(net::IPEndPoint* address) override; |
54 | 56 |
55 // Like Disconnect(), only Release() doesn't delete the underlying stream | 57 // Like Disconnect(), only Release() doesn't delete the underlying stream |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // suspended - see sockets_tcp_server.idl. | 176 // suspended - see sockets_tcp_server.idl. |
175 bool persistent_; | 177 bool persistent_; |
176 // Flag indicating whether a connected socket blocks its peer from sending | 178 // Flag indicating whether a connected socket blocks its peer from sending |
177 // more data - see sockets_tcp_server.idl. | 179 // more data - see sockets_tcp_server.idl. |
178 bool paused_; | 180 bool paused_; |
179 }; | 181 }; |
180 | 182 |
181 } // namespace extensions | 183 } // namespace extensions |
182 | 184 |
183 #endif // EXTENSIONS_BROWSER_API_SOCKET_TCP_SOCKET_H_ | 185 #endif // EXTENSIONS_BROWSER_API_SOCKET_TCP_SOCKET_H_ |
OLD | NEW |