Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/api/socket/socket.h" | 10 #include "chrome/browser/extensions/api/socket/socket.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 virtual bool SetKeepAlive(bool enable, int delay) OVERRIDE; | 46 virtual bool SetKeepAlive(bool enable, int delay) OVERRIDE; |
| 47 virtual bool SetNoDelay(bool no_delay) OVERRIDE; | 47 virtual bool SetNoDelay(bool no_delay) OVERRIDE; |
| 48 virtual int Listen(const std::string& address, int port, | 48 virtual int Listen(const std::string& address, int port, |
| 49 int backlog, std::string* error_msg) OVERRIDE; | 49 int backlog, std::string* error_msg) OVERRIDE; |
| 50 virtual void Accept(const AcceptCompletionCallback &callback) OVERRIDE; | 50 virtual void Accept(const AcceptCompletionCallback &callback) OVERRIDE; |
| 51 | 51 |
| 52 virtual bool IsConnected() OVERRIDE; | 52 virtual bool IsConnected() OVERRIDE; |
| 53 | 53 |
| 54 virtual bool GetPeerAddress(net::IPEndPoint* address) OVERRIDE; | 54 virtual bool GetPeerAddress(net::IPEndPoint* address) OVERRIDE; |
| 55 virtual bool GetLocalAddress(net::IPEndPoint* address) OVERRIDE; | 55 virtual bool GetLocalAddress(net::IPEndPoint* address) OVERRIDE; |
| 56 | |
| 57 // Like Disconnect(), only it doesn't delete the underlying stream or | |
| 58 // attempt to close it. Useful for when someone else takes it over. | |
|
Ryan Sleevi
2013/11/25 17:30:13
comment nit re: pronouns
Lally Singh
2013/12/05 17:07:12
Done.
| |
| 59 virtual void Release(); | |
| 60 | |
| 56 virtual Socket::SocketType GetSocketType() const OVERRIDE; | 61 virtual Socket::SocketType GetSocketType() const OVERRIDE; |
| 57 | 62 |
| 58 static TCPSocket* CreateSocketForTesting( | 63 static TCPSocket* CreateSocketForTesting( |
| 59 net::TCPClientSocket* tcp_client_socket, | 64 net::TCPClientSocket* tcp_client_socket, |
| 60 const std::string& owner_extension_id, | 65 const std::string& owner_extension_id, |
| 61 bool is_connected = false); | 66 bool is_connected = false); |
| 62 static TCPSocket* CreateServerSocketForTesting( | 67 static TCPSocket* CreateServerSocketForTesting( |
| 63 net::TCPServerSocket* tcp_server_socket, | 68 net::TCPServerSocket* tcp_server_socket, |
| 64 const std::string& owner_extension_id); | 69 const std::string& owner_extension_id); |
| 65 | 70 |
| 71 // Returns NULL if GetSocketType isn't TYPE_TCP or if the connection wasn't | |
| 72 // set up via Connect (vs Listen/Accept). | |
| 73 net::TCPClientSocket* ClientStream(); | |
| 74 | |
| 66 protected: | 75 protected: |
| 67 virtual int WriteImpl(net::IOBuffer* io_buffer, | 76 virtual int WriteImpl(net::IOBuffer* io_buffer, |
| 68 int io_buffer_size, | 77 int io_buffer_size, |
| 69 const net::CompletionCallback& callback) OVERRIDE; | 78 const net::CompletionCallback& callback) OVERRIDE; |
| 70 | 79 |
| 71 private: | 80 private: |
| 72 void RefreshConnectionStatus(); | 81 void RefreshConnectionStatus(); |
| 73 void OnConnectComplete(int result); | 82 void OnConnectComplete(int result); |
| 74 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, | 83 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, |
| 75 int result); | 84 int result); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 // suspended - see sockets_tcp_server.idl. | 179 // suspended - see sockets_tcp_server.idl. |
| 171 bool persistent_; | 180 bool persistent_; |
| 172 // Flag indicating whether a connected socket blocks its peer from sending | 181 // Flag indicating whether a connected socket blocks its peer from sending |
| 173 // more data - see sockets_tcp_server.idl. | 182 // more data - see sockets_tcp_server.idl. |
| 174 bool paused_; | 183 bool paused_; |
| 175 }; | 184 }; |
| 176 | 185 |
| 177 } // namespace extensions | 186 } // namespace extensions |
| 178 | 187 |
| 179 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ | 188 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ |
| OLD | NEW |