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

Side by Side Diff: content/browser/loader/resource_loader.cc

Issue 596873002: Remove SSLClientAuthHandler's RDH dependency. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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/loader/resource_loader.h" 5 #include "content/browser/loader/resource_loader.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 waiting_for_upload_progress_ack_(false), 86 waiting_for_upload_progress_ack_(false),
87 is_transferring_(false), 87 is_transferring_(false),
88 weak_ptr_factory_(this) { 88 weak_ptr_factory_(this) {
89 request_->set_delegate(this); 89 request_->set_delegate(this);
90 handler_->SetController(this); 90 handler_->SetController(this);
91 } 91 }
92 92
93 ResourceLoader::~ResourceLoader() { 93 ResourceLoader::~ResourceLoader() {
94 if (login_delegate_.get()) 94 if (login_delegate_.get())
95 login_delegate_->OnRequestCancelled(); 95 login_delegate_->OnRequestCancelled();
96 if (ssl_client_auth_handler_.get()) 96 ssl_client_auth_handler_.reset();
97 ssl_client_auth_handler_->OnRequestCancelled();
98 97
99 // Run ResourceHandler destructor before we tear-down the rest of our state 98 // Run ResourceHandler destructor before we tear-down the rest of our state
100 // as the ResourceHandler may want to inspect the URLRequest and other state. 99 // as the ResourceHandler may want to inspect the URLRequest and other state.
101 handler_.reset(); 100 handler_.reset();
102 } 101 }
103 102
104 void ResourceLoader::StartRequest() { 103 void ResourceLoader::StartRequest() {
105 if (delegate_->HandleExternalProtocol(this, request_->url())) { 104 if (delegate_->HandleExternalProtocol(this, request_->url())) {
106 CancelAndIgnore(); 105 CancelAndIgnore();
107 return; 106 return;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 185 }
187 186
188 ResourceRequestInfoImpl* ResourceLoader::GetRequestInfo() { 187 ResourceRequestInfoImpl* ResourceLoader::GetRequestInfo() {
189 return ResourceRequestInfoImpl::ForRequest(request_.get()); 188 return ResourceRequestInfoImpl::ForRequest(request_.get());
190 } 189 }
191 190
192 void ResourceLoader::ClearLoginDelegate() { 191 void ResourceLoader::ClearLoginDelegate() {
193 login_delegate_ = NULL; 192 login_delegate_ = NULL;
194 } 193 }
195 194
196 void ResourceLoader::ClearSSLClientAuthHandler() {
197 ssl_client_auth_handler_ = NULL;
198 }
199
200 void ResourceLoader::OnUploadProgressACK() { 195 void ResourceLoader::OnUploadProgressACK() {
201 waiting_for_upload_progress_ack_ = false; 196 waiting_for_upload_progress_ack_ = false;
202 } 197 }
203 198
204 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused, 199 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused,
205 const net::RedirectInfo& redirect_info, 200 const net::RedirectInfo& redirect_info,
206 bool* defer) { 201 bool* defer) {
207 DCHECK_EQ(request_.get(), unused); 202 DCHECK_EQ(request_.get(), unused);
208 203
209 VLOG(1) << "OnReceivedRedirect: " << request_->url().spec(); 204 VLOG(1) << "OnReceivedRedirect: " << request_->url().spec();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 void ResourceLoader::OnCertificateRequested( 257 void ResourceLoader::OnCertificateRequested(
263 net::URLRequest* unused, 258 net::URLRequest* unused,
264 net::SSLCertRequestInfo* cert_info) { 259 net::SSLCertRequestInfo* cert_info) {
265 DCHECK_EQ(request_.get(), unused); 260 DCHECK_EQ(request_.get(), unused);
266 261
267 if (request_->load_flags() & net::LOAD_PREFETCH) { 262 if (request_->load_flags() & net::LOAD_PREFETCH) {
268 request_->Cancel(); 263 request_->Cancel();
269 return; 264 return;
270 } 265 }
271 266
272 DCHECK(!ssl_client_auth_handler_.get()) 267 DCHECK(!ssl_client_auth_handler_)
273 << "OnCertificateRequested called with ssl_client_auth_handler pending"; 268 << "OnCertificateRequested called with ssl_client_auth_handler pending";
274 ssl_client_auth_handler_ = new SSLClientAuthHandler( 269 ssl_client_auth_handler_.reset(new SSLClientAuthHandler(
275 GetRequestInfo()->GetContext()->CreateClientCertStore(), 270 GetRequestInfo()->GetContext()->CreateClientCertStore(),
276 request_.get(), 271 request_.get(),
277 cert_info); 272 cert_info,
273 base::Bind(&ResourceLoader::ContinueWithCertificate,
274 weak_ptr_factory_.GetWeakPtr())));
278 ssl_client_auth_handler_->SelectCertificate(); 275 ssl_client_auth_handler_->SelectCertificate();
279 } 276 }
280 277
281 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request, 278 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request,
282 const net::SSLInfo& ssl_info, 279 const net::SSLInfo& ssl_info,
283 bool fatal) { 280 bool fatal) {
284 ResourceRequestInfoImpl* info = GetRequestInfo(); 281 ResourceRequestInfoImpl* info = GetRequestInfo();
285 282
286 int render_process_id; 283 int render_process_id;
287 int render_frame_id; 284 int render_frame_id;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 } 483 }
487 484
488 // TODO(darin): Perhaps we should really be looking to see if the status is 485 // TODO(darin): Perhaps we should really be looking to see if the status is
489 // IO_PENDING? 486 // IO_PENDING?
490 bool was_pending = request_->is_pending(); 487 bool was_pending = request_->is_pending();
491 488
492 if (login_delegate_.get()) { 489 if (login_delegate_.get()) {
493 login_delegate_->OnRequestCancelled(); 490 login_delegate_->OnRequestCancelled();
494 login_delegate_ = NULL; 491 login_delegate_ = NULL;
495 } 492 }
496 if (ssl_client_auth_handler_.get()) { 493 ssl_client_auth_handler_.reset();
mmenke 2014/09/24 18:03:41 Does this get us anything? Suppose this CL makes
davidben 2014/09/26 18:49:49 Not sure. Yeah, I figured I'd leave it as-is for n
497 ssl_client_auth_handler_->OnRequestCancelled();
498 ssl_client_auth_handler_ = NULL;
499 }
500 494
501 request_->CancelWithError(error); 495 request_->CancelWithError(error);
502 496
503 if (!was_pending) { 497 if (!was_pending) {
504 // If the request isn't in flight, then we won't get an asynchronous 498 // If the request isn't in flight, then we won't get an asynchronous
505 // notification from the request, so we have to signal ourselves to finish 499 // notification from the request, so we have to signal ourselves to finish
506 // this request. 500 // this request.
507 base::MessageLoop::current()->PostTask( 501 base::MessageLoop::current()->PostTask(
508 FROM_HERE, 502 FROM_HERE,
509 base::Bind(&ResourceLoader::ResponseCompleted, 503 base::Bind(&ResourceLoader::ResponseCompleted,
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 case net::URLRequestStatus::IO_PENDING: 699 case net::URLRequestStatus::IO_PENDING:
706 case net::URLRequestStatus::FAILED: 700 case net::URLRequestStatus::FAILED:
707 status = STATUS_UNDEFINED; 701 status = STATUS_UNDEFINED;
708 break; 702 break;
709 } 703 }
710 704
711 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 705 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
712 } 706 }
713 } 707 }
714 708
709 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) {
710 ssl_client_auth_handler_.reset();
711 request_->ContinueWithCertificate(cert);
712 }
713
715 } // namespace content 714 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698