OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "blimp/net/ssl_client_transport.h" | 5 #include "blimp/net/ssl_client_transport.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "blimp/net/exact_match_cert_verifier.h" | 9 #include "blimp/net/exact_match_cert_verifier.h" |
10 #include "blimp/net/stream_socket_connection.h" | 10 #include "blimp/net/stream_socket_connection.h" |
11 #include "net/base/host_port_pair.h" | 11 #include "net/base/host_port_pair.h" |
12 #include "net/cert/x509_certificate.h" | 12 #include "net/cert/x509_certificate.h" |
13 #include "net/socket/client_socket_factory.h" | 13 #include "net/socket/client_socket_factory.h" |
14 #include "net/socket/client_socket_handle.h" | 14 #include "net/socket/client_socket_handle.h" |
15 #include "net/socket/ssl_client_socket.h" | 15 #include "net/socket/ssl_client_socket.h" |
16 #include "net/socket/stream_socket.h" | 16 #include "net/socket/stream_socket.h" |
17 #include "net/socket/tcp_client_socket.h" | 17 #include "net/socket/tcp_client_socket.h" |
18 #include "net/ssl/ssl_config.h" | 18 #include "net/ssl/ssl_config.h" |
19 | 19 |
20 namespace blimp { | 20 namespace blimp { |
21 | 21 |
22 SSLClientTransport::SSLClientTransport(const net::IPEndPoint& ip_endpoint, | 22 SSLClientTransport::SSLClientTransport(const net::IPEndPoint& ip_endpoint, |
23 scoped_refptr<net::X509Certificate> cert, | 23 scoped_refptr<net::X509Certificate> cert, |
24 BlimpConnectionStatistics* statistics, | |
25 net::NetLog* net_log) | 24 net::NetLog* net_log) |
26 : TCPClientTransport(ip_endpoint, statistics, net_log), | 25 : TCPClientTransport(ip_endpoint, net_log), ip_endpoint_(ip_endpoint) { |
27 ip_endpoint_(ip_endpoint) { | |
28 // Test code may pass in a null value for |cert|. Only spin up a CertVerifier | 26 // Test code may pass in a null value for |cert|. Only spin up a CertVerifier |
29 // if there is a cert present. | 27 // if there is a cert present. |
30 if (cert) { | 28 if (cert) { |
31 cert_verifier_.reset(new ExactMatchCertVerifier(std::move(cert))); | 29 cert_verifier_.reset(new ExactMatchCertVerifier(std::move(cert))); |
32 } | 30 } |
33 } | 31 } |
34 | 32 |
35 SSLClientTransport::~SSLClientTransport() {} | 33 SSLClientTransport::~SSLClientTransport() {} |
36 | 34 |
37 const char* SSLClientTransport::GetName() const { | 35 const char* SSLClientTransport::GetName() const { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 83 } |
86 | 84 |
87 void SSLClientTransport::OnSSLConnectComplete(int result) { | 85 void SSLClientTransport::OnSSLConnectComplete(int result) { |
88 DCHECK_NE(net::ERR_IO_PENDING, result); | 86 DCHECK_NE(net::ERR_IO_PENDING, result); |
89 DVLOG(1) << "SSL connection result=" << result; | 87 DVLOG(1) << "SSL connection result=" << result; |
90 | 88 |
91 OnConnectComplete(result); | 89 OnConnectComplete(result); |
92 } | 90 } |
93 | 91 |
94 } // namespace blimp | 92 } // namespace blimp |
OLD | NEW |