| Index: chrome/browser/chromeos/net/client_cert_store_chromeos.cc
|
| diff --git a/chrome/browser/chromeos/net/client_cert_store_chromeos.cc b/chrome/browser/chromeos/net/client_cert_store_chromeos.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..03fc90a3b0593230abfaee2af7cd313320cc574c
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/net/client_cert_store_chromeos.cc
|
| @@ -0,0 +1,55 @@
|
| +// 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_chromeos.h"
|
| +
|
| +#include "base/bind.h"
|
| +#include "content/public/browser/nss_context.h"
|
| +
|
| +namespace chromeos {
|
| +
|
| +ClientCertStoreChromeOS::ClientCertStoreChromeOS(
|
| + content::ResourceContext* context)
|
| + : context_(context) {}
|
| +
|
| +ClientCertStoreChromeOS::~ClientCertStoreChromeOS() {}
|
| +
|
| +void ClientCertStoreChromeOS::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;
|
| +
|
| + content::OnNSSKeySlotsForResourceContextReady(
|
| + context_,
|
| + base::Bind(&ClientCertStoreChromeOS::DidGetSlots,
|
| + base::Unretained(this)));
|
| +}
|
| +
|
| +void ClientCertStoreChromeOS::DidGetSlots(crypto::ScopedPK11Slot public_slot,
|
| + crypto::ScopedPK11Slot private_slot) {
|
| + VLOG(1) << __func__;
|
| + profile_filter_.Init(public_slot.Pass(), private_slot.Pass());
|
| + net_client_cert_store_impl_.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(),
|
| + net::NSSProfileFilterChromeOS::Predicate(profile_filter_)),
|
| + selected_certs_->end());
|
| + VLOG(1) << "filtered " << pre_size - selected_certs_->size() << " of "
|
| + << pre_size << " certs";
|
| +
|
| + callback_.Run();
|
| +}
|
| +
|
| +} // namespace chromeos
|
|
|