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

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

Issue 755933002: Revert of "Remove SSLClientAuthHandler's RDH dependency." (https://codereview.chromium.org/59687300… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one other VLOG -> DVLOG conversion Created 6 years 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/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 waiting_for_upload_progress_ack_(false), 90 waiting_for_upload_progress_ack_(false),
91 is_transferring_(false), 91 is_transferring_(false),
92 weak_ptr_factory_(this) { 92 weak_ptr_factory_(this) {
93 request_->set_delegate(this); 93 request_->set_delegate(this);
94 handler_->SetController(this); 94 handler_->SetController(this);
95 } 95 }
96 96
97 ResourceLoader::~ResourceLoader() { 97 ResourceLoader::~ResourceLoader() {
98 if (login_delegate_.get()) 98 if (login_delegate_.get())
99 login_delegate_->OnRequestCancelled(); 99 login_delegate_->OnRequestCancelled();
100 ssl_client_auth_handler_.reset(); 100 if (ssl_client_auth_handler_.get())
101 ssl_client_auth_handler_->OnRequestCancelled();
101 102
102 // Run ResourceHandler destructor before we tear-down the rest of our state 103 // Run ResourceHandler destructor before we tear-down the rest of our state
103 // as the ResourceHandler may want to inspect the URLRequest and other state. 104 // as the ResourceHandler may want to inspect the URLRequest and other state.
104 handler_.reset(); 105 handler_.reset();
105 } 106 }
106 107
107 void ResourceLoader::StartRequest() { 108 void ResourceLoader::StartRequest() {
108 if (delegate_->HandleExternalProtocol(this, request_->url())) { 109 if (delegate_->HandleExternalProtocol(this, request_->url())) {
109 CancelAndIgnore(); 110 CancelAndIgnore();
110 return; 111 return;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 204 }
204 205
205 ResourceRequestInfoImpl* ResourceLoader::GetRequestInfo() { 206 ResourceRequestInfoImpl* ResourceLoader::GetRequestInfo() {
206 return ResourceRequestInfoImpl::ForRequest(request_.get()); 207 return ResourceRequestInfoImpl::ForRequest(request_.get());
207 } 208 }
208 209
209 void ResourceLoader::ClearLoginDelegate() { 210 void ResourceLoader::ClearLoginDelegate() {
210 login_delegate_ = NULL; 211 login_delegate_ = NULL;
211 } 212 }
212 213
214 void ResourceLoader::ClearSSLClientAuthHandler() {
215 ssl_client_auth_handler_ = NULL;
216 }
217
213 void ResourceLoader::OnUploadProgressACK() { 218 void ResourceLoader::OnUploadProgressACK() {
214 waiting_for_upload_progress_ack_ = false; 219 waiting_for_upload_progress_ack_ = false;
215 } 220 }
216 221
217 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused, 222 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused,
218 const net::RedirectInfo& redirect_info, 223 const net::RedirectInfo& redirect_info,
219 bool* defer) { 224 bool* defer) {
220 DCHECK_EQ(request_.get(), unused); 225 DCHECK_EQ(request_.get(), unused);
221 226
222 VLOG(1) << "OnReceivedRedirect: " << request_->url().spec(); 227 VLOG(1) << "OnReceivedRedirect: " << request_->url().spec();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 void ResourceLoader::OnCertificateRequested( 285 void ResourceLoader::OnCertificateRequested(
281 net::URLRequest* unused, 286 net::URLRequest* unused,
282 net::SSLCertRequestInfo* cert_info) { 287 net::SSLCertRequestInfo* cert_info) {
283 DCHECK_EQ(request_.get(), unused); 288 DCHECK_EQ(request_.get(), unused);
284 289
285 if (request_->load_flags() & net::LOAD_PREFETCH) { 290 if (request_->load_flags() & net::LOAD_PREFETCH) {
286 request_->Cancel(); 291 request_->Cancel();
287 return; 292 return;
288 } 293 }
289 294
290 DCHECK(!ssl_client_auth_handler_) 295 DCHECK(!ssl_client_auth_handler_.get())
291 << "OnCertificateRequested called with ssl_client_auth_handler pending"; 296 << "OnCertificateRequested called with ssl_client_auth_handler pending";
292 ssl_client_auth_handler_.reset(new SSLClientAuthHandler( 297 ssl_client_auth_handler_ = new SSLClientAuthHandler(
293 GetRequestInfo()->GetContext()->CreateClientCertStore(), 298 GetRequestInfo()->GetContext()->CreateClientCertStore(),
294 request_.get(), 299 request_.get(),
295 cert_info, 300 cert_info);
296 base::Bind(&ResourceLoader::ContinueWithCertificate,
297 weak_ptr_factory_.GetWeakPtr())));
298 ssl_client_auth_handler_->SelectCertificate(); 301 ssl_client_auth_handler_->SelectCertificate();
299 } 302 }
300 303
301 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request, 304 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request,
302 const net::SSLInfo& ssl_info, 305 const net::SSLInfo& ssl_info,
303 bool fatal) { 306 bool fatal) {
304 ResourceRequestInfoImpl* info = GetRequestInfo(); 307 ResourceRequestInfoImpl* info = GetRequestInfo();
305 308
306 int render_process_id; 309 int render_process_id;
307 int render_frame_id; 310 int render_frame_id;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } 522 }
520 523
521 // TODO(darin): Perhaps we should really be looking to see if the status is 524 // TODO(darin): Perhaps we should really be looking to see if the status is
522 // IO_PENDING? 525 // IO_PENDING?
523 bool was_pending = request_->is_pending(); 526 bool was_pending = request_->is_pending();
524 527
525 if (login_delegate_.get()) { 528 if (login_delegate_.get()) {
526 login_delegate_->OnRequestCancelled(); 529 login_delegate_->OnRequestCancelled();
527 login_delegate_ = NULL; 530 login_delegate_ = NULL;
528 } 531 }
529 ssl_client_auth_handler_.reset(); 532 if (ssl_client_auth_handler_.get()) {
533 ssl_client_auth_handler_->OnRequestCancelled();
534 ssl_client_auth_handler_ = NULL;
535 }
530 536
531 request_->CancelWithError(error); 537 request_->CancelWithError(error);
532 538
533 if (!was_pending) { 539 if (!was_pending) {
534 // If the request isn't in flight, then we won't get an asynchronous 540 // If the request isn't in flight, then we won't get an asynchronous
535 // notification from the request, so we have to signal ourselves to finish 541 // notification from the request, so we have to signal ourselves to finish
536 // this request. 542 // this request.
537 base::MessageLoop::current()->PostTask( 543 base::MessageLoop::current()->PostTask(
538 FROM_HERE, 544 FROM_HERE,
539 base::Bind(&ResourceLoader::ResponseCompleted, 545 base::Bind(&ResourceLoader::ResponseCompleted,
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 case net::URLRequestStatus::IO_PENDING: 763 case net::URLRequestStatus::IO_PENDING:
758 case net::URLRequestStatus::FAILED: 764 case net::URLRequestStatus::FAILED:
759 status = STATUS_UNDEFINED; 765 status = STATUS_UNDEFINED;
760 break; 766 break;
761 } 767 }
762 768
763 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 769 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
764 } 770 }
765 } 771 }
766 772
767 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) {
768 ssl_client_auth_handler_.reset();
769 request_->ContinueWithCertificate(cert);
770 }
771
772 } // namespace content 773 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_loader.h ('k') | content/browser/loader/resource_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698