| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_SSL_HELPER_H_ | |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_SSL_HELPER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/callback_forward.h" | |
| 11 #include "base/memory/linked_ptr.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 | |
| 14 class SSLAddCertHandler; | |
| 15 class TabContents; | |
| 16 | |
| 17 namespace net { | |
| 18 class HttpNetworkSession; | |
| 19 class SSLCertRequestInfo; | |
| 20 class X509Certificate; | |
| 21 } | |
| 22 | |
| 23 class TabContentsSSLHelper { | |
| 24 public: | |
| 25 explicit TabContentsSSLHelper(TabContents* tab_contents); | |
| 26 virtual ~TabContentsSSLHelper(); | |
| 27 | |
| 28 // Called when |handler| encounters an error in verifying a received client | |
| 29 // certificate. Note that, because CAs often will not send us intermediate | |
| 30 // certificates, the verification we can do is minimal: we verify the | |
| 31 // certificate is parseable, that we have the corresponding private key, and | |
| 32 // that the certificate has not expired. | |
| 33 void OnVerifyClientCertificateError( | |
| 34 scoped_refptr<SSLAddCertHandler> handler, int error_code); | |
| 35 | |
| 36 // Called when |handler| requests the user's confirmation in adding a client | |
| 37 // certificate. | |
| 38 void AskToAddClientCertificate( | |
| 39 scoped_refptr<SSLAddCertHandler> handler); | |
| 40 | |
| 41 // Called when |handler| successfully adds a client certificate. | |
| 42 void OnAddClientCertificateSuccess( | |
| 43 scoped_refptr<SSLAddCertHandler> handler); | |
| 44 | |
| 45 // Called when |handler| encounters an error adding a client certificate. | |
| 46 void OnAddClientCertificateError( | |
| 47 scoped_refptr<SSLAddCertHandler> handler, int error_code); | |
| 48 | |
| 49 // Called when |handler| has completed, so the delegate may release any state | |
| 50 // accumulated. | |
| 51 void OnAddClientCertificateFinished( | |
| 52 scoped_refptr<SSLAddCertHandler> handler); | |
| 53 | |
| 54 // Displays a dialog for selecting a client certificate and returns it to | |
| 55 // the |handler|. | |
| 56 void ShowClientCertificateRequestDialog( | |
| 57 const net::HttpNetworkSession* network_session, | |
| 58 net::SSLCertRequestInfo* cert_request_info, | |
| 59 const base::Callback<void(net::X509Certificate*)>& callback); | |
| 60 | |
| 61 private: | |
| 62 TabContents* tab_contents_; | |
| 63 | |
| 64 class SSLAddCertData; | |
| 65 std::map<int, linked_ptr<SSLAddCertData> > request_id_to_add_cert_data_; | |
| 66 | |
| 67 SSLAddCertData* GetAddCertData(SSLAddCertHandler* handler); | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(TabContentsSSLHelper); | |
| 70 }; | |
| 71 | |
| 72 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_SSL_HELPER_H_ | |
| OLD | NEW |