Get ClientCertStore through ResourceContext.
[chromium-blink-merge.git] / net / ssl / client_cert_store_impl.h
blobff2759e06677acd0e41c333360c2f0a555a8aeb5
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/gtest_prod_util.h"
10 #include "net/base/net_export.h"
11 #include "net/ssl/client_cert_store.h"
12 #include "net/ssl/ssl_cert_request_info.h"
14 namespace net {
16 class NET_EXPORT ClientCertStoreImpl : public ClientCertStore {
17 public:
18 ClientCertStoreImpl() {}
19 virtual ~ClientCertStoreImpl() {}
21 // ClientCertStore:
22 virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info,
23 CertificateList* selected_certs,
24 const base::Closure& callback) OVERRIDE;
26 private:
27 friend class ClientCertStoreImplTest;
29 // A hook for testing. Filters |input_certs| using the logic being used to
30 // filter the system store when GetClientCerts() is called. Depending on the
31 // implementation, this might be:
32 // - Implemented by creating a temporary in-memory store and filtering it
33 // using the common logic (preferable, currently on Windows).
34 // - Implemented by creating a list of certificates that otherwise would be
35 // extracted from the system store and filtering it using the common logic
36 // (less adequate, currently on NSS and Mac).
37 bool SelectClientCertsForTesting(const CertificateList& input_certs,
38 const SSLCertRequestInfo& cert_request_info,
39 CertificateList* selected_certs);
41 #if defined(OS_MACOSX) && !defined(OS_IOS)
42 // Testing hook specific to Mac, where the internal logic recognizes preferred
43 // certificates for particular domains. If the preferred certificate is
44 // present in the output list (i.e. it doesn't get filtered out), it should
45 // always come first.
46 bool SelectClientCertsGivenPreferredForTesting(
47 const scoped_refptr<X509Certificate>& preferred_cert,
48 const CertificateList& regular_certs,
49 const SSLCertRequestInfo& request,
50 CertificateList* selected_certs);
51 #endif
53 DISALLOW_COPY_AND_ASSIGN(ClientCertStoreImpl);
56 } // namespace net
58 #endif // NET_SSL_CLIENT_CERT_STORE_IMPL_H_