| 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 "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/loader/resource_dispatcher_host_impl.h" | 8 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 9 #include "content/browser/loader/resource_request_info_impl.h" | 9 #include "content/browser/loader/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/cert/x509_certificate.h" | |
| 13 #include "net/http/http_transaction_factory.h" | |
| 14 #include "net/ssl/client_cert_store.h" | 12 #include "net/ssl/client_cert_store.h" |
| 15 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
| 16 #include "net/url_request/url_request_context.h" | |
| 17 | 14 |
| 18 namespace content { | 15 namespace content { |
| 19 | 16 |
| 20 SSLClientAuthHandler::SSLClientAuthHandler( | 17 SSLClientAuthHandler::SSLClientAuthHandler( |
| 21 scoped_ptr<net::ClientCertStore> client_cert_store, | 18 scoped_ptr<net::ClientCertStore> client_cert_store, |
| 22 net::URLRequest* request, | 19 net::URLRequest* request, |
| 23 net::SSLCertRequestInfo* cert_request_info) | 20 net::SSLCertRequestInfo* cert_request_info) |
| 24 : request_(request), | 21 : request_(request), |
| 25 http_network_session_( | |
| 26 request_->context()->http_transaction_factory()->GetSession()), | |
| 27 cert_request_info_(cert_request_info), | 22 cert_request_info_(cert_request_info), |
| 28 client_cert_store_(client_cert_store.Pass()) { | 23 client_cert_store_(client_cert_store.Pass()) { |
| 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 30 } | 25 } |
| 31 | 26 |
| 32 SSLClientAuthHandler::~SSLClientAuthHandler() { | 27 SSLClientAuthHandler::~SSLClientAuthHandler() { |
| 33 // If we were simply dropped, then act as if we selected no certificate. | 28 // If we were simply dropped, then act as if we selected no certificate. |
| 34 DoCertificateSelected(NULL); | 29 DoCertificateSelected(NULL); |
| 35 } | 30 } |
| 36 | 31 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 ClearSSLClientAuthHandlerForRequest(request_); | 105 ClearSSLClientAuthHandlerForRequest(request_); |
| 111 request_ = NULL; | 106 request_ = NULL; |
| 112 } | 107 } |
| 113 } | 108 } |
| 114 | 109 |
| 115 void SSLClientAuthHandler::DoSelectCertificate( | 110 void SSLClientAuthHandler::DoSelectCertificate( |
| 116 int render_process_host_id, int render_frame_host_id) { | 111 int render_process_host_id, int render_frame_host_id) { |
| 117 GetContentClient()->browser()->SelectClientCertificate( | 112 GetContentClient()->browser()->SelectClientCertificate( |
| 118 render_process_host_id, | 113 render_process_host_id, |
| 119 render_frame_host_id, | 114 render_frame_host_id, |
| 120 http_network_session_, | |
| 121 cert_request_info_.get(), | 115 cert_request_info_.get(), |
| 122 base::Bind(&SSLClientAuthHandler::CertificateSelected, this)); | 116 base::Bind(&SSLClientAuthHandler::CertificateSelected, this)); |
| 123 } | 117 } |
| 124 | 118 |
| 125 } // namespace content | 119 } // namespace content |
| OLD | NEW |