| 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" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "net/base/ssl_cert_request_info.h" | 15 #include "net/base/ssl_cert_request_info.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class HttpNetworkSession; | 18 class HttpNetworkSession; |
| 19 class URLRequest; | 19 class URLRequest; |
| 20 class X509Certificate; | 20 class X509Certificate; |
| 21 } // namespace net | 21 } // namespace net |
| 22 | 22 |
| 23 // This class handles the approval and selection of a certificate for SSL client | 23 // This class handles the approval and selection of a certificate for SSL client |
| 24 // authentication by the user. | 24 // authentication by the user. |
| 25 // It is self-owned and deletes itself when the UI reports the user selection or | 25 // It is self-owned and deletes itself when the UI reports the user selection or |
| 26 // when the net::URLRequest is cancelled. | 26 // when the net::URLRequest is cancelled. |
| 27 class CONTENT_EXPORT SSLClientAuthHandler | 27 class CONTENT_EXPORT SSLClientAuthHandler |
| 28 : public base::RefCountedThreadSafe<SSLClientAuthHandler, | 28 : public base::RefCountedThreadSafe< |
| 29 BrowserThread::DeleteOnIOThread> { | 29 SSLClientAuthHandler, content::BrowserThread::DeleteOnIOThread> { |
| 30 public: | 30 public: |
| 31 SSLClientAuthHandler(net::URLRequest* request, | 31 SSLClientAuthHandler(net::URLRequest* request, |
| 32 net::SSLCertRequestInfo* cert_request_info); | 32 net::SSLCertRequestInfo* cert_request_info); |
| 33 | 33 |
| 34 // Selects a certificate and resumes the URL request with that certificate. | 34 // Selects a certificate and resumes the URL request with that certificate. |
| 35 // Should only be called on the IO thread. | 35 // Should only be called on the IO thread. |
| 36 void SelectCertificate(); | 36 void SelectCertificate(); |
| 37 | 37 |
| 38 // Invoked when the request associated with this handler is cancelled. | 38 // Invoked when the request associated with this handler is cancelled. |
| 39 // Should only be called on the IO thread. | 39 // Should only be called on the IO thread. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 54 | 54 |
| 55 // Returns the session the URL request is associated with. | 55 // Returns the session the URL request is associated with. |
| 56 const net::HttpNetworkSession* http_network_session() const { | 56 const net::HttpNetworkSession* http_network_session() const { |
| 57 return http_network_session_; | 57 return http_network_session_; |
| 58 } | 58 } |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 virtual ~SSLClientAuthHandler(); | 61 virtual ~SSLClientAuthHandler(); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 friend class base::RefCountedThreadSafe<SSLClientAuthHandler, | 64 friend class base::RefCountedThreadSafe< |
| 65 BrowserThread::DeleteOnIOThread>; | 65 SSLClientAuthHandler, content::BrowserThread::DeleteOnIOThread>; |
| 66 friend class BrowserThread; | 66 friend class content::BrowserThread; |
| 67 friend class DeleteTask<SSLClientAuthHandler>; | 67 friend class DeleteTask<SSLClientAuthHandler>; |
| 68 | 68 |
| 69 // Notifies that the user has selected a cert. | 69 // Notifies that the user has selected a cert. |
| 70 // Called on the IO thread. | 70 // Called on the IO thread. |
| 71 void DoCertificateSelected(net::X509Certificate* cert); | 71 void DoCertificateSelected(net::X509Certificate* cert); |
| 72 | 72 |
| 73 // Selects a client certificate on the UI thread. | 73 // Selects a client certificate on the UI thread. |
| 74 void DoSelectCertificate(int render_process_host_id, | 74 void DoSelectCertificate(int render_process_host_id, |
| 75 int render_view_host_id); | 75 int render_view_host_id); |
| 76 | 76 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; | 115 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; |
| 116 | 116 |
| 117 scoped_refptr<SSLClientAuthHandler> handler_; | 117 scoped_refptr<SSLClientAuthHandler> handler_; |
| 118 | 118 |
| 119 content::NotificationRegistrar notification_registrar_; | 119 content::NotificationRegistrar notification_registrar_; |
| 120 | 120 |
| 121 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver); | 121 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ | 124 #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ |
| OLD | NEW |