| 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 #include "chrome/browser/ssl/ssl_add_cert_handler.h" | 5 #include "chrome/browser/ssl/ssl_add_cert_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 8 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
| 9 #include "chrome/browser/tab_contents/tab_util.h" | 9 #include "chrome/browser/tab_contents/tab_util.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/resource_request_info.h" | 12 #include "content/public/browser/resource_request_info.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "net/base/cert_database.h" | 14 #include "net/base/cert_database.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "net/base/x509_certificate.h" | 16 #include "net/base/x509_certificate.h" |
| 17 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
| 18 | 18 |
| 19 using content::BrowserThread; | 19 using content::BrowserThread; |
| 20 using content::WebContents; | 20 using content::WebContents; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 Release(); | 88 Release(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SSLAddCertHandler::CallVerifyClientCertificateError(int cert_error) { | 91 void SSLAddCertHandler::CallVerifyClientCertificateError(int cert_error) { |
| 92 WebContents* tab = tab_util::GetWebContentsByID( | 92 WebContents* tab = tab_util::GetWebContentsByID( |
| 93 render_process_host_id_, render_view_id_); | 93 render_process_host_id_, render_view_id_); |
| 94 if (!tab) | 94 if (!tab) |
| 95 return; | 95 return; |
| 96 | 96 |
| 97 TabContentsWrapper* wrapper = | 97 TabContents* tab_contents = TabContents::FromWebContents(tab); |
| 98 TabContentsWrapper::GetCurrentWrapperForContents(tab); | 98 tab_contents->ssl_helper()->OnVerifyClientCertificateError(this, cert_error); |
| 99 wrapper->ssl_helper()->OnVerifyClientCertificateError(this, cert_error); | |
| 100 } | 99 } |
| 101 | 100 |
| 102 void SSLAddCertHandler::CallAddClientCertificate(bool add_cert, | 101 void SSLAddCertHandler::CallAddClientCertificate(bool add_cert, |
| 103 int cert_error) { | 102 int cert_error) { |
| 104 WebContents* tab = tab_util::GetWebContentsByID( | 103 WebContents* tab = tab_util::GetWebContentsByID( |
| 105 render_process_host_id_, render_view_id_); | 104 render_process_host_id_, render_view_id_); |
| 106 if (!tab) | 105 if (!tab) |
| 107 return; | 106 return; |
| 108 | 107 |
| 109 TabContentsWrapper* wrapper = | 108 TabContents* tab_contents = TabContents::FromWebContents(tab); |
| 110 TabContentsWrapper::GetCurrentWrapperForContents(tab); | |
| 111 if (add_cert) { | 109 if (add_cert) { |
| 112 if (cert_error == net::OK) { | 110 if (cert_error == net::OK) { |
| 113 wrapper->ssl_helper()->OnAddClientCertificateSuccess(this); | 111 tab_contents->ssl_helper()->OnAddClientCertificateSuccess(this); |
| 114 } else { | 112 } else { |
| 115 wrapper->ssl_helper()->OnAddClientCertificateError(this, cert_error); | 113 tab_contents->ssl_helper()->OnAddClientCertificateError(this, cert_error); |
| 116 } | 114 } |
| 117 } | 115 } |
| 118 wrapper->ssl_helper()->OnAddClientCertificateFinished(this); | 116 tab_contents->ssl_helper()->OnAddClientCertificateFinished(this); |
| 119 } | 117 } |
| OLD | NEW |