Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: net/socket/socks_client_socket.h

Issue 8824006: Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/socket/socks5_client_socket_unittest.cc ('k') | net/socket/socks_client_socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 NET_SOCKET_SOCKS_CLIENT_SOCKET_H_ 5 #ifndef NET_SOCKET_SOCKS_CLIENT_SOCKET_H_
6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_H_ 6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 30 matching lines...) Expand all
41 SOCKSClientSocket(StreamSocket* transport_socket, 41 SOCKSClientSocket(StreamSocket* transport_socket,
42 const HostResolver::RequestInfo& req_info, 42 const HostResolver::RequestInfo& req_info,
43 HostResolver* host_resolver); 43 HostResolver* host_resolver);
44 44
45 // On destruction Disconnect() is called. 45 // On destruction Disconnect() is called.
46 virtual ~SOCKSClientSocket(); 46 virtual ~SOCKSClientSocket();
47 47
48 // StreamSocket implementation. 48 // StreamSocket implementation.
49 49
50 // Does the SOCKS handshake and completes the protocol. 50 // Does the SOCKS handshake and completes the protocol.
51 virtual int Connect(OldCompletionCallback* callback) OVERRIDE; 51 virtual int Connect(const CompletionCallback& callback) OVERRIDE;
52 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
53 virtual void Disconnect() OVERRIDE; 52 virtual void Disconnect() OVERRIDE;
54 virtual bool IsConnected() const OVERRIDE; 53 virtual bool IsConnected() const OVERRIDE;
55 virtual bool IsConnectedAndIdle() const OVERRIDE; 54 virtual bool IsConnectedAndIdle() const OVERRIDE;
56 virtual const BoundNetLog& NetLog() const OVERRIDE; 55 virtual const BoundNetLog& NetLog() const OVERRIDE;
57 virtual void SetSubresourceSpeculation() OVERRIDE; 56 virtual void SetSubresourceSpeculation() OVERRIDE;
58 virtual void SetOmniboxSpeculation() OVERRIDE; 57 virtual void SetOmniboxSpeculation() OVERRIDE;
59 virtual bool WasEverUsed() const OVERRIDE; 58 virtual bool WasEverUsed() const OVERRIDE;
60 virtual bool UsingTCPFastOpen() const OVERRIDE; 59 virtual bool UsingTCPFastOpen() const OVERRIDE;
61 virtual int64 NumBytesRead() const OVERRIDE; 60 virtual int64 NumBytesRead() const OVERRIDE;
62 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; 61 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE;
63 62
64 // Socket implementation. 63 // Socket implementation.
65 virtual int Read(IOBuffer* buf, 64 virtual int Read(IOBuffer* buf,
66 int buf_len, 65 int buf_len,
67 OldCompletionCallback* callback) OVERRIDE;
68 virtual int Read(IOBuffer* buf,
69 int buf_len,
70 const CompletionCallback& callback) OVERRIDE; 66 const CompletionCallback& callback) OVERRIDE;
71 virtual int Write(IOBuffer* buf, 67 virtual int Write(IOBuffer* buf,
72 int buf_len, 68 int buf_len,
73 OldCompletionCallback* callback) OVERRIDE; 69 const CompletionCallback& callback) OVERRIDE;
74 70
75 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; 71 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
76 virtual bool SetSendBufferSize(int32 size) OVERRIDE; 72 virtual bool SetSendBufferSize(int32 size) OVERRIDE;
77 73
78 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; 74 virtual int GetPeerAddress(AddressList* address) const OVERRIDE;
79 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; 75 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
80 76
81 private: 77 private:
82 FRIEND_TEST_ALL_PREFIXES(SOCKSClientSocketTest, CompleteHandshake); 78 FRIEND_TEST_ALL_PREFIXES(SOCKSClientSocketTest, CompleteHandshake);
83 FRIEND_TEST_ALL_PREFIXES(SOCKSClientSocketTest, SOCKS4AFailedDNS); 79 FRIEND_TEST_ALL_PREFIXES(SOCKSClientSocketTest, SOCKS4AFailedDNS);
(...skipping 15 matching lines...) Expand all
99 int DoLoop(int last_io_result); 95 int DoLoop(int last_io_result);
100 int DoResolveHost(); 96 int DoResolveHost();
101 int DoResolveHostComplete(int result); 97 int DoResolveHostComplete(int result);
102 int DoHandshakeRead(); 98 int DoHandshakeRead();
103 int DoHandshakeReadComplete(int result); 99 int DoHandshakeReadComplete(int result);
104 int DoHandshakeWrite(); 100 int DoHandshakeWrite();
105 int DoHandshakeWriteComplete(int result); 101 int DoHandshakeWriteComplete(int result);
106 102
107 const std::string BuildHandshakeWriteBuffer() const; 103 const std::string BuildHandshakeWriteBuffer() const;
108 104
109 OldCompletionCallbackImpl<SOCKSClientSocket> io_callback_;
110
111 // Stores the underlying socket. 105 // Stores the underlying socket.
112 scoped_ptr<ClientSocketHandle> transport_; 106 scoped_ptr<ClientSocketHandle> transport_;
113 107
114 State next_state_; 108 State next_state_;
115 109
116 // Stores the callback to the layer above, called on completing Connect(). 110 // Stores the callback to the layer above, called on completing Connect().
117 OldCompletionCallback* old_user_callback_;
118 CompletionCallback user_callback_; 111 CompletionCallback user_callback_;
119 112
120 // This IOBuffer is used by the class to read and write 113 // This IOBuffer is used by the class to read and write
121 // SOCKS handshake data. The length contains the expected size to 114 // SOCKS handshake data. The length contains the expected size to
122 // read or write. 115 // read or write.
123 scoped_refptr<IOBuffer> handshake_buf_; 116 scoped_refptr<IOBuffer> handshake_buf_;
124 117
125 // While writing, this buffer stores the complete write handshake data. 118 // While writing, this buffer stores the complete write handshake data.
126 // While reading, it stores the handshake information received so far. 119 // While reading, it stores the handshake information received so far.
127 std::string buffer_; 120 std::string buffer_;
(...skipping 12 matching lines...) Expand all
140 HostResolver::RequestInfo host_request_info_; 133 HostResolver::RequestInfo host_request_info_;
141 134
142 BoundNetLog net_log_; 135 BoundNetLog net_log_;
143 136
144 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocket); 137 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocket);
145 }; 138 };
146 139
147 } // namespace net 140 } // namespace net
148 141
149 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_H_ 142 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_H_
OLDNEW
« no previous file with comments | « net/socket/socks5_client_socket_unittest.cc ('k') | net/socket/socks_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698