| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 | 603 |
| 604 void WebURLLoaderImpl::Context::OnReceivedCachedMetadata( | 604 void WebURLLoaderImpl::Context::OnReceivedCachedMetadata( |
| 605 const char* data, int len) { | 605 const char* data, int len) { |
| 606 if (client_) | 606 if (client_) |
| 607 client_->didReceiveCachedMetadata(loader_, data, len); | 607 client_->didReceiveCachedMetadata(loader_, data, len); |
| 608 } | 608 } |
| 609 | 609 |
| 610 void WebURLLoaderImpl::Context::OnCompletedRequest( | 610 void WebURLLoaderImpl::Context::OnCompletedRequest( |
| 611 const net::URLRequestStatus& original_status, | 611 const net::URLRequestStatus& status, |
| 612 const std::string& security_info, | 612 const std::string& security_info, |
| 613 const base::Time& completion_time) { | 613 const base::Time& completion_time) { |
| 614 if (ftp_listing_delegate_.get()) { | 614 if (ftp_listing_delegate_.get()) { |
| 615 ftp_listing_delegate_->OnCompletedRequest(); | 615 ftp_listing_delegate_->OnCompletedRequest(); |
| 616 ftp_listing_delegate_.reset(NULL); | 616 ftp_listing_delegate_.reset(NULL); |
| 617 } else if (multipart_delegate_.get()) { | 617 } else if (multipart_delegate_.get()) { |
| 618 multipart_delegate_->OnCompletedRequest(); | 618 multipart_delegate_->OnCompletedRequest(); |
| 619 multipart_delegate_.reset(NULL); | 619 multipart_delegate_.reset(NULL); |
| 620 } | 620 } |
| 621 | 621 |
| 622 net::URLRequestStatus status = original_status; | |
| 623 | |
| 624 // Rewrite the Content-Length mismatch as a success. | |
| 625 // See crbug.com/52847 for justification. | |
| 626 if (status.status() != net::URLRequestStatus::SUCCESS && | |
| 627 status.error() == net::ERR_CONTENT_LENGTH_MISMATCH) { | |
| 628 status.set_status(net::URLRequestStatus::SUCCESS); | |
| 629 status.set_error(net::OK); | |
| 630 } | |
| 631 | |
| 632 // Prevent any further IPC to the browser now that we're complete, but | 622 // Prevent any further IPC to the browser now that we're complete, but |
| 633 // don't delete it to keep any downloaded temp files alive. | 623 // don't delete it to keep any downloaded temp files alive. |
| 634 DCHECK(!completed_bridge_.get()); | 624 DCHECK(!completed_bridge_.get()); |
| 635 completed_bridge_.swap(bridge_); | 625 completed_bridge_.swap(bridge_); |
| 636 | 626 |
| 637 if (client_) { | 627 if (client_) { |
| 638 if (status.status() != net::URLRequestStatus::SUCCESS) { | 628 if (status.status() != net::URLRequestStatus::SUCCESS) { |
| 639 int error_code; | 629 int error_code; |
| 640 if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { | 630 if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { |
| 641 // By marking this request as aborted we insure that we don't navigate | 631 // By marking this request as aborted we insure that we don't navigate |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 | 742 |
| 753 void WebURLLoaderImpl::setDefersLoading(bool value) { | 743 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 754 context_->SetDefersLoading(value); | 744 context_->SetDefersLoading(value); |
| 755 } | 745 } |
| 756 | 746 |
| 757 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { | 747 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { |
| 758 context_->UpdateRoutingId(new_routing_id); | 748 context_->UpdateRoutingId(new_routing_id); |
| 759 } | 749 } |
| 760 | 750 |
| 761 } // namespace webkit_glue | 751 } // namespace webkit_glue |
| OLD | NEW |