Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Unified Diff: chrome/browser/profiles/profile_io_data.cc

Issue 61643007: Update keygen to use correct NSS slot on ChromeOS multiprofile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to 238776 Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7c0d34282ffff2e7f4c9992a9ef32cdcd8f788ea..cf58eae9c61df335aeb1ad453a13ec232fca52e2 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"
@@ -103,7 +104,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"
#endif
using content::BrowserContext;
@@ -826,7 +827,7 @@ ProfileIOData::ResourceContext::CreateClientCertStore() {
scoped_ptr<net::ClientCertStoreImpl> store(new net::ClientCertStoreImpl());
#if defined(USE_NSS)
store->set_password_delegate_factory(
- base::Bind(&chrome::NewCryptoModuleBlockingDialogDelegate,
+ base::Bind(&chrome::CreateCryptoModuleBlockingPasswordDelegate,
chrome::kCryptoModulePasswordClientAuth));
#endif
return store.PassAs<net::ClientCertStore>();
@@ -838,6 +839,36 @@ 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());
+ scoped_ptr<net::KeygenHandler> keygen_handler(
+ new net::KeygenHandler(key_size_in_bits, challenge_string, url));
+
+#if defined(USE_NSS)
+ 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>());
+
+ if (delegate_ptr->InitializeSlot(this, base::Closure()))
+ return keygen_handler.Pass();
+
+ bool rv = delegate_ptr->InitializeSlot(
+ this, base::Bind(callback, base::Passed(&keygen_handler)));
+ DCHECK(!rv);
Ryan Sleevi 2013/12/05 00:23:19 I still find the async setup here a little weird.
mattm 2013/12/05 00:42:44 Yeah, this is weird. The problem is the base::Pass
mattm 2013/12/05 00:46:48 Oh yeah, the problem with that approach is that th
Ryan Sleevi 2013/12/05 01:05:54 I feel like you can avoid this by avoiding the bas
mattm 2013/12/05 04:41:25 Ah, yeah. I've done that (though just using Owned
+ return scoped_ptr<net::KeygenHandler>();
+#else
+ return keygen_handler.Pass();
+#endif
+}
+
bool ProfileIOData::ResourceContext::AllowMicAccess(const GURL& origin) {
return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
}

Powered by Google App Engine
This is Rietveld 408576698