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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 explicit TCPSocket(APIResourceEventNotifier* event_notifier); | 27 explicit TCPSocket(APIResourceEventNotifier* event_notifier); |
28 virtual ~TCPSocket(); | 28 virtual ~TCPSocket(); |
29 | 29 |
30 virtual void Connect(const std::string& address, | 30 virtual void Connect(const std::string& address, |
31 int port, | 31 int port, |
32 const CompletionCallback& callback) OVERRIDE; | 32 const CompletionCallback& callback) OVERRIDE; |
33 virtual void Disconnect() OVERRIDE; | 33 virtual void Disconnect() OVERRIDE; |
34 virtual int Bind(const std::string& address, int port) OVERRIDE; | 34 virtual int Bind(const std::string& address, int port) OVERRIDE; |
35 virtual void Read(int count, | 35 virtual void Read(int count, |
36 const ReadCompletionCallback& callback) OVERRIDE; | 36 const ReadCompletionCallback& callback) OVERRIDE; |
37 virtual void Write(scoped_refptr<net::IOBuffer> io_buffer, | |
38 int bytes, | |
39 const CompletionCallback& callback) OVERRIDE; | |
40 virtual void RecvFrom(int count, | 37 virtual void RecvFrom(int count, |
41 const RecvFromCompletionCallback& callback) OVERRIDE; | 38 const RecvFromCompletionCallback& callback) OVERRIDE; |
42 virtual void SendTo(scoped_refptr<net::IOBuffer> io_buffer, | 39 virtual void SendTo(scoped_refptr<net::IOBuffer> io_buffer, |
43 int byte_count, | 40 int byte_count, |
44 const std::string& address, | 41 const std::string& address, |
45 int port, | 42 int port, |
46 const CompletionCallback& callback) OVERRIDE; | 43 const CompletionCallback& callback) OVERRIDE; |
47 | 44 |
48 static TCPSocket* CreateSocketForTesting( | 45 static TCPSocket* CreateSocketForTesting( |
49 net::TCPClientSocket* tcp_client_socket, | 46 net::TCPClientSocket* tcp_client_socket, |
50 APIResourceEventNotifier* event_notifier); | 47 APIResourceEventNotifier* event_notifier); |
51 | 48 |
| 49 protected: |
| 50 virtual int WriteImpl(net::IOBuffer* io_buffer, |
| 51 int io_buffer_size, |
| 52 const net::CompletionCallback& callback); |
| 53 |
52 private: | 54 private: |
53 virtual void OnConnectComplete(int result); | 55 virtual void OnConnectComplete(int result); |
54 virtual void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, | 56 virtual void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, |
55 int result); | 57 int result); |
56 virtual void OnWriteComplete(int result); | |
57 | 58 |
58 TCPSocket(net::TCPClientSocket* tcp_client_socket, | 59 TCPSocket(net::TCPClientSocket* tcp_client_socket, |
59 APIResourceEventNotifier* event_notifier); | 60 APIResourceEventNotifier* event_notifier); |
60 | 61 |
61 scoped_ptr<net::TCPClientSocket> socket_; | 62 scoped_ptr<net::TCPClientSocket> socket_; |
62 | 63 |
63 CompletionCallback connect_callback_; | 64 CompletionCallback connect_callback_; |
64 | 65 |
65 ReadCompletionCallback read_callback_; | 66 ReadCompletionCallback read_callback_; |
66 | |
67 CompletionCallback write_callback_; | |
68 }; | 67 }; |
69 | 68 |
70 } // namespace extensions | 69 } // namespace extensions |
71 | 70 |
72 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ | 71 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_TCP_SOCKET_H_ |
OLD | NEW |