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

Side by Side Diff: net/socket/ssl_client_socket_win.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/ssl_client_socket_unittest.cc ('k') | net/socket/ssl_client_socket_win.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_SSL_CLIENT_SOCKET_WIN_H_ 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #define SECURITY_WIN32 // Needs to be defined before including security.h 9 #define SECURITY_WIN32 // Needs to be defined before including security.h
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 virtual void GetSSLInfo(SSLInfo* ssl_info); 49 virtual void GetSSLInfo(SSLInfo* ssl_info);
50 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); 50 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info);
51 virtual int ExportKeyingMaterial(const base::StringPiece& label, 51 virtual int ExportKeyingMaterial(const base::StringPiece& label,
52 const base::StringPiece& context, 52 const base::StringPiece& context,
53 unsigned char *out, 53 unsigned char *out,
54 unsigned int outlen); 54 unsigned int outlen);
55 virtual NextProtoStatus GetNextProto(std::string* proto, 55 virtual NextProtoStatus GetNextProto(std::string* proto,
56 std::string* server_protos); 56 std::string* server_protos);
57 57
58 // StreamSocket implementation. 58 // StreamSocket implementation.
59 virtual int Connect(OldCompletionCallback* callback); 59 virtual int Connect(const CompletionCallback& callback) OVERRIDE;
60 virtual int Connect(const CompletionCallback& callback); 60 virtual void Disconnect() OVERRIDE;
61 virtual void Disconnect(); 61 virtual bool IsConnected() const OVERRIDE;
62 virtual bool IsConnected() const; 62 virtual bool IsConnectedAndIdle() const OVERRIDE;
63 virtual bool IsConnectedAndIdle() const; 63 virtual int GetPeerAddress(AddressList* address) const OVERRIDE;
64 virtual int GetPeerAddress(AddressList* address) const; 64 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
65 virtual int GetLocalAddress(IPEndPoint* address) const; 65 virtual const BoundNetLog& NetLog() const OVERRIDE{ return net_log_; }
66 virtual const BoundNetLog& NetLog() const { return net_log_; } 66 virtual void SetSubresourceSpeculation() OVERRIDE;
67 virtual void SetSubresourceSpeculation(); 67 virtual void SetOmniboxSpeculation() OVERRIDE;
68 virtual void SetOmniboxSpeculation(); 68 virtual bool WasEverUsed() const OVERRIDE;
69 virtual bool WasEverUsed() const; 69 virtual bool UsingTCPFastOpen() const OVERRIDE;
70 virtual bool UsingTCPFastOpen() const; 70 virtual int64 NumBytesRead() const OVERRIDE;
71 virtual int64 NumBytesRead() const; 71 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE;
72 virtual base::TimeDelta GetConnectTimeMicros() const;
73 72
74 // Socket implementation. 73 // Socket implementation.
75 virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback);
76 virtual int Read(IOBuffer* buf, int buf_len, 74 virtual int Read(IOBuffer* buf, int buf_len,
77 const CompletionCallback& callback); 75 const CompletionCallback& callback) OVERRIDE;
78 virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback) ; 76 virtual int Write(IOBuffer* buf, int buf_len,
77 const CompletionCallback& callback) OVERRIDE;
79 78
80 virtual bool SetReceiveBufferSize(int32 size); 79 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
81 virtual bool SetSendBufferSize(int32 size); 80 virtual bool SetSendBufferSize(int32 size) OVERRIDE;
82 81
83 private: 82 private:
84 bool completed_handshake() const { 83 bool completed_handshake() const {
85 return next_state_ == STATE_COMPLETED_HANDSHAKE; 84 return next_state_ == STATE_COMPLETED_HANDSHAKE;
86 } 85 }
87 86
88 // Initializes the SSL options and security context. Returns a net error code. 87 // Initializes the SSL options and security context. Returns a net error code.
89 int InitializeSSLContext(); 88 int InitializeSSLContext();
90 89
91 void OnHandshakeIOComplete(int result); 90 void OnHandshakeIOComplete(int result);
(...skipping 15 matching lines...) Expand all
107 int DoPayloadWrite(); 106 int DoPayloadWrite();
108 int DoPayloadWriteComplete(int result); 107 int DoPayloadWriteComplete(int result);
109 int DoCompletedRenegotiation(int result); 108 int DoCompletedRenegotiation(int result);
110 109
111 int DidCallInitializeSecurityContext(); 110 int DidCallInitializeSecurityContext();
112 int DidCompleteHandshake(); 111 int DidCompleteHandshake();
113 void DidCompleteRenegotiation(); 112 void DidCompleteRenegotiation();
114 void LogConnectionTypeMetrics() const; 113 void LogConnectionTypeMetrics() const;
115 void FreeSendBuffer(); 114 void FreeSendBuffer();
116 115
117 // Internal callbacks as async operations complete.
118 OldCompletionCallbackImpl<SSLClientSocketWin> handshake_io_callback_;
119 OldCompletionCallbackImpl<SSLClientSocketWin> read_callback_;
120 OldCompletionCallbackImpl<SSLClientSocketWin> write_callback_;
121
122 scoped_ptr<ClientSocketHandle> transport_; 116 scoped_ptr<ClientSocketHandle> transport_;
123 HostPortPair host_and_port_; 117 HostPortPair host_and_port_;
124 SSLConfig ssl_config_; 118 SSLConfig ssl_config_;
125 119
126 // User function to callback when the Connect() completes. 120 // User function to callback when the Connect() completes.
127 OldCompletionCallback* old_user_connect_callback_;
128 CompletionCallback user_connect_callback_; 121 CompletionCallback user_connect_callback_;
129 122
130 // User function to callback when a Read() completes. 123 // User function to callback when a Read() completes.
131 OldCompletionCallback* old_user_read_callback_;
132 CompletionCallback user_read_callback_; 124 CompletionCallback user_read_callback_;
133 scoped_refptr<IOBuffer> user_read_buf_; 125 scoped_refptr<IOBuffer> user_read_buf_;
134 int user_read_buf_len_; 126 int user_read_buf_len_;
135 127
136 // User function to callback when a Write() completes. 128 // User function to callback when a Write() completes.
137 OldCompletionCallback* user_write_callback_; 129 CompletionCallback user_write_callback_;
138 scoped_refptr<IOBuffer> user_write_buf_; 130 scoped_refptr<IOBuffer> user_write_buf_;
139 int user_write_buf_len_; 131 int user_write_buf_len_;
140 132
141 // Used to Read and Write using transport_. 133 // Used to Read and Write using transport_.
142 scoped_refptr<IOBuffer> transport_read_buf_; 134 scoped_refptr<IOBuffer> transport_read_buf_;
143 scoped_refptr<IOBuffer> transport_write_buf_; 135 scoped_refptr<IOBuffer> transport_write_buf_;
144 136
145 enum State { 137 enum State {
146 STATE_NONE, 138 STATE_NONE,
147 STATE_HANDSHAKE_READ, 139 STATE_HANDSHAKE_READ,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 200
209 // True when the decrypter needs more data in order to decrypt. 201 // True when the decrypter needs more data in order to decrypt.
210 bool need_more_data_; 202 bool need_more_data_;
211 203
212 BoundNetLog net_log_; 204 BoundNetLog net_log_;
213 }; 205 };
214 206
215 } // namespace net 207 } // namespace net
216 208
217 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_ 209 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_WIN_H_
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | net/socket/ssl_client_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698