| 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_TAB_CONTENTS_TAB_CONTENTS_SSL_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_SSL_HELPER_H_ | 6 #define CHROME_BROWSER_SSL_SSL_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "chrome/browser/tab_contents/web_contents_user_data.h" |
| 13 | 14 |
| 14 class SSLAddCertHandler; | 15 class SSLAddCertHandler; |
| 15 class TabContents; | |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class HttpNetworkSession; | 18 class HttpNetworkSession; |
| 19 class SSLCertRequestInfo; | 19 class SSLCertRequestInfo; |
| 20 class X509Certificate; | 20 class X509Certificate; |
| 21 } | 21 } |
| 22 | 22 |
| 23 class TabContentsSSLHelper { | 23 class SSLTabHelper : public WebContentsUserData<SSLTabHelper> { |
| 24 public: | 24 public: |
| 25 explicit TabContentsSSLHelper(TabContents* tab_contents); | 25 virtual ~SSLTabHelper(); |
| 26 virtual ~TabContentsSSLHelper(); | |
| 27 | 26 |
| 28 // Called when |handler| encounters an error in verifying a received client | 27 // Called when |handler| encounters an error in verifying a received client |
| 29 // certificate. Note that, because CAs often will not send us intermediate | 28 // certificate. Note that, because CAs often will not send us intermediate |
| 30 // certificates, the verification we can do is minimal: we verify the | 29 // certificates, the verification we can do is minimal: we verify the |
| 31 // certificate is parseable, that we have the corresponding private key, and | 30 // certificate is parseable, that we have the corresponding private key, and |
| 32 // that the certificate has not expired. | 31 // that the certificate has not expired. |
| 33 void OnVerifyClientCertificateError( | 32 void OnVerifyClientCertificateError( |
| 34 scoped_refptr<SSLAddCertHandler> handler, int error_code); | 33 scoped_refptr<SSLAddCertHandler> handler, int error_code); |
| 35 | 34 |
| 36 // Called when |handler| requests the user's confirmation in adding a client | 35 // Called when |handler| requests the user's confirmation in adding a client |
| (...skipping 15 matching lines...) Expand all Loading... |
| 52 scoped_refptr<SSLAddCertHandler> handler); | 51 scoped_refptr<SSLAddCertHandler> handler); |
| 53 | 52 |
| 54 // Displays a dialog for selecting a client certificate and returns it to | 53 // Displays a dialog for selecting a client certificate and returns it to |
| 55 // the |handler|. | 54 // the |handler|. |
| 56 void ShowClientCertificateRequestDialog( | 55 void ShowClientCertificateRequestDialog( |
| 57 const net::HttpNetworkSession* network_session, | 56 const net::HttpNetworkSession* network_session, |
| 58 net::SSLCertRequestInfo* cert_request_info, | 57 net::SSLCertRequestInfo* cert_request_info, |
| 59 const base::Callback<void(net::X509Certificate*)>& callback); | 58 const base::Callback<void(net::X509Certificate*)>& callback); |
| 60 | 59 |
| 61 private: | 60 private: |
| 62 TabContents* tab_contents_; | 61 explicit SSLTabHelper(content::WebContents* contents); |
| 62 static int kUserDataKey; |
| 63 friend class WebContentsUserData<SSLTabHelper>; |
| 64 |
| 65 content::WebContents* web_contents_; |
| 63 | 66 |
| 64 class SSLAddCertData; | 67 class SSLAddCertData; |
| 65 std::map<int, linked_ptr<SSLAddCertData> > request_id_to_add_cert_data_; | 68 std::map<int, linked_ptr<SSLAddCertData> > request_id_to_add_cert_data_; |
| 66 | 69 |
| 67 SSLAddCertData* GetAddCertData(SSLAddCertHandler* handler); | 70 SSLAddCertData* GetAddCertData(SSLAddCertHandler* handler); |
| 68 | 71 |
| 69 DISALLOW_COPY_AND_ASSIGN(TabContentsSSLHelper); | 72 DISALLOW_COPY_AND_ASSIGN(SSLTabHelper); |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_SSL_HELPER_H_ | 75 #endif // CHROME_BROWSER_SSL_SSL_TAB_HELPER_H_ |
| OLD | NEW |