| OLD | NEW |
| 1 // Copyright (c) 2010 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 #include "jingle/notifier/base/xmpp_client_socket_factory.h" | 5 #include "jingle/notifier/base/xmpp_client_socket_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "jingle/notifier/base/fake_ssl_client_socket.h" | 8 #include "jingle/notifier/base/fake_ssl_client_socket.h" |
| 9 #include "jingle/notifier/base/proxy_resolving_client_socket.h" |
| 10 #include "net/socket/client_socket_factory.h" |
| 11 #include "net/url_request/url_request_context.h" |
| 12 #include "net/url_request/url_request_context_getter.h" |
| 9 | 13 |
| 10 namespace notifier { | 14 namespace notifier { |
| 11 | 15 |
| 12 XmppClientSocketFactory::XmppClientSocketFactory( | 16 XmppClientSocketFactory::XmppClientSocketFactory( |
| 13 net::ClientSocketFactory* client_socket_factory, | 17 net::ClientSocketFactory* client_socket_factory, |
| 18 const net::SSLConfig& ssl_config, |
| 19 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
| 14 bool use_fake_ssl_client_socket) | 20 bool use_fake_ssl_client_socket) |
| 15 : client_socket_factory_(client_socket_factory), | 21 : client_socket_factory_(client_socket_factory), |
| 22 request_context_getter_(request_context_getter), |
| 23 ssl_config_(ssl_config), |
| 16 use_fake_ssl_client_socket_(use_fake_ssl_client_socket) { | 24 use_fake_ssl_client_socket_(use_fake_ssl_client_socket) { |
| 17 CHECK(client_socket_factory_); | 25 CHECK(client_socket_factory_); |
| 18 } | 26 } |
| 19 | 27 |
| 20 XmppClientSocketFactory::~XmppClientSocketFactory() {} | 28 XmppClientSocketFactory::~XmppClientSocketFactory() {} |
| 21 | 29 |
| 22 net::ClientSocket* XmppClientSocketFactory::CreateTransportClientSocket( | 30 net::ClientSocket* XmppClientSocketFactory::CreateTransportClientSocket( |
| 23 const net::AddressList& addresses, | 31 const net::HostPortPair& host_and_port, net::NetLog* net_log) { |
| 24 net::NetLog* net_log, | 32 net::ClientSocket* transport_socket = new ProxyResolvingClientSocket( |
| 25 const net::NetLog::Source& source) { | 33 request_context_getter_, |
| 26 net::ClientSocket* transport_socket = | 34 ssl_config_, |
| 27 client_socket_factory_->CreateTransportClientSocket( | 35 host_and_port, |
| 28 addresses, net_log, source); | 36 net_log); |
| 29 return (use_fake_ssl_client_socket_ ? | 37 return (use_fake_ssl_client_socket_ ? |
| 30 new FakeSSLClientSocket(transport_socket) : transport_socket); | 38 new FakeSSLClientSocket(transport_socket) : transport_socket); |
| 31 } | 39 } |
| 32 | 40 |
| 33 net::SSLClientSocket* XmppClientSocketFactory::CreateSSLClientSocket( | 41 net::SSLClientSocket* XmppClientSocketFactory::CreateSSLClientSocket( |
| 34 net::ClientSocketHandle* transport_socket, | 42 net::ClientSocketHandle* transport_socket, |
| 35 const net::HostPortPair& host_and_port, | 43 const net::HostPortPair& host_and_port) { |
| 36 const net::SSLConfig& ssl_config, | |
| 37 net::SSLHostInfo* ssl_host_info, | |
| 38 net::CertVerifier* cert_verifier, | |
| 39 net::DnsCertProvenanceChecker* dns_cert_checker) { | |
| 40 return client_socket_factory_->CreateSSLClientSocket( | 44 return client_socket_factory_->CreateSSLClientSocket( |
| 41 transport_socket, host_and_port, ssl_config, ssl_host_info, | 45 transport_socket, host_and_port, ssl_config_, NULL, |
| 42 cert_verifier, dns_cert_checker); | 46 request_context_getter_->GetURLRequestContext()->cert_verifier(), NULL); |
| 43 } | 47 } |
| 44 | 48 |
| 45 void XmppClientSocketFactory::ClearSSLSessionCache() { | |
| 46 client_socket_factory_->ClearSSLSessionCache(); | |
| 47 } | |
| 48 | 49 |
| 49 } // namespace | 50 } // namespace |
| OLD | NEW |