OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. | 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. |
6 | 6 |
7 #include "webkit/glue/weburlloader_impl.h" | 7 #include "webkit/glue/weburlloader_impl.h" |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 void WebURLLoaderImpl::Context::OnReceivedCachedMetadata( | 588 void WebURLLoaderImpl::Context::OnReceivedCachedMetadata( |
589 const char* data, int len) { | 589 const char* data, int len) { |
590 if (client_) | 590 if (client_) |
591 client_->didReceiveCachedMetadata(loader_, data, len); | 591 client_->didReceiveCachedMetadata(loader_, data, len); |
592 } | 592 } |
593 | 593 |
594 void WebURLLoaderImpl::Context::OnCompletedRequest( | 594 void WebURLLoaderImpl::Context::OnCompletedRequest( |
595 const net::URLRequestStatus& status, | 595 const net::URLRequestStatus& original_status, |
596 const std::string& security_info, | 596 const std::string& security_info, |
597 const base::Time& completion_time) { | 597 const base::Time& completion_time) { |
598 if (ftp_listing_delegate_.get()) { | 598 if (ftp_listing_delegate_.get()) { |
599 ftp_listing_delegate_->OnCompletedRequest(); | 599 ftp_listing_delegate_->OnCompletedRequest(); |
600 ftp_listing_delegate_.reset(NULL); | 600 ftp_listing_delegate_.reset(NULL); |
601 } else if (multipart_delegate_.get()) { | 601 } else if (multipart_delegate_.get()) { |
602 multipart_delegate_->OnCompletedRequest(); | 602 multipart_delegate_->OnCompletedRequest(); |
603 multipart_delegate_.reset(NULL); | 603 multipart_delegate_.reset(NULL); |
604 } | 604 } |
605 | 605 |
606 net::URLRequestStatus status = original_status; | |
607 | |
608 // Rewrite the Content-Length mismatch as a success. | |
609 // See crbug.com/52847 for justification. | |
610 if (status.status() != net::URLRequestStatus::SUCCESS && | |
611 status.error() == net::ERR_CONTENT_LENGTH_MISMATCH) | |
612 status.set_status(net::URLRequestStatus::SUCCESS); | |
darin (slow to review)
2011/11/16 21:59:57
should you also clear the error field here for com
cbentzel
2011/11/16 22:19:28
Done. The code below doesn't investigate error if
| |
613 | |
606 // Prevent any further IPC to the browser now that we're complete, but | 614 // Prevent any further IPC to the browser now that we're complete, but |
607 // don't delete it to keep any downloaded temp files alive. | 615 // don't delete it to keep any downloaded temp files alive. |
608 DCHECK(!completed_bridge_.get()); | 616 DCHECK(!completed_bridge_.get()); |
609 completed_bridge_.swap(bridge_); | 617 completed_bridge_.swap(bridge_); |
610 | 618 |
611 if (client_) { | 619 if (client_) { |
612 if (status.status() != net::URLRequestStatus::SUCCESS) { | 620 if (status.status() != net::URLRequestStatus::SUCCESS) { |
613 int error_code; | 621 int error_code; |
614 if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { | 622 if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { |
615 // By marking this request as aborted we insure that we don't navigate | 623 // By marking this request as aborted we insure that we don't navigate |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
725 | 733 |
726 void WebURLLoaderImpl::setDefersLoading(bool value) { | 734 void WebURLLoaderImpl::setDefersLoading(bool value) { |
727 context_->SetDefersLoading(value); | 735 context_->SetDefersLoading(value); |
728 } | 736 } |
729 | 737 |
730 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { | 738 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { |
731 context_->UpdateRoutingId(new_routing_id); | 739 context_->UpdateRoutingId(new_routing_id); |
732 } | 740 } |
733 | 741 |
734 } // namespace webkit_glue | 742 } // namespace webkit_glue |
OLD | NEW |