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

Unified Diff: net/ssl/client_cert_store_chromeos.cc

Issue 18121007: *WIP* Store NSS slots per profile. Move keygen to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more refactoring 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
« no previous file with comments | « net/ssl/client_cert_store_chromeos.h ('k') | net/ssl/client_cert_store_impl_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/client_cert_store_chromeos.cc
diff --git a/net/ssl/client_cert_store_chromeos.cc b/net/ssl/client_cert_store_chromeos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6cd88c7c3e675a34e55d90b9801e95fed964235d
--- /dev/null
+++ b/net/ssl/client_cert_store_chromeos.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2013 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.
+
+#include "net/ssl/client_cert_store_chromeos.h"
+
+#include "base/bind.h"
+#include "crypto/nss_util_internal.h"
+
+namespace net {
+
+ClientCertStoreChromeOS::ClientCertStoreChromeOS(
+ const std::string& username_hash)
+ : username_hash_(username_hash) {}
+
+ClientCertStoreChromeOS::~ClientCertStoreChromeOS() {}
+
+void ClientCertStoreChromeOS::GetClientCerts(
+ const SSLCertRequestInfo& cert_request_info,
+ CertificateList* selected_certs,
+ const base::Closure& callback) {
+ cert_request_info_ = &cert_request_info;
+ selected_certs_ = selected_certs;
+ callback_ = callback;
+
+ crypto::ScopedPK11Slot private_slot(crypto::GetPrivateSlotForChromeOSUser(
+ username_hash_,
+ base::Bind(&ClientCertStoreChromeOS::DidGetPrivateSlot,
+ base::Unretained(this))));
+ if (private_slot)
+ DidGetPrivateSlot(private_slot.Pass());
+}
+
+void ClientCertStoreChromeOS::DidGetPrivateSlot(
+ crypto::ScopedPK11Slot private_slot) {
+ DVLOG(1) << __func__;
+ profile_filter_.Init(crypto::GetPublicSlotForChromeOSUser(username_hash_),
+ private_slot.Pass());
+ ClientCertStoreImpl::GetClientCerts(
+ *cert_request_info_,
+ selected_certs_,
+ base::Bind(&ClientCertStoreChromeOS::GotClientCerts,
+ base::Unretained(this)));
+}
+
+void ClientCertStoreChromeOS::GotClientCerts() {
+ size_t pre_size = selected_certs_->size();
+ selected_certs_->erase(
+ std::remove_if(selected_certs_->begin(),
+ selected_certs_->end(),
+ NSSProfileFilterChromeOS::Predicate(profile_filter_)),
+ selected_certs_->end());
+ DVLOG(1) << "filtered " << pre_size - selected_certs_->size() << " of "
+ << pre_size << " certs";
+
+ callback_.Run();
+}
+
+} // namespace net
« no previous file with comments | « net/ssl/client_cert_store_chromeos.h ('k') | net/ssl/client_cert_store_impl_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698