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

Unified Diff: chrome/browser/ui/crypto_module_delegate_nss.cc

Issue 419013003: Replace c/b/nss_context by a KeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added Linux implementation. Created 6 years, 3 months 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/ui/crypto_module_delegate_nss.cc
diff --git a/chrome/browser/ui/crypto_module_delegate_nss.cc b/chrome/browser/ui/crypto_module_delegate_nss.cc
index 4829a4ab320bfd940d1eab36c1a2adc74f5eddd7..daefc12b2bec456c872332318389abd74f0e73f6 100644
--- a/chrome/browser/ui/crypto_module_delegate_nss.cc
+++ b/chrome/browser/ui/crypto_module_delegate_nss.cc
@@ -6,7 +6,6 @@
#include "base/basictypes.h"
#include "base/bind.h"
-#include "chrome/browser/net/nss_context.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
@@ -22,19 +21,24 @@ ChromeNSSCryptoModuleDelegate::ChromeNSSCryptoModuleDelegate(
ChromeNSSCryptoModuleDelegate::~ChromeNSSCryptoModuleDelegate() {}
bool ChromeNSSCryptoModuleDelegate::InitializeSlot(
- content::ResourceContext* context,
- const base::Closure& initialization_complete_callback) {
+ const base::Closure& initialization_complete_callback,
+ CertDatabaseServiceIOPart* cert_db_io) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(!slot_);
- base::Callback<void(crypto::ScopedPK11Slot)> get_slot_callback;
- if (!initialization_complete_callback.is_null())
- get_slot_callback = base::Bind(&ChromeNSSCryptoModuleDelegate::DidGetSlot,
- // Caller is responsible for keeping |this|
- // alive until the callback is run.
- base::Unretained(this),
- initialization_complete_callback);
+ base::Callback<void(net::NSSCertDatabase*)> get_nss_cert_db_callback;
+ if (!initialization_complete_callback.is_null()) {
+ get_nss_cert_db_callback =
+ base::Bind(&ChromeNSSCryptoModuleDelegate::DidGetNSSCertDB,
+ // Caller is responsible for keeping |this|
+ // alive until the callback is run.
+ base::Unretained(this),
+ initialization_complete_callback);
+ }
- slot_ = GetPrivateNSSKeySlotForResourceContext(context, get_slot_callback);
+ net::NSSCertDatabase* nss_cert_db =
+ cert_db_io->GetNSSCertDatabase(get_nss_cert_db_callback);
+ if (nss_cert_db)
+ slot_ = nss_cert_db->GetPrivateSlot();
return slot_.get() != NULL;
}
@@ -88,10 +92,11 @@ void ChromeNSSCryptoModuleDelegate::GotPassword(const std::string& password) {
event_.Signal();
}
-void ChromeNSSCryptoModuleDelegate::DidGetSlot(const base::Closure& callback,
- crypto::ScopedPK11Slot slot) {
+void ChromeNSSCryptoModuleDelegate::DidGetNSSCertDB(
+ const base::Closure& callback,
+ net::NSSCertDatabase* nss_cert_db) {
DCHECK(!slot_);
- slot_ = slot.Pass();
+ slot_ = nss_cert_db->GetPrivateSlot();
callback.Run();
}

Powered by Google App Engine
This is Rietveld 408576698