Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: content/browser/ssl/ssl_client_auth_handler.cc

Issue 10501004: Refactor the guts of ResourceDispatcherHostImpl into a new class named (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/renderer_host/resource_dispatcher_host_impl.h"
8 #include "content/browser/renderer_host/resource_request_info_impl.h" 9 #include "content/browser/renderer_host/resource_request_info_impl.h"
9 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/content_browser_client.h" 11 #include "content/public/browser/content_browser_client.h"
11 #include "net/base/x509_certificate.h" 12 #include "net/base/x509_certificate.h"
12 #include "net/http/http_transaction_factory.h" 13 #include "net/http/http_transaction_factory.h"
13 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
14 #include "net/url_request/url_request_context.h" 15 #include "net/url_request/url_request_context.h"
15 16
16 using content::BrowserThread; 17 using content::BrowserThread;
18 using content::ResourceDispatcherHostImpl;
17 using content::ResourceRequestInfo; 19 using content::ResourceRequestInfo;
18 using content::ResourceRequestInfoImpl; 20 using content::ResourceRequestInfoImpl;
19 21
20 SSLClientAuthHandler::SSLClientAuthHandler( 22 SSLClientAuthHandler::SSLClientAuthHandler(
21 net::URLRequest* request, 23 net::URLRequest* request,
22 net::SSLCertRequestInfo* cert_request_info) 24 net::SSLCertRequestInfo* cert_request_info)
23 : request_(request), 25 : request_(request),
24 http_network_session_( 26 http_network_session_(
25 request_->context()->http_transaction_factory()->GetSession()), 27 request_->context()->http_transaction_factory()->GetSession()),
26 cert_request_info_(cert_request_info) { 28 cert_request_info_(cert_request_info) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 73
72 void SSLClientAuthHandler::DoCertificateSelected(net::X509Certificate* cert) { 74 void SSLClientAuthHandler::DoCertificateSelected(net::X509Certificate* cert) {
73 VLOG(1) << this << " DoCertificateSelected " << cert; 75 VLOG(1) << this << " DoCertificateSelected " << cert;
74 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
75 // request_ could have been NULLed if the request was cancelled while the 77 // request_ could have been NULLed if the request was cancelled while the
76 // user was choosing a cert, or because we have already responded to the 78 // user was choosing a cert, or because we have already responded to the
77 // certificate. 79 // certificate.
78 if (request_) { 80 if (request_) {
79 request_->ContinueWithCertificate(cert); 81 request_->ContinueWithCertificate(cert);
80 82
81 ResourceRequestInfoImpl* info = 83 ResourceDispatcherHostImpl::Get()->
82 ResourceRequestInfoImpl::ForRequest(request_); 84 ClearSSLClientAuthHandlerForRequest(request_);
83 if (info)
84 info->set_ssl_client_auth_handler(NULL);
85
86 request_ = NULL; 85 request_ = NULL;
87 } 86 }
88 } 87 }
89 88
90 void SSLClientAuthHandler::DoSelectCertificate( 89 void SSLClientAuthHandler::DoSelectCertificate(
91 int render_process_host_id, int render_view_host_id) { 90 int render_process_host_id, int render_view_host_id) {
92 content::GetContentClient()->browser()->SelectClientCertificate( 91 content::GetContentClient()->browser()->SelectClientCertificate(
93 render_process_host_id, render_view_host_id, http_network_session_, 92 render_process_host_id, render_view_host_id, http_network_session_,
94 cert_request_info_, 93 cert_request_info_,
95 base::Bind(&SSLClientAuthHandler::CertificateSelected, this)); 94 base::Bind(&SSLClientAuthHandler::CertificateSelected, this));
96 } 95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698