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