Use PlaybackToMemory for BitmapRasterWorkerPool playback
[chromium-blink-merge.git] / content / browser / ssl / ssl_client_auth_handler.h
blobf95e65d71bbfb35faacad9d33bc3d19784988af2
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 CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_
6 #define CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/browser_thread.h"
13 #include "net/ssl/ssl_cert_request_info.h"
15 namespace net {
16 class ClientCertStore;
17 class URLRequest;
18 class X509Certificate;
19 } // namespace net
21 namespace content {
23 // This class handles the approval and selection of a certificate for SSL client
24 // authentication by the user. Should only be used on the IO thread. If the
25 // SSLClientAuthHandler is destroyed before the certificate is selected, the
26 // selection is canceled and the callback never called.
27 class SSLClientAuthHandler {
28 public:
29 typedef base::Callback<void(net::X509Certificate*)> CertificateCallback;
31 SSLClientAuthHandler(scoped_ptr<net::ClientCertStore> client_cert_store,
32 net::URLRequest* request,
33 net::SSLCertRequestInfo* cert_request_info,
34 const CertificateCallback& callback);
35 ~SSLClientAuthHandler();
37 // Selects a certificate and resumes the URL request with that certificate.
38 void SelectCertificate();
40 private:
41 // Called when ClientCertStore is done retrieving the cert list.
42 void DidGetClientCerts();
44 // Called when the user has selected a cert.
45 void CertificateSelected(net::X509Certificate* cert);
47 // The net::URLRequest that triggered this client auth.
48 net::URLRequest* request_;
50 // The certs to choose from.
51 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_;
53 scoped_ptr<net::ClientCertStore> client_cert_store_;
55 // The callback to call when the certificate is selected.
56 CertificateCallback callback_;
58 base::WeakPtrFactory<SSLClientAuthHandler> weak_factory_;
60 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler);
63 } // namespace content
65 #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_