| 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/ssl/ssl_tab_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.h" | |
| 11 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/resource_request_info.h" | 11 #include "content/public/browser/resource_request_info.h" |
| 13 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 14 #include "net/base/cert_database.h" | 13 #include "net/base/cert_database.h" |
| 15 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 16 #include "net/base/x509_certificate.h" | 15 #include "net/base/x509_certificate.h" |
| 17 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
| 18 | 17 |
| 19 using content::BrowserThread; | 18 using content::BrowserThread; |
| 20 using content::WebContents; | 19 using content::WebContents; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 80 |
| 82 Release(); | 81 Release(); |
| 83 } | 82 } |
| 84 | 83 |
| 85 void SSLAddCertHandler::CallVerifyClientCertificateError(int cert_error) { | 84 void SSLAddCertHandler::CallVerifyClientCertificateError(int cert_error) { |
| 86 WebContents* tab = tab_util::GetWebContentsByID( | 85 WebContents* tab = tab_util::GetWebContentsByID( |
| 87 render_process_host_id_, render_view_id_); | 86 render_process_host_id_, render_view_id_); |
| 88 if (!tab) | 87 if (!tab) |
| 89 return; | 88 return; |
| 90 | 89 |
| 91 TabContents* tab_contents = TabContents::FromWebContents(tab); | 90 SSLTabHelper* ssl_tab_helper = SSLTabHelper::FromWebContents(tab); |
| 92 tab_contents->ssl_helper()->OnVerifyClientCertificateError(this, cert_error); | 91 ssl_tab_helper->OnVerifyClientCertificateError(this, cert_error); |
| 93 } | 92 } |
| 94 | 93 |
| 95 void SSLAddCertHandler::CallAddClientCertificate(bool add_cert, | 94 void SSLAddCertHandler::CallAddClientCertificate(bool add_cert, |
| 96 int cert_error) { | 95 int cert_error) { |
| 97 WebContents* tab = tab_util::GetWebContentsByID( | 96 WebContents* tab = tab_util::GetWebContentsByID( |
| 98 render_process_host_id_, render_view_id_); | 97 render_process_host_id_, render_view_id_); |
| 99 if (!tab) | 98 if (!tab) |
| 100 return; | 99 return; |
| 101 | 100 |
| 102 TabContents* tab_contents = TabContents::FromWebContents(tab); | 101 SSLTabHelper* ssl_tab_helper = SSLTabHelper::FromWebContents(tab); |
| 103 if (add_cert) { | 102 if (add_cert) { |
| 104 if (cert_error == net::OK) { | 103 if (cert_error == net::OK) { |
| 105 tab_contents->ssl_helper()->OnAddClientCertificateSuccess(this); | 104 ssl_tab_helper->OnAddClientCertificateSuccess(this); |
| 106 } else { | 105 } else { |
| 107 tab_contents->ssl_helper()->OnAddClientCertificateError(this, cert_error); | 106 ssl_tab_helper->OnAddClientCertificateError(this, cert_error); |
| 108 } | 107 } |
| 109 } | 108 } |
| 110 tab_contents->ssl_helper()->OnAddClientCertificateFinished(this); | 109 ssl_tab_helper->OnAddClientCertificateFinished(this); |
| 111 } | 110 } |
| OLD | NEW |