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

Unified Diff: chrome/browser/chromeos/platform_keys/platform_keys_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/chromeos/platform_keys/platform_keys_nss.cc
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc b/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc
index 2265f42b5e3465b69623c406c14796a177ad68e3..f57848f97c54ee8fe9efa8208a1c5fd1530ef9b8 100644
--- a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc
+++ b/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc
@@ -17,7 +17,9 @@
#include "base/thread_task_runner_handle.h"
#include "base/threading/worker_pool.h"
#include "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h"
-#include "chrome/browser/net/nss_context.h"
+#include "chrome/browser/net/cert_database_service_factory.h"
+#include "components/cert_database/public/cert_database_service.h"
+#include "components/cert_database/public/cert_database_service_io_part.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "crypto/rsa_private_key.h"
@@ -106,13 +108,19 @@ void DidGetCertDBOnIOThread(const std::string& token_id,
// Retrieves the NSSCertDatabase from |context| and, if |token_id| is not empty,
// the slot for |token_id|.
// Must be called on the IO thread.
-void GetCertDatabaseOnIOThread(const std::string& token_id,
- const GetCertDBCallback& callback,
- content::ResourceContext* context,
- NSSOperationState* state) {
+void GetCertDatabaseOnIOThread(
+ const std::string& token_id,
+ const GetCertDBCallback& callback,
+ base::WeakPtr<CertDatabaseServiceIOPart> db_io_part,
+ NSSOperationState* state) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext(
- context, base::Bind(&DidGetCertDBOnIOThread, token_id, callback, state));
+ if (!db_io_part) {
+ LOG(ERROR) << "CertDatabase shutdown.";
+ state->OnError(FROM_HERE, kErrorInternal);
+ return;
+ }
+ net::NSSCertDatabase* cert_db = db_io_part->GetNSSCertDatabase(
+ base::Bind(&DidGetCertDBOnIOThread, token_id, callback, state));
if (cert_db)
DidGetCertDBOnIOThread(token_id, callback, state, cert_db);
@@ -125,12 +133,14 @@ void GetCertDatabase(const std::string& token_id,
const GetCertDBCallback& callback,
BrowserContext* browser_context,
NSSOperationState* state) {
+ CertDatabaseService* cert_db_service =
+ CertDatabaseServiceFactory::GetForBrowserContext(browser_context);
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
base::Bind(&GetCertDatabaseOnIOThread,
token_id,
callback,
- browser_context->GetResourceContext(),
+ cert_db_service->GetIOPart(),
state));
}

Powered by Google App Engine
This is Rietveld 408576698