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 Socket::SocketType socket_type() const OVERRIDE; |
45 | 46 |
46 static TCPSocket* CreateSocketForTesting( | 47 static TCPSocket* CreateSocketForTesting( |
47 net::TCPClientSocket* tcp_client_socket, | 48 net::TCPClientSocket* tcp_client_socket, |
48 ApiResourceEventNotifier* event_notifier); | 49 ApiResourceEventNotifier* event_notifier); |
49 | 50 |
50 protected: | 51 protected: |
51 virtual int WriteImpl(net::IOBuffer* io_buffer, | 52 virtual int WriteImpl(net::IOBuffer* io_buffer, |
52 int io_buffer_size, | 53 int io_buffer_size, |
53 const net::CompletionCallback& callback) OVERRIDE; | 54 const net::CompletionCallback& callback) OVERRIDE; |
54 | 55 |
55 private: | 56 private: |
56 void OnConnectComplete(int result); | 57 void OnConnectComplete(int result); |
57 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, | 58 void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, |
58 int result); | 59 int result); |
59 | 60 |
60 TCPSocket(net::TCPClientSocket* tcp_client_socket, | 61 TCPSocket(net::TCPClientSocket* tcp_client_socket, |
61 ApiResourceEventNotifier* event_notifier); | 62 ApiResourceEventNotifier* event_notifier); |
62 | 63 |
63 scoped_ptr<net::TCPClientSocket> socket_; | 64 scoped_ptr<net::TCPClientSocket> socket_; |
64 | 65 |
65 CompletionCallback connect_callback_; | 66 CompletionCallback connect_callback_; |
66 | 67 |
67 ReadCompletionCallback read_callback_; | 68 ReadCompletionCallback read_callback_; |
68 }; | 69 }; |
69 | 70 |
70 } // namespace extensions | 71 } // namespace extensions |
71 | 72 |
72 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ | 73 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ |
OLD | NEW |