Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_NET_SSL_CLIENT_TRANSPORT_H_ | |
| 6 #define BLIMP_NET_SSL_CLIENT_TRANSPORT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback_forward.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "blimp/net/blimp_cert_verifier.h" | |
| 14 #include "blimp/net/blimp_net_export.h" | |
| 15 #include "blimp/net/blimp_transport.h" | |
| 16 #include "net/base/address_list.h" | |
| 17 #include "net/base/net_errors.h" | |
| 18 #include "net/http/transport_security_state.h" | |
| 19 | |
| 20 namespace net { | |
| 21 class ClientSocketFactory; | |
| 22 class NetLog; | |
| 23 class StreamSocket; | |
| 24 class TCPClientSocket; | |
| 25 class TransportSecurityState; | |
| 26 } // namespace net | |
| 27 | |
| 28 namespace blimp { | |
| 29 | |
| 30 class BlimpConnection; | |
| 31 | |
| 32 // Creates and connects SSL socket connections to Blimplets. | |
| 33 class BLIMP_NET_EXPORT SSLClientTransport : public BlimpTransport { | |
|
Wez
2016/02/12 21:42:38
TCP connection logic already exists in TCPClientTr
Kevin M
2016/02/13 00:44:18
Done.
| |
| 34 public: | |
| 35 // |addresses|: a list of addresses to connect to. | |
| 36 // |assigned_cert|: the certificate required from the remote peer. | |
| 37 // SSL connections that use different certificates are rejected. | |
| 38 // |net_log|: the socket event log (optional). | |
| 39 SSLClientTransport(const net::AddressList& addresses, | |
| 40 scoped_refptr<net::X509Certificate> assigned_cert, | |
|
Wez
2016/02/12 21:42:38
nit: Why is "assigned" relevant here? At this leve
Kevin M
2016/02/13 00:44:18
Done.
| |
| 41 net::NetLog* net_log); | |
| 42 | |
| 43 ~SSLClientTransport() override; | |
| 44 | |
| 45 // BlimpTransport implementation. | |
| 46 void Connect(const net::CompletionCallback& callback) override; | |
| 47 scoped_ptr<BlimpConnection> TakeConnection() override; | |
| 48 const std::string GetName() const override; | |
| 49 | |
| 50 private: | |
| 51 friend class SSLClientTransportTest; | |
| 52 | |
| 53 void SetClientSocketFactoryForTest(net::ClientSocketFactory* factory); | |
|
Wez
2016/02/12 21:42:38
Does this need to be private? I thought we had a p
Kevin M
2016/02/13 00:44:18
Done.
| |
| 54 | |
| 55 // Callback method after TCPClientSocket::Connect finishes. | |
| 56 void OnTCPConnectComplete(int result); | |
| 57 | |
| 58 // Callback method after SSLClientSocket::Connect finishes. | |
| 59 void OnSSLConnectComplete(int result); | |
| 60 | |
| 61 net::AddressList addresses_; | |
| 62 net::NetLog* net_log_; | |
|
Wez
2016/02/12 21:42:38
nit: Suggest inline init this to nullptr, and sock
Kevin M
2016/02/13 00:44:18
Done.
| |
| 63 scoped_ptr<net::StreamSocket> tcp_socket_; | |
| 64 scoped_ptr<net::StreamSocket> ssl_socket_; | |
| 65 net::CompletionCallback connect_callback_; | |
| 66 scoped_ptr<BlimpCertVerifier> cert_verifier_; | |
|
Wez
2016/02/12 21:42:38
nit: Looks like this could be a direct member rath
Kevin M
2016/02/13 00:44:18
Done.
| |
| 67 net::TransportSecurityState transport_security_state_; | |
| 68 net::ClientSocketFactory* socket_factory_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(SSLClientTransport); | |
| 71 }; | |
| 72 | |
| 73 } // namespace blimp | |
| 74 | |
| 75 #endif // BLIMP_NET_SSL_CLIENT_TRANSPORT_H_ | |
| OLD | NEW |