| 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 "net/socket/client_socket_factory.h" | 5 #include "net/socket/client_socket_factory.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "net/cert/cert_database.h" | 11 #include "net/cert/cert_database.h" |
| 12 #include "net/socket/client_socket_handle.h" | 12 #include "net/socket/client_socket_handle.h" |
| 13 #if defined(USE_OPENSSL) | 13 #if defined(USE_OPENSSL) |
| 14 #include "net/socket/ssl_client_socket_openssl.h" | 14 #include "net/socket/ssl_client_socket_openssl.h" |
| 15 #elif defined(USE_NSS) || defined(OS_MACOSX) || defined(OS_WIN) | 15 #elif defined(USE_NSS_CERTS) || defined(OS_MACOSX) || defined(OS_WIN) |
| 16 #include "net/socket/ssl_client_socket_nss.h" | 16 #include "net/socket/ssl_client_socket_nss.h" |
| 17 #endif | 17 #endif |
| 18 #include "net/socket/tcp_client_socket.h" | 18 #include "net/socket/tcp_client_socket.h" |
| 19 #include "net/udp/udp_client_socket.h" | 19 #include "net/udp/udp_client_socket.h" |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 class X509Certificate; | 23 class X509Certificate; |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // from call to call. | 100 // from call to call. |
| 101 scoped_refptr<base::SequencedTaskRunner> nss_task_runner( | 101 scoped_refptr<base::SequencedTaskRunner> nss_task_runner( |
| 102 nss_thread_task_runner_); | 102 nss_thread_task_runner_); |
| 103 if (!nss_task_runner.get()) | 103 if (!nss_task_runner.get()) |
| 104 nss_task_runner = base::ThreadTaskRunnerHandle::Get(); | 104 nss_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 105 | 105 |
| 106 #if defined(USE_OPENSSL) | 106 #if defined(USE_OPENSSL) |
| 107 return scoped_ptr<SSLClientSocket>( | 107 return scoped_ptr<SSLClientSocket>( |
| 108 new SSLClientSocketOpenSSL(transport_socket.Pass(), host_and_port, | 108 new SSLClientSocketOpenSSL(transport_socket.Pass(), host_and_port, |
| 109 ssl_config, context)); | 109 ssl_config, context)); |
| 110 #elif defined(USE_NSS) || defined(OS_MACOSX) || defined(OS_WIN) | 110 #elif defined(USE_NSS_CERTS) || defined(OS_MACOSX) || defined(OS_WIN) |
| 111 return scoped_ptr<SSLClientSocket>( | 111 return scoped_ptr<SSLClientSocket>( |
| 112 new SSLClientSocketNSS(nss_task_runner.get(), | 112 new SSLClientSocketNSS(nss_task_runner.get(), |
| 113 transport_socket.Pass(), | 113 transport_socket.Pass(), |
| 114 host_and_port, | 114 host_and_port, |
| 115 ssl_config, | 115 ssl_config, |
| 116 context)); | 116 context)); |
| 117 #else | 117 #else |
| 118 NOTIMPLEMENTED(); | 118 NOTIMPLEMENTED(); |
| 119 return scoped_ptr<SSLClientSocket>(); | 119 return scoped_ptr<SSLClientSocket>(); |
| 120 #endif | 120 #endif |
| (...skipping 10 matching lines...) Expand all Loading... |
| 131 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; | 131 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; |
| 132 | 132 |
| 133 } // namespace | 133 } // namespace |
| 134 | 134 |
| 135 // static | 135 // static |
| 136 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { | 136 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { |
| 137 return g_default_client_socket_factory.Pointer(); | 137 return g_default_client_socket_factory.Pointer(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace net | 140 } // namespace net |
| OLD | NEW |