| 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/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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 467 |
| 468 void ResourceLoader::CompleteResponseStarted() { | 468 void ResourceLoader::CompleteResponseStarted() { |
| 469 ResourceRequestInfoImpl* info = GetRequestInfo(); | 469 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 470 | 470 |
| 471 scoped_refptr<ResourceResponse> response(new ResourceResponse()); | 471 scoped_refptr<ResourceResponse> response(new ResourceResponse()); |
| 472 PopulateResourceResponse(request_.get(), response.get()); | 472 PopulateResourceResponse(request_.get(), response.get()); |
| 473 | 473 |
| 474 if (request_->ssl_info().cert.get()) { | 474 if (request_->ssl_info().cert.get()) { |
| 475 int cert_id = CertStore::GetInstance()->StoreCert( | 475 int cert_id = CertStore::GetInstance()->StoreCert( |
| 476 request_->ssl_info().cert.get(), info->GetChildID()); | 476 request_->ssl_info().cert.get(), info->GetChildID()); |
| 477 // XXX(rsleevi): Wire up sending the SCT to the child |
| 478 int signed_certificate_timestamp_id = 0; |
| 477 response->head.security_info = SerializeSecurityInfo( | 479 response->head.security_info = SerializeSecurityInfo( |
| 478 cert_id, | 480 cert_id, |
| 479 request_->ssl_info().cert_status, | 481 request_->ssl_info().cert_status, |
| 480 request_->ssl_info().security_bits, | 482 request_->ssl_info().security_bits, |
| 481 request_->ssl_info().connection_status); | 483 request_->ssl_info().connection_status, |
| 484 signed_certificate_timestamp_id); |
| 482 } else { | 485 } else { |
| 483 // We should not have any SSL state. | 486 // We should not have any SSL state. |
| 484 DCHECK(!request_->ssl_info().cert_status && | 487 DCHECK(!request_->ssl_info().cert_status && |
| 485 request_->ssl_info().security_bits == -1 && | 488 request_->ssl_info().security_bits == -1 && |
| 486 !request_->ssl_info().connection_status); | 489 !request_->ssl_info().connection_status); |
| 487 } | 490 } |
| 488 | 491 |
| 489 delegate_->DidReceiveResponse(this); | 492 delegate_->DidReceiveResponse(this); |
| 490 | 493 |
| 491 bool defer = false; | 494 bool defer = false; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 void ResourceLoader::ResponseCompleted() { | 578 void ResourceLoader::ResponseCompleted() { |
| 576 VLOG(1) << "ResponseCompleted: " << request_->url().spec(); | 579 VLOG(1) << "ResponseCompleted: " << request_->url().spec(); |
| 577 RecordHistograms(); | 580 RecordHistograms(); |
| 578 ResourceRequestInfoImpl* info = GetRequestInfo(); | 581 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 579 | 582 |
| 580 std::string security_info; | 583 std::string security_info; |
| 581 const net::SSLInfo& ssl_info = request_->ssl_info(); | 584 const net::SSLInfo& ssl_info = request_->ssl_info(); |
| 582 if (ssl_info.cert.get() != NULL) { | 585 if (ssl_info.cert.get() != NULL) { |
| 583 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert.get(), | 586 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert.get(), |
| 584 info->GetChildID()); | 587 info->GetChildID()); |
| 588 // XXX(rsleevi): Wire up the SCTStore |
| 589 int sct_id = 0; |
| 585 security_info = SerializeSecurityInfo( | 590 security_info = SerializeSecurityInfo( |
| 586 cert_id, ssl_info.cert_status, ssl_info.security_bits, | 591 cert_id, ssl_info.cert_status, ssl_info.security_bits, |
| 587 ssl_info.connection_status); | 592 ssl_info.connection_status, sct_id); |
| 588 } | 593 } |
| 589 | 594 |
| 590 if (handler_->OnResponseCompleted(info->GetRequestID(), request_->status(), | 595 if (handler_->OnResponseCompleted(info->GetRequestID(), request_->status(), |
| 591 security_info)) { | 596 security_info)) { |
| 592 // This will result in our destruction. | 597 // This will result in our destruction. |
| 593 CallDidFinishLoading(); | 598 CallDidFinishLoading(); |
| 594 } else { | 599 } else { |
| 595 // The handler is not ready to die yet. We will call DidFinishLoading when | 600 // The handler is not ready to die yet. We will call DidFinishLoading when |
| 596 // we resume. | 601 // we resume. |
| 597 deferred_stage_ = DEFERRED_FINISH; | 602 deferred_stage_ = DEFERRED_FINISH; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 case net::URLRequestStatus::FAILED: | 634 case net::URLRequestStatus::FAILED: |
| 630 status = STATUS_UNDEFINED; | 635 status = STATUS_UNDEFINED; |
| 631 break; | 636 break; |
| 632 } | 637 } |
| 633 | 638 |
| 634 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); | 639 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); |
| 635 } | 640 } |
| 636 } | 641 } |
| 637 | 642 |
| 638 } // namespace content | 643 } // namespace content |
| OLD | NEW |