| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ | 6 #define CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // authentication by the user. | 22 // authentication by the user. |
| 23 // It is self-owned and deletes itself when the UI reports the user selection or | 23 // It is self-owned and deletes itself when the UI reports the user selection or |
| 24 // when the net::URLRequest is cancelled. | 24 // when the net::URLRequest is cancelled. |
| 25 class SSLClientAuthHandler | 25 class SSLClientAuthHandler |
| 26 : public base::RefCountedThreadSafe<SSLClientAuthHandler, | 26 : public base::RefCountedThreadSafe<SSLClientAuthHandler, |
| 27 BrowserThread::DeleteOnIOThread> { | 27 BrowserThread::DeleteOnIOThread> { |
| 28 public: | 28 public: |
| 29 SSLClientAuthHandler(net::URLRequest* request, | 29 SSLClientAuthHandler(net::URLRequest* request, |
| 30 net::SSLCertRequestInfo* cert_request_info); | 30 net::SSLCertRequestInfo* cert_request_info); |
| 31 | 31 |
| 32 // Asks the user to select a certificate and resumes the URL request with that | 32 // Selects a certificate and resumes the URL request with that certificate. |
| 33 // certificate. | |
| 34 // Should only be called on the IO thread. | 33 // Should only be called on the IO thread. |
| 35 void SelectCertificate(); | 34 void SelectCertificate(); |
| 36 | 35 |
| 37 // Invoked when the request associated with this handler is cancelled. | 36 // Invoked when the request associated with this handler is cancelled. |
| 38 // Should only be called on the IO thread. | 37 // Should only be called on the IO thread. |
| 39 void OnRequestCancelled(); | 38 void OnRequestCancelled(); |
| 40 | 39 |
| 41 // Calls DoCertificateSelected on the I/O thread. | 40 // Calls DoCertificateSelected on the I/O thread. |
| 42 // Called on the UI thread after the user has made a selection (which may | 41 // Called on the UI thread after the user has made a selection (which may |
| 43 // be long after DoSelectCertificate returns, if the UI is modeless/async.) | 42 // be long after DoSelectCertificate returns, if the UI is modeless/async.) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 55 virtual ~SSLClientAuthHandler(); | 54 virtual ~SSLClientAuthHandler(); |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 friend class BrowserThread; | 57 friend class BrowserThread; |
| 59 friend class DeleteTask<SSLClientAuthHandler>; | 58 friend class DeleteTask<SSLClientAuthHandler>; |
| 60 | 59 |
| 61 // Notifies that the user has selected a cert. | 60 // Notifies that the user has selected a cert. |
| 62 // Called on the IO thread. | 61 // Called on the IO thread. |
| 63 void DoCertificateSelected(net::X509Certificate* cert); | 62 void DoCertificateSelected(net::X509Certificate* cert); |
| 64 | 63 |
| 65 // Calls the SSL helper on the UI thread. | 64 // Selects a client certificate on the UI thread. |
| 66 void ShowClientCertificateRequestDialog(int render_process_host_id, | 65 void DoSelectCertificate(int render_process_host_id, |
| 67 int render_view_host_id); | 66 int render_view_host_id); |
| 68 | 67 |
| 69 // The net::URLRequest that triggered this client auth. | 68 // The net::URLRequest that triggered this client auth. |
| 70 net::URLRequest* request_; | 69 net::URLRequest* request_; |
| 71 | 70 |
| 72 // The certs to choose from. | 71 // The certs to choose from. |
| 73 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; | 72 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; |
| 74 | 73 |
| 75 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler); | 74 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler); |
| 76 }; | 75 }; |
| 77 | 76 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 103 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; | 102 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; |
| 104 | 103 |
| 105 scoped_refptr<SSLClientAuthHandler> handler_; | 104 scoped_refptr<SSLClientAuthHandler> handler_; |
| 106 | 105 |
| 107 NotificationRegistrar notification_registrar_; | 106 NotificationRegistrar notification_registrar_; |
| 108 | 107 |
| 109 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver); | 108 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver); |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ | 111 #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ |
| OLD | NEW |