Chromium Code Reviews| Index: blimp/net/ssl_client_transport.h |
| diff --git a/blimp/net/ssl_client_transport.h b/blimp/net/ssl_client_transport.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e3243d3d2c1d0e2338ce163d4b6b1562a2cc44b9 |
| --- /dev/null |
| +++ b/blimp/net/ssl_client_transport.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BLIMP_NET_SSL_CLIENT_TRANSPORT_H_ |
| +#define BLIMP_NET_SSL_CLIENT_TRANSPORT_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/callback_forward.h" |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "blimp/net/blimp_cert_verifier.h" |
| +#include "blimp/net/blimp_net_export.h" |
| +#include "blimp/net/blimp_transport.h" |
| +#include "net/base/address_list.h" |
| +#include "net/base/net_errors.h" |
| +#include "net/http/transport_security_state.h" |
| + |
| +namespace net { |
| +class ClientSocketFactory; |
| +class NetLog; |
| +class StreamSocket; |
| +class TCPClientSocket; |
| +class TransportSecurityState; |
| +} // namespace net |
| + |
| +namespace blimp { |
| + |
| +class BlimpConnection; |
| + |
| +// Creates and connects SSL socket connections to Blimplets. |
| +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.
|
| + public: |
| + // |addresses|: a list of addresses to connect to. |
| + // |assigned_cert|: the certificate required from the remote peer. |
| + // SSL connections that use different certificates are rejected. |
| + // |net_log|: the socket event log (optional). |
| + SSLClientTransport(const net::AddressList& addresses, |
| + 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.
|
| + net::NetLog* net_log); |
| + |
| + ~SSLClientTransport() override; |
| + |
| + // BlimpTransport implementation. |
| + void Connect(const net::CompletionCallback& callback) override; |
| + scoped_ptr<BlimpConnection> TakeConnection() override; |
| + const std::string GetName() const override; |
| + |
| + private: |
| + friend class SSLClientTransportTest; |
| + |
| + 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.
|
| + |
| + // Callback method after TCPClientSocket::Connect finishes. |
| + void OnTCPConnectComplete(int result); |
| + |
| + // Callback method after SSLClientSocket::Connect finishes. |
| + void OnSSLConnectComplete(int result); |
| + |
| + net::AddressList addresses_; |
| + 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.
|
| + scoped_ptr<net::StreamSocket> tcp_socket_; |
| + scoped_ptr<net::StreamSocket> ssl_socket_; |
| + net::CompletionCallback connect_callback_; |
| + 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.
|
| + net::TransportSecurityState transport_security_state_; |
| + net::ClientSocketFactory* socket_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SSLClientTransport); |
| +}; |
| + |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_NET_SSL_CLIENT_TRANSPORT_H_ |