OLD | NEW |
1 // Copyright (c) 2011 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 "content/browser/ssl/ssl_client_auth_handler.h" | 5 #include "content/browser/ssl/ssl_client_auth_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 8 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
9 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 9 #include "content/browser/renderer_host/resource_request_info_impl.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
11 #include "content/public/browser/content_browser_client.h" | 11 #include "content/public/browser/content_browser_client.h" |
12 #include "net/base/x509_certificate.h" | 12 #include "net/base/x509_certificate.h" |
13 #include "net/http/http_transaction_factory.h" | 13 #include "net/http/http_transaction_factory.h" |
14 #include "net/url_request/url_request.h" | 14 #include "net/url_request/url_request.h" |
15 #include "net/url_request/url_request_context.h" | 15 #include "net/url_request/url_request_context.h" |
16 | 16 |
17 using content::BrowserThread; | 17 using content::BrowserThread; |
| 18 using content::ResourceRequestInfoImpl; |
18 | 19 |
19 SSLClientAuthHandler::SSLClientAuthHandler( | 20 SSLClientAuthHandler::SSLClientAuthHandler( |
20 net::URLRequest* request, | 21 net::URLRequest* request, |
21 net::SSLCertRequestInfo* cert_request_info) | 22 net::SSLCertRequestInfo* cert_request_info) |
22 : request_(request), | 23 : request_(request), |
23 http_network_session_( | 24 http_network_session_( |
24 request_->context()->http_transaction_factory()->GetSession()), | 25 request_->context()->http_transaction_factory()->GetSession()), |
25 cert_request_info_(cert_request_info) { | 26 cert_request_info_(cert_request_info) { |
26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
27 } | 28 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 70 |
70 void SSLClientAuthHandler::DoCertificateSelected(net::X509Certificate* cert) { | 71 void SSLClientAuthHandler::DoCertificateSelected(net::X509Certificate* cert) { |
71 VLOG(1) << this << " DoCertificateSelected " << cert; | 72 VLOG(1) << this << " DoCertificateSelected " << cert; |
72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
73 // request_ could have been NULLed if the request was cancelled while the | 74 // request_ could have been NULLed if the request was cancelled while the |
74 // user was choosing a cert, or because we have already responded to the | 75 // user was choosing a cert, or because we have already responded to the |
75 // certificate. | 76 // certificate. |
76 if (request_) { | 77 if (request_) { |
77 request_->ContinueWithCertificate(cert); | 78 request_->ContinueWithCertificate(cert); |
78 | 79 |
79 ResourceDispatcherHostRequestInfo* info = | 80 ResourceRequestInfoImpl* info = |
80 ResourceDispatcherHost::InfoForRequest(request_); | 81 ResourceDispatcherHost::InfoForRequest(request_); |
81 if (info) | 82 if (info) |
82 info->set_ssl_client_auth_handler(NULL); | 83 info->set_ssl_client_auth_handler(NULL); |
83 | 84 |
84 request_ = NULL; | 85 request_ = NULL; |
85 } | 86 } |
86 } | 87 } |
87 | 88 |
88 void SSLClientAuthHandler::DoSelectCertificate( | 89 void SSLClientAuthHandler::DoSelectCertificate( |
89 int render_process_host_id, int render_view_host_id) { | 90 int render_process_host_id, int render_view_host_id) { |
90 content::GetContentClient()->browser()->SelectClientCertificate( | 91 content::GetContentClient()->browser()->SelectClientCertificate( |
91 render_process_host_id, render_view_host_id, http_network_session_, | 92 render_process_host_id, render_view_host_id, http_network_session_, |
92 cert_request_info_, | 93 cert_request_info_, |
93 base::Bind(&SSLClientAuthHandler::CertificateSelected, this)); | 94 base::Bind(&SSLClientAuthHandler::CertificateSelected, this)); |
94 } | 95 } |
OLD | NEW |