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

Unified Diff: chrome/browser/chromeos/net/client_cert_store_cros.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: cert manager basics working Created 7 years, 2 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/net/client_cert_store_cros.cc
diff --git a/chrome/browser/chromeos/net/client_cert_store_cros.cc b/chrome/browser/chromeos/net/client_cert_store_cros.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f8e06d3084d73c6a870dd23fa6888b103948327b
--- /dev/null
+++ b/chrome/browser/chromeos/net/client_cert_store_cros.cc
@@ -0,0 +1,57 @@
+// 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 "chrome/browser/chromeos/net/client_cert_store_cros.h"
+
+#include "base/barrier_closure.h"
+#include "base/bind.h"
+#include "crypto/scoped_nss_types.h"
+
+namespace chromeos {
+
+ClientCertStoreCros::ClientCertStoreCros(content::ResourceContext* context) {
+ // There are two subtasks that must be completed before we can retrieve the
+ // list of certs and filter them: initializing the filter, and getting the
+ // SSLCertRequestInfo/etc from the GetClientCerts call.
+ ready_to_get_certs_barrier_ =
+ base::BarrierClosure(2,
+ base::Bind(&ClientCertStoreCros::ReadyToGetCerts,
+ base::Unretained(this)));
+
+ // XXX Could remove the barrier if we moved this Init call into
+ // GetClientCerts, but then we would have to save the |context| value ...
+ profile_cert_filter_.Init(context, ready_to_get_certs_barrier_);
+}
+
+void ClientCertStoreCros::GetClientCerts(
+ const net::SSLCertRequestInfo& cert_request_info,
+ net::CertificateList* selected_certs,
+ const base::Closure& callback) {
+ cert_request_info_ = &cert_request_info;
+ selected_certs_ = selected_certs;
+ callback_ = callback;
+ ready_to_get_certs_barrier_.Run();
+}
+
+void ClientCertStoreCros::ReadyToGetCerts() {
+ LOG(WARNING) << __func__;
+ net_client_cert_store_impl_.GetClientCerts(
+ *cert_request_info_, selected_certs_,
+ base::Bind(&ClientCertStoreCros::GotClientCerts,
+ base::Unretained(this)));
+}
+
+void ClientCertStoreCros::GotClientCerts(){
+ size_t pre_size = selected_certs_->size();
+ selected_certs_->erase(
+ std::remove_if(selected_certs_->begin(), selected_certs_->end(),
+ ProfileCertFilter::Predicate(profile_cert_filter_)),
+ selected_certs_->end());
+ LOG(WARNING) << "filtered " << pre_size - selected_certs_->size() << " of "
+ << pre_size << " certs";
+
+ callback_.Run();
+}
+
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/net/client_cert_store_cros.h ('k') | chrome/browser/chromeos/net/nss_cert_database_cros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698