| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/glue/xmpp_client_socket_factory.h" | 5 #include "jingle/glue/xmpp_client_socket_factory.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "jingle/glue/fake_ssl_client_socket.h" | 10 #include "jingle/glue/fake_ssl_client_socket.h" |
| 9 #include "jingle/glue/proxy_resolving_client_socket.h" | 11 #include "jingle/glue/proxy_resolving_client_socket.h" |
| 10 #include "net/socket/client_socket_factory.h" | 12 #include "net/socket/client_socket_factory.h" |
| 11 #include "net/socket/client_socket_handle.h" | 13 #include "net/socket/client_socket_handle.h" |
| 12 #include "net/socket/ssl_client_socket.h" | 14 #include "net/socket/ssl_client_socket.h" |
| 13 #include "net/url_request/url_request_context.h" | 15 #include "net/url_request/url_request_context.h" |
| 14 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
| 15 | 17 |
| 16 namespace jingle_glue { | 18 namespace jingle_glue { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 scoped_ptr<net::StreamSocket> | 34 scoped_ptr<net::StreamSocket> |
| 33 XmppClientSocketFactory::CreateTransportClientSocket( | 35 XmppClientSocketFactory::CreateTransportClientSocket( |
| 34 const net::HostPortPair& host_and_port) { | 36 const net::HostPortPair& host_and_port) { |
| 35 // TODO(akalin): Use socket pools. | 37 // TODO(akalin): Use socket pools. |
| 36 scoped_ptr<net::StreamSocket> transport_socket( | 38 scoped_ptr<net::StreamSocket> transport_socket( |
| 37 new ProxyResolvingClientSocket( | 39 new ProxyResolvingClientSocket( |
| 38 NULL, | 40 NULL, |
| 39 request_context_getter_, | 41 request_context_getter_, |
| 40 ssl_config_, | 42 ssl_config_, |
| 41 host_and_port)); | 43 host_and_port)); |
| 42 return (use_fake_ssl_client_socket_ ? | 44 return (use_fake_ssl_client_socket_ |
| 43 scoped_ptr<net::StreamSocket>( | 45 ? scoped_ptr<net::StreamSocket>( |
| 44 new FakeSSLClientSocket(transport_socket.Pass())) : | 46 new FakeSSLClientSocket(std::move(transport_socket))) |
| 45 transport_socket.Pass()); | 47 : std::move(transport_socket)); |
| 46 } | 48 } |
| 47 | 49 |
| 48 scoped_ptr<net::SSLClientSocket> | 50 scoped_ptr<net::SSLClientSocket> |
| 49 XmppClientSocketFactory::CreateSSLClientSocket( | 51 XmppClientSocketFactory::CreateSSLClientSocket( |
| 50 scoped_ptr<net::ClientSocketHandle> transport_socket, | 52 scoped_ptr<net::ClientSocketHandle> transport_socket, |
| 51 const net::HostPortPair& host_and_port) { | 53 const net::HostPortPair& host_and_port) { |
| 52 net::SSLClientSocketContext context; | 54 net::SSLClientSocketContext context; |
| 53 context.cert_verifier = | 55 context.cert_verifier = |
| 54 request_context_getter_->GetURLRequestContext()->cert_verifier(); | 56 request_context_getter_->GetURLRequestContext()->cert_verifier(); |
| 55 context.transport_security_state = request_context_getter_-> | 57 context.transport_security_state = request_context_getter_-> |
| 56 GetURLRequestContext()->transport_security_state(); | 58 GetURLRequestContext()->transport_security_state(); |
| 57 DCHECK(context.transport_security_state); | 59 DCHECK(context.transport_security_state); |
| 58 // TODO(rkn): context.channel_id_service is NULL because the | 60 // TODO(rkn): context.channel_id_service is NULL because the |
| 59 // ChannelIDService class is not thread safe. | 61 // ChannelIDService class is not thread safe. |
| 60 return client_socket_factory_->CreateSSLClientSocket( | 62 return client_socket_factory_->CreateSSLClientSocket( |
| 61 transport_socket.Pass(), host_and_port, ssl_config_, context); | 63 std::move(transport_socket), host_and_port, ssl_config_, context); |
| 62 } | 64 } |
| 63 | 65 |
| 64 | 66 |
| 65 } // namespace jingle_glue | 67 } // namespace jingle_glue |
| OLD | NEW |