diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 21:55:51 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 21:55:51 +0000 |
commit | 2fabd24b9eabb8a66c5553b7b45af134a5b929e5 (patch) | |
tree | adc0dc3cadf6130abfed37d1eab5e2871e7d6a69 | |
parent | 23d8bdd59fd22a2c7aee9187349d802bdcd3da8e (diff) | |
download | chromium_src-2fabd24b9eabb8a66c5553b7b45af134a5b929e5.zip chromium_src-2fabd24b9eabb8a66c5553b7b45af134a5b929e5.tar.gz chromium_src-2fabd24b9eabb8a66c5553b7b45af134a5b929e5.tar.bz2 |
Add the ssl_client_socket_nss_factory.h header and declare
the SSLClientSocketNSSFactory function there.
Put the --use-nss-for-ssl command-line switch inside ifdefs
for the platforms that need it.
Call EnsureNSPRInit on the main thread so that PR_Cleanup
will be called on the main thread.
R=mark
BUG=28744
TEST=No build errors.
Review URL: http://codereview.chromium.org/573041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38515 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_main.cc | 22 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 10 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 5 | ||||
-rwxr-xr-x | net/net.gyp | 2 | ||||
-rw-r--r-- | net/socket/client_socket_factory.cc | 1 | ||||
-rw-r--r-- | net/socket/client_socket_factory.h | 6 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_nss_factory.h | 20 |
7 files changed, 44 insertions, 22 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 04ec0ed..c81140e 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -65,7 +65,6 @@ #include "net/base/cookie_monster.h" #include "net/base/net_module.h" #include "net/http/http_network_session.h" -#include "net/socket/client_socket_factory.h" #include "net/socket/client_socket_pool_base.h" #if defined(OS_POSIX) @@ -97,6 +96,7 @@ #include <shellapi.h> #include "app/win_util.h" +#include "base/nss_util.h" #include "base/registry.h" #include "base/win_util.h" #include "chrome/browser/browser.h" @@ -114,7 +114,7 @@ #include "net/base/net_util.h" #include "net/base/sdch_manager.h" #include "net/base/winsock_init.h" -#include "net/http/http_network_layer.h" +#include "net/socket/ssl_client_socket_nss_factory.h" #include "printing/printed_document.h" #include "sandbox/src/sandbox.h" #endif // defined(OS_WIN) @@ -397,6 +397,16 @@ int BrowserMain(const MainFunctionParams& parameters) { net::EnsureWinsockInit(); #endif // defined(OS_WIN) +#if defined(OS_WIN) + if (parsed_command_line.HasSwitch(switches::kUseNSSForSSL) || + parsed_command_line.HasSwitch(switches::kUseSpdy)) { + net::ClientSocketFactory::SetSSLClientSocketFactory( + net::SSLClientSocketNSSFactory); + // We want to be sure to init NSPR on the main thread. + base::EnsureNSPRInit(); + } +#endif + // Do platform-specific things (such as finishing initializing Cocoa) // prior to instantiating the message loop. This could be turned into a // broadcast notification. @@ -719,14 +729,6 @@ int BrowserMain(const MainFunctionParams& parameters) { } } -#if defined(OS_WIN) - if (parsed_command_line.HasSwitch(switches::kUseNSSForSSL) || - parsed_command_line.HasSwitch(switches::kUseSpdy)) { - net::ClientSocketFactory::SetSSLClientSocketFactory( - net::SSLClientSocketNSSFactory); - } -#endif - // Try to create/load the profile. ProfileManager* profile_manager = browser_process->profile_manager(); Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index d3fdbcb..db0e7d3 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -631,10 +631,6 @@ const char kTryChromeAgain[] = "try-chrome-again"; // Runs un-installation steps that were done by chrome first-run. const char kUninstall[] = "uninstall"; -// Use NSS instead of the system SSL library for SSL. -// This is a temporary testing flag. -const char kUseNSSForSSL[] = "use-nss-for-ssl"; - // Use Spdy for the transport protocol instead of HTTP. // This is a temporary testing flag. const char kUseSpdy[] = "use-spdy"; @@ -730,6 +726,12 @@ const char kProfile[] = "profile"; const char kChromeosFrame[] = "chromeos-frame"; #endif +#if defined(OS_WIN) +// Use NSS instead of the system SSL library for SSL. +// This is a temporary testing flag. +const char kUseNSSForSSL[] = "use-nss-for-ssl"; +#endif + #if defined(OS_LINUX) // A temporary switch before we implement the client certificate selection UI. // When an SSL server requests client authentication, select a client diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index e6be99f..8ba978e4 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -182,7 +182,6 @@ extern const char kThumbnailStore[]; extern const char kTrustedPlugins[]; extern const char kTryChromeAgain[]; extern const char kUninstall[]; -extern const char kUseNSSForSSL[]; extern const char kUseSpdy[]; extern const char kFixedHost[]; extern const char kFixedHttpPort[]; @@ -213,6 +212,10 @@ extern const char kProfile[]; extern const char kChromeosFrame[]; #endif +#if defined(OS_WIN) +extern const char kUseNSSForSSL[]; +#endif + #if defined(OS_LINUX) extern const char kAutoSSLClientAuth[]; #endif diff --git a/net/net.gyp b/net/net.gyp index 15a1fc0..00f0615 100755 --- a/net/net.gyp +++ b/net/net.gyp @@ -418,6 +418,7 @@ 'socket/ssl_client_socket_mac.cc', 'socket/ssl_client_socket_mac.h', 'socket/ssl_client_socket_nss_factory.cc', + 'socket/ssl_client_socket_nss_factory.h', 'socket/ssl_client_socket_nss.cc', 'socket/ssl_client_socket_nss.h', 'socket/ssl_client_socket_win.cc', @@ -535,6 +536,7 @@ 'sources!': [ 'proxy/proxy_resolver_winhttp.cc', 'socket/ssl_client_socket_nss_factory.cc', + 'socket/ssl_client_socket_nss_factory.h', ], }, ], diff --git a/net/socket/client_socket_factory.cc b/net/socket/client_socket_factory.cc index 6a3a4cc..4f05575 100644 --- a/net/socket/client_socket_factory.cc +++ b/net/socket/client_socket_factory.cc @@ -35,7 +35,6 @@ SSLClientSocket* DefaultSSLClientSocketFactory( #endif } -// True if we should use NSS instead of the system SSL library for SSL. SSLClientSocketFactory g_ssl_factory = DefaultSSLClientSocketFactory; class DefaultClientSocketFactory : public ClientSocketFactory { diff --git a/net/socket/client_socket_factory.h b/net/socket/client_socket_factory.h index 988cf97..1c97cd6 100644 --- a/net/socket/client_socket_factory.h +++ b/net/socket/client_socket_factory.h @@ -20,12 +20,6 @@ typedef SSLClientSocket* (*SSLClientSocketFactory)( const std::string& hostname, const SSLConfig& ssl_config); -// Creates SSLClientSocketNSS objects. -SSLClientSocket* SSLClientSocketNSSFactory( - ClientSocket* transport_socket, - const std::string& hostname, - const SSLConfig& ssl_config); - // An interface used to instantiate ClientSocket objects. Used to facilitate // testing code with mock socket implementations. class ClientSocketFactory { diff --git a/net/socket/ssl_client_socket_nss_factory.h b/net/socket/ssl_client_socket_nss_factory.h new file mode 100644 index 0000000..a835516 --- /dev/null +++ b/net/socket/ssl_client_socket_nss_factory.h @@ -0,0 +1,20 @@ +// Copyright (c) 2010 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. + +#ifndef NET_SOCKET_SSL_CLIENT_SOCKET_NSS_FACTORY_H_ +#define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_FACTORY_H_ + +#include "net/socket/client_socket_factory.h" + +namespace net { + +// Creates SSLClientSocketNSS objects. +SSLClientSocket* SSLClientSocketNSSFactory( + ClientSocket* transport_socket, + const std::string& hostname, + const SSLConfig& ssl_config); + +} // namespace net + +#endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_FACTORY_H_ |