| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/ssl/ssl_client_auth_observer.h" | 10 #include "chrome/browser/ssl/ssl_client_auth_observer.h" |
| 10 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" | 11 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
| 11 #include "chrome/browser/ui/views/certificate_selector.h" | 12 #include "chrome/browser/ui/views/certificate_selector.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 13 | 14 |
| 14 // This header file exists only for testing. Chrome should access the | 15 // This header file exists only for testing. Chrome should access the |
| 15 // certificate selector only through the cross-platform interface | 16 // certificate selector only through the cross-platform interface |
| 16 // chrome/browser/ssl_client_certificate_selector.h. | 17 // chrome/browser/ssl_client_certificate_selector.h. |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 class WebContents; | 20 class WebContents; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace net { | 23 namespace net { |
| 23 class SSLCertRequestInfo; | 24 class SSLCertRequestInfo; |
| 24 class X509Certificate; | 25 class X509Certificate; |
| 25 } | 26 } |
| 26 | 27 |
| 27 class SSLClientCertificateSelector : public chrome::CertificateSelector, | 28 class SSLClientCertificateSelector : public chrome::CertificateSelector, |
| 28 public SSLClientAuthObserver, | 29 public SSLClientAuthObserver, |
| 29 public content::WebContentsObserver { | 30 public content::WebContentsObserver { |
| 30 public: | 31 public: |
| 31 SSLClientCertificateSelector( | 32 SSLClientCertificateSelector( |
| 32 content::WebContents* web_contents, | 33 content::WebContents* web_contents, |
| 33 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, | 34 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, |
| 34 net::CertificateList client_certs, | 35 net::ClientCertIdentityList client_certs, |
| 35 std::unique_ptr<content::ClientCertificateDelegate> delegate); | 36 std::unique_ptr<content::ClientCertificateDelegate> delegate); |
| 36 ~SSLClientCertificateSelector() override; | 37 ~SSLClientCertificateSelector() override; |
| 37 | 38 |
| 38 void Init(); | 39 void Init(); |
| 39 | 40 |
| 40 // SSLClientAuthObserver: | 41 // SSLClientAuthObserver: |
| 41 void OnCertSelectedByNotification() override; | 42 void OnCertSelectedByNotification() override; |
| 42 | 43 |
| 43 // chrome::CertificateSelector: | 44 // chrome::CertificateSelector: |
| 44 void DeleteDelegate() override; | 45 void DeleteDelegate() override; |
| 45 bool Accept() override; | 46 bool AcceptCertificate( |
| 47 std::unique_ptr<net::ClientCertIdentity> identity) override; |
| 46 | 48 |
| 47 // content::WebContentsObserver: | 49 // content::WebContentsObserver: |
| 48 void WebContentsDestroyed() override; | 50 void WebContentsDestroyed() override; |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 // Callback after unlocking certificate slot. | 53 // Callback after retrieving private key. |
| 52 void Unlocked(net::X509Certificate* cert); | 54 void GotPrivateKey(net::X509Certificate* cert, |
| 55 scoped_refptr<net::SSLPrivateKey> private_key); |
| 56 |
| 57 base::WeakPtrFactory<SSLClientCertificateSelector> weak_ptr_factory_{this}; |
| 53 | 58 |
| 54 DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector); | 59 DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector); |
| 55 }; | 60 }; |
| 56 | 61 |
| 57 #endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ | 62 #endif // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ |
| OLD | NEW |