diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-22 23:26:44 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-22 23:26:44 +0000 |
commit | f7984fc67f3c88b6ff1c738700a8229f387d732d (patch) | |
tree | 094f6be7633d60b0413370462bf6bd04b906ac00 /net/socket/client_socket_factory.cc | |
parent | 8c1be4e0311d52f07fe16fc091862957757dc002 (diff) | |
download | chromium_src-f7984fc67f3c88b6ff1c738700a8229f387d732d.zip chromium_src-f7984fc67f3c88b6ff1c738700a8229f387d732d.tar.gz chromium_src-f7984fc67f3c88b6ff1c738700a8229f387d732d.tar.bz2 |
Move socket related files from net/base to net/socket.
Review URL: http://codereview.chromium.org/144009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/client_socket_factory.cc')
-rw-r--r-- | net/socket/client_socket_factory.cc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/net/socket/client_socket_factory.cc b/net/socket/client_socket_factory.cc new file mode 100644 index 0000000..fe2ce10 --- /dev/null +++ b/net/socket/client_socket_factory.cc @@ -0,0 +1,49 @@ +// Copyright (c) 2006-2008 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. + +#include "net/socket/client_socket_factory.h" + +#include "base/singleton.h" +#include "build/build_config.h" +#if defined(OS_WIN) +#include "net/socket/ssl_client_socket_win.h" +#elif defined(OS_LINUX) +#include "net/socket/ssl_client_socket_nss.h" +#elif defined(OS_MACOSX) +#include "net/socket/ssl_client_socket_mac.h" +#endif +#include "net/socket/tcp_client_socket.h" + +namespace net { + +class DefaultClientSocketFactory : public ClientSocketFactory { + public: + virtual ClientSocket* CreateTCPClientSocket( + const AddressList& addresses) { + return new TCPClientSocket(addresses); + } + + virtual SSLClientSocket* CreateSSLClientSocket( + ClientSocket* transport_socket, + const std::string& hostname, + const SSLConfig& ssl_config) { +#if defined(OS_WIN) + return new SSLClientSocketWin(transport_socket, hostname, ssl_config); +#elif defined(OS_LINUX) + return new SSLClientSocketNSS(transport_socket, hostname, ssl_config); +#elif defined(OS_MACOSX) + return new SSLClientSocketMac(transport_socket, hostname, ssl_config); +#else + NOTIMPLEMENTED(); + return NULL; +#endif + } +}; + +// static +ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { + return Singleton<DefaultClientSocketFactory>::get(); +} + +} // namespace net |