| Index: chrome/browser/profiles/profile_io_data.cc
|
| diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
|
| index 197337900e35dc31274c94016b42b6d9f1f0a106..8c91bddf71f10eaa4a9ead82b5799df8eaa375e6 100644
|
| --- a/chrome/browser/profiles/profile_io_data.cc
|
| +++ b/chrome/browser/profiles/profile_io_data.cc
|
| @@ -62,6 +62,7 @@
|
| #include "content/public/browser/resource_context.h"
|
| #include "extensions/browser/info_map.h"
|
| #include "extensions/common/constants.h"
|
| +#include "net/base/keygen_handler.h"
|
| #include "net/cookies/canonical_cookie.h"
|
| #include "net/cookies/cookie_monster.h"
|
| #include "net/http/http_transaction_factory.h"
|
| @@ -110,7 +111,7 @@
|
| #endif // defined(OS_CHROMEOS)
|
|
|
| #if defined(USE_NSS)
|
| -#include "chrome/browser/ui/crypto_module_password_dialog.h"
|
| +#include "chrome/browser/ui/crypto_module_delegate_nss.h"
|
| #include "net/ssl/client_cert_store_nss.h"
|
| #endif
|
|
|
| @@ -356,6 +357,14 @@ void StartNSSInitOnIOThread(const std::string& username,
|
| }
|
| #endif // defined(OS_CHROMEOS)
|
|
|
| +#if defined(USE_NSS)
|
| +void KeygenHandlerCallbackHelper(
|
| + const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback,
|
| + scoped_ptr<net::KeygenHandler>* keygen_handler) {
|
| + callback.Run(keygen_handler->Pass());
|
| +}
|
| +#endif // defined(USE_NSS)
|
| +
|
| } // namespace
|
|
|
| void ProfileIOData::InitializeOnUIThread(Profile* profile) {
|
| @@ -854,7 +863,7 @@ scoped_ptr<net::ClientCertStore>
|
| ProfileIOData::ResourceContext::CreateClientCertStore() {
|
| #if defined(USE_NSS)
|
| return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(
|
| - base::Bind(&chrome::NewCryptoModuleBlockingDialogDelegate,
|
| + base::Bind(&CreateCryptoModuleBlockingPasswordDelegate,
|
| chrome::kCryptoModulePasswordClientAuth)));
|
| #elif defined(OS_WIN)
|
| return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
|
| @@ -870,6 +879,47 @@ ProfileIOData::ResourceContext::CreateClientCertStore() {
|
| #endif
|
| }
|
|
|
| +scoped_ptr<net::KeygenHandler>
|
| +ProfileIOData::ResourceContext::CreateKeygenHandler(
|
| + uint32 key_size_in_bits,
|
| + const std::string& challenge_string,
|
| + const GURL& url,
|
| + const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) {
|
| + DCHECK(!callback.is_null());
|
| +#if defined(USE_NSS)
|
| + // Store the KeygenHandler scoped_ptr on the heap, which will be Owned by
|
| + // the helper_callback below. This allows the KeygenHandler to be retrieved
|
| + // and returned directly in the synchronous success case.
|
| + scoped_ptr<net::KeygenHandler>* keygen_handler =
|
| + new scoped_ptr<net::KeygenHandler>(
|
| + new net::KeygenHandler(key_size_in_bits, challenge_string, url));
|
| +
|
| + scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate(
|
| + new ChromeNSSCryptoModuleDelegate(chrome::kCryptoModulePasswordKeygen,
|
| + url.host()));
|
| + ChromeNSSCryptoModuleDelegate* delegate_ptr = delegate.get();
|
| + (*keygen_handler)->set_crypto_module_delegate(
|
| + delegate.PassAs<crypto::NSSCryptoModuleDelegate>());
|
| +
|
| + // Keep |helper_callback| on the stack, since ownership of
|
| + // |keygen_handler| is transferred to |helper_callback|. This allows
|
| + // |keygen_handler| to still be accessed if InitializeSlot returns with
|
| + // synchronous success.
|
| + base::Closure helper_callback = base::Bind(
|
| + &KeygenHandlerCallbackHelper, callback, base::Owned(keygen_handler));
|
| + if (delegate_ptr->InitializeSlot(this, helper_callback)) {
|
| + // Synchronous success, return the KeygenHandler directly.
|
| + return keygen_handler->Pass();
|
| + }
|
| + // The KeygenHandler will be passed to |callback| by
|
| + // KeygenHandlerCallbackHelper.
|
| + return scoped_ptr<net::KeygenHandler>();
|
| +#else
|
| + return scoped_ptr<net::KeygenHandler>(
|
| + new net::KeygenHandler(key_size_in_bits, challenge_string, url));
|
| +#endif
|
| +}
|
| +
|
| bool ProfileIOData::ResourceContext::AllowMicAccess(const GURL& origin) {
|
| return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
|
| }
|
|
|