OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H |
| 6 #define CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/ref_counted.h" |
| 10 #include "net/base/ssl_cert_request_info.h" |
| 11 |
| 12 namespace net { |
| 13 class X509Certificate; |
| 14 } |
| 15 class MessageLoop; |
| 16 class URLRequest; |
| 17 |
| 18 // This class handles the approval and selection of a certificate for SSL client |
| 19 // authentication by the user. |
| 20 // It is self-owned and deletes itself when the UI reports the user selection or |
| 21 // when the URLRequest is cancelled. |
| 22 class SSLClientAuthHandler : public base::RefCounted<SSLClientAuthHandler> { |
| 23 public: |
| 24 SSLClientAuthHandler(URLRequest* request, |
| 25 net::SSLCertRequestInfo* cert_request_info, |
| 26 MessageLoop* io_loop, |
| 27 MessageLoop* ui_loop); |
| 28 ~SSLClientAuthHandler(); |
| 29 |
| 30 // Asks the user for a certificate and resumes the URL request with that |
| 31 // certificate. |
| 32 // Should only be called on the IO thread. |
| 33 void SelectCertificate(); |
| 34 |
| 35 // Invoked when the request associated with this handler is cancelled. |
| 36 // Should only be called on the IO thread. |
| 37 void OnRequestCancelled(); |
| 38 |
| 39 private: |
| 40 // Prompts the user for a cert. |
| 41 // Called on the UI thread. |
| 42 void AskUserForCertificate(); |
| 43 |
| 44 // Notifies that the user has selected a cert. |
| 45 // Called on the IO thread. |
| 46 void CertificateSelected(net::X509Certificate* cert); |
| 47 |
| 48 // The URLRequest that triggered this client auth. |
| 49 URLRequest* request_; |
| 50 |
| 51 // The certs to choose from. |
| 52 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; |
| 53 |
| 54 MessageLoop* io_loop_; |
| 55 MessageLoop* ui_loop_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler); |
| 58 }; |
| 59 |
| 60 #endif // CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H |
OLD | NEW |