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_wrapper.h" |
11 #include "content/browser/renderer_host/resource_dispatcher_host.h" | |
12 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | |
13 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/resource_request_info.h" |
14 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
15 #include "net/base/cert_database.h" | 14 #include "net/base/cert_database.h" |
16 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
17 #include "net/base/x509_certificate.h" | 16 #include "net/base/x509_certificate.h" |
18 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
19 | 18 |
20 using content::BrowserThread; | 19 using content::BrowserThread; |
21 using content::WebContents; | 20 using content::WebContents; |
22 | 21 |
23 SSLAddCertHandler::SSLAddCertHandler(net::URLRequest* request, | 22 SSLAddCertHandler::SSLAddCertHandler(net::URLRequest* request, |
24 net::X509Certificate* cert, | 23 net::X509Certificate* cert, |
25 int render_process_host_id, | 24 int render_process_host_id, |
26 int render_view_id) | 25 int render_view_id) |
27 : cert_(cert), | 26 : cert_(cert), |
28 render_process_host_id_(render_process_host_id), | 27 render_process_host_id_(render_process_host_id), |
29 render_view_id_(render_view_id) { | 28 render_view_id_(render_view_id) { |
30 ResourceDispatcherHostRequestInfo* info = | 29 network_request_id_ |
31 ResourceDispatcherHost::InfoForRequest(request); | 30 = content::ResourceRequestInfo::ForRequest(request)->GetRequestID(); |
32 network_request_id_ = info->request_id(); | |
33 // Stay alive until the process completes and Finished() is called. | 31 // Stay alive until the process completes and Finished() is called. |
34 AddRef(); | 32 AddRef(); |
35 // Delay adding the certificate until the next mainloop iteration. | 33 // Delay adding the certificate until the next mainloop iteration. |
36 BrowserThread::PostTask( | 34 BrowserThread::PostTask( |
37 BrowserThread::IO, FROM_HERE, | 35 BrowserThread::IO, FROM_HERE, |
38 base::Bind(&SSLAddCertHandler::Run, this)); | 36 base::Bind(&SSLAddCertHandler::Run, this)); |
39 } | 37 } |
40 | 38 |
41 SSLAddCertHandler::~SSLAddCertHandler() {} | 39 SSLAddCertHandler::~SSLAddCertHandler() {} |
42 | 40 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 TabContentsWrapper::GetCurrentWrapperForContents(tab); | 110 TabContentsWrapper::GetCurrentWrapperForContents(tab); |
113 if (add_cert) { | 111 if (add_cert) { |
114 if (cert_error == net::OK) { | 112 if (cert_error == net::OK) { |
115 wrapper->ssl_helper()->OnAddClientCertificateSuccess(this); | 113 wrapper->ssl_helper()->OnAddClientCertificateSuccess(this); |
116 } else { | 114 } else { |
117 wrapper->ssl_helper()->OnAddClientCertificateError(this, cert_error); | 115 wrapper->ssl_helper()->OnAddClientCertificateError(this, cert_error); |
118 } | 116 } |
119 } | 117 } |
120 wrapper->ssl_helper()->OnAddClientCertificateFinished(this); | 118 wrapper->ssl_helper()->OnAddClientCertificateFinished(this); |
121 } | 119 } |
OLD | NEW |