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