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 24 matching lines...) Expand all Loading... |
35 const ReadCompletionCallback& callback) OVERRIDE; | 35 const ReadCompletionCallback& callback) OVERRIDE; |
36 virtual void RecvFrom(int count, | 36 virtual void RecvFrom(int count, |
37 const RecvFromCompletionCallback& callback) OVERRIDE; | 37 const RecvFromCompletionCallback& callback) OVERRIDE; |
38 virtual void SendTo(scoped_refptr<net::IOBuffer> io_buffer, | 38 virtual void SendTo(scoped_refptr<net::IOBuffer> io_buffer, |
39 int byte_count, | 39 int byte_count, |
40 const std::string& address, | 40 const std::string& address, |
41 int port, | 41 int port, |
42 const CompletionCallback& callback) OVERRIDE; | 42 const CompletionCallback& callback) OVERRIDE; |
43 virtual bool SetKeepAlive(bool enable, int delay) OVERRIDE; | 43 virtual bool SetKeepAlive(bool enable, int delay) OVERRIDE; |
44 virtual bool SetNoDelay(bool no_delay) OVERRIDE; | 44 virtual bool SetNoDelay(bool no_delay) OVERRIDE; |
45 virtual bool IsTCPSocket() OVERRIDE; | |
46 virtual bool GetPeerAddress(net::IPEndPoint* address) OVERRIDE; | 45 virtual bool GetPeerAddress(net::IPEndPoint* address) OVERRIDE; |
47 virtual bool GetLocalAddress(net::IPEndPoint* address) OVERRIDE; | 46 virtual bool GetLocalAddress(net::IPEndPoint* address) OVERRIDE; |
| 47 virtual Socket::SocketType socket_type() const OVERRIDE; |
48 | 48 |
49 static TCPSocket* CreateSocketForTesting( | 49 static TCPSocket* CreateSocketForTesting( |
50 net::TCPClientSocket* tcp_client_socket, | 50 net::TCPClientSocket* tcp_client_socket, |
51 ApiResourceEventNotifier* event_notifier); | 51 ApiResourceEventNotifier* event_notifier); |
52 | 52 |
53 protected: | 53 protected: |
54 virtual int WriteImpl(net::IOBuffer* io_buffer, | 54 virtual int WriteImpl(net::IOBuffer* io_buffer, |
55 int io_buffer_size, | 55 int io_buffer_size, |
56 const net::CompletionCallback& callback) OVERRIDE; | 56 const net::CompletionCallback& callback) OVERRIDE; |
57 | 57 |
58 private: | 58 private: |
59 void OnConnectComplete(int result); | 59 void OnConnectComplete(int result); |
60 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, | 60 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, |
61 int result); | 61 int result); |
62 | 62 |
63 TCPSocket(net::TCPClientSocket* tcp_client_socket, | 63 TCPSocket(net::TCPClientSocket* tcp_client_socket, |
64 ApiResourceEventNotifier* event_notifier); | 64 ApiResourceEventNotifier* event_notifier); |
65 | 65 |
66 scoped_ptr<net::TCPClientSocket> socket_; | 66 scoped_ptr<net::TCPClientSocket> socket_; |
67 | 67 |
68 CompletionCallback connect_callback_; | 68 CompletionCallback connect_callback_; |
69 | 69 |
70 ReadCompletionCallback read_callback_; | 70 ReadCompletionCallback read_callback_; |
71 }; | 71 }; |
72 | 72 |
73 } // namespace extensions | 73 } // namespace extensions |
74 | 74 |
75 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ | 75 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ |
OLD | NEW |