libyuv r905 with yuv off by 1 fix for valgrind overread
[chromium-blink-merge.git] / net / ssl / client_cert_store_impl.h
blob6a39c2809040ed816630598677b64d48293c3b7c
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_SSL_CLIENT_CERT_STORE_IMPL_H_
6 #define NET_SSL_CLIENT_CERT_STORE_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/gtest_prod_util.h"
11 #include "net/base/net_export.h"
12 #include "net/ssl/client_cert_store.h"
13 #include "net/ssl/ssl_cert_request_info.h"
15 namespace crypto {
16 class CryptoModuleBlockingPasswordDelegate;
19 namespace net {
21 class NET_EXPORT ClientCertStoreImpl : public ClientCertStore {
22 public:
23 ClientCertStoreImpl();
24 virtual ~ClientCertStoreImpl();
26 // ClientCertStore:
27 virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info,
28 CertificateList* selected_certs,
29 const base::Closure& callback) OVERRIDE;
31 #if defined(USE_NSS)
32 typedef base::Callback<crypto::CryptoModuleBlockingPasswordDelegate*(
33 const std::string& /* server */)> PasswordDelegateFactory;
34 // Set a factory that will be used to create a delegate for unlocking PKCS #11
35 // tokens. The host:port string of the server requesting client auth will be
36 // passed to the factory.
37 void set_password_delegate_factory(
38 const PasswordDelegateFactory& password_delegate_factory);
39 #endif
41 private:
42 friend class ClientCertStoreImplTest;
44 // A hook for testing. Filters |input_certs| using the logic being used to
45 // filter the system store when GetClientCerts() is called. Depending on the
46 // implementation, this might be:
47 // - Implemented by creating a temporary in-memory store and filtering it
48 // using the common logic (preferable, currently on Windows).
49 // - Implemented by creating a list of certificates that otherwise would be
50 // extracted from the system store and filtering it using the common logic
51 // (less adequate, currently on NSS and Mac).
52 bool SelectClientCertsForTesting(const CertificateList& input_certs,
53 const SSLCertRequestInfo& cert_request_info,
54 CertificateList* selected_certs);
56 #if defined(OS_MACOSX) && !defined(OS_IOS)
57 // Testing hook specific to Mac, where the internal logic recognizes preferred
58 // certificates for particular domains. If the preferred certificate is
59 // present in the output list (i.e. it doesn't get filtered out), it should
60 // always come first.
61 bool SelectClientCertsGivenPreferredForTesting(
62 const scoped_refptr<X509Certificate>& preferred_cert,
63 const CertificateList& regular_certs,
64 const SSLCertRequestInfo& request,
65 CertificateList* selected_certs);
66 #endif
68 #if defined(USE_NSS)
69 // The factory for creating the delegate for requesting a password to a
70 // PKCS #11 token. May be null.
71 PasswordDelegateFactory password_delegate_factory_;
72 #endif // defined(USE_NSS)
74 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreImpl);
77 } // namespace net
79 #endif // NET_SSL_CLIENT_CERT_STORE_IMPL_H_