| 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 completed_bridge_.swap(bridge_); | 609 completed_bridge_.swap(bridge_); |
| 610 | 610 |
| 611 if (client_) { | 611 if (client_) { |
| 612 if (status.status() != net::URLRequestStatus::SUCCESS) { | 612 if (status.status() != net::URLRequestStatus::SUCCESS) { |
| 613 int error_code; | 613 int error_code; |
| 614 if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { | 614 if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { |
| 615 // By marking this request as aborted we insure that we don't navigate | 615 // By marking this request as aborted we insure that we don't navigate |
| 616 // to an error page. | 616 // to an error page. |
| 617 error_code = net::ERR_ABORTED; | 617 error_code = net::ERR_ABORTED; |
| 618 } else { | 618 } else { |
| 619 error_code = status.os_error(); | 619 error_code = status.error(); |
| 620 } | 620 } |
| 621 WebURLError error; | 621 WebURLError error; |
| 622 if (error_code == net::ERR_ABORTED) | 622 if (error_code == net::ERR_ABORTED) |
| 623 error.isCancellation = true; | 623 error.isCancellation = true; |
| 624 error.domain = WebString::fromUTF8(net::kErrorDomain); | 624 error.domain = WebString::fromUTF8(net::kErrorDomain); |
| 625 error.reason = error_code; | 625 error.reason = error_code; |
| 626 error.unreachableURL = request_.url(); | 626 error.unreachableURL = request_.url(); |
| 627 client_->didFail(loader_, error); | 627 client_->didFail(loader_, error); |
| 628 } else { | 628 } else { |
| 629 client_->didFinishLoading(loader_, completion_time.ToDoubleT()); | 629 client_->didFinishLoading(loader_, completion_time.ToDoubleT()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 const GURL& final_url = sync_load_response.url; | 693 const GURL& final_url = sync_load_response.url; |
| 694 | 694 |
| 695 // TODO(tc): For file loads, we may want to include a more descriptive | 695 // TODO(tc): For file loads, we may want to include a more descriptive |
| 696 // status code or status text. | 696 // status code or status text. |
| 697 const net::URLRequestStatus::Status& status = | 697 const net::URLRequestStatus::Status& status = |
| 698 sync_load_response.status.status(); | 698 sync_load_response.status.status(); |
| 699 if (status != net::URLRequestStatus::SUCCESS && | 699 if (status != net::URLRequestStatus::SUCCESS && |
| 700 status != net::URLRequestStatus::HANDLED_EXTERNALLY) { | 700 status != net::URLRequestStatus::HANDLED_EXTERNALLY) { |
| 701 response.setURL(final_url); | 701 response.setURL(final_url); |
| 702 error.domain = WebString::fromUTF8(net::kErrorDomain); | 702 error.domain = WebString::fromUTF8(net::kErrorDomain); |
| 703 error.reason = sync_load_response.status.os_error(); | 703 error.reason = sync_load_response.status.error(); |
| 704 error.unreachableURL = final_url; | 704 error.unreachableURL = final_url; |
| 705 return; | 705 return; |
| 706 } | 706 } |
| 707 | 707 |
| 708 PopulateURLResponse(final_url, sync_load_response, &response); | 708 PopulateURLResponse(final_url, sync_load_response, &response); |
| 709 | 709 |
| 710 data.assign(sync_load_response.data.data(), | 710 data.assign(sync_load_response.data.data(), |
| 711 sync_load_response.data.size()); | 711 sync_load_response.data.size()); |
| 712 } | 712 } |
| 713 | 713 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 725 | 725 |
| 726 void WebURLLoaderImpl::setDefersLoading(bool value) { | 726 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 727 context_->SetDefersLoading(value); | 727 context_->SetDefersLoading(value); |
| 728 } | 728 } |
| 729 | 729 |
| 730 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { | 730 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { |
| 731 context_->UpdateRoutingId(new_routing_id); | 731 context_->UpdateRoutingId(new_routing_id); |
| 732 } | 732 } |
| 733 | 733 |
| 734 } // namespace webkit_glue | 734 } // namespace webkit_glue |
| OLD | NEW |