| 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 // This file contains an implementation of the ResourceLoaderBridge class. | 5 // This file contains an implementation of the ResourceLoaderBridge class. |
| 6 // The class is implemented using net::URLRequest, meaning it is a "simple" | 6 // The class is implemented using net::URLRequest, meaning it is a "simple" |
| 7 // version that directly issues requests. The more complicated one used in the | 7 // version that directly issues requests. The more complicated one used in the |
| 8 // browser uses IPC. | 8 // browser uses IPC. |
| 9 // | 9 // |
| 10 // Because net::URLRequest only provides an asynchronous resource loading API, | 10 // Because net::URLRequest only provides an asynchronous resource loading API, |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 MaybeUpdateUploadProgress(); | 637 MaybeUpdateUploadProgress(); |
| 638 upload_progress_timer_.Stop(); | 638 upload_progress_timer_.Stop(); |
| 639 } | 639 } |
| 640 DCHECK(request_.get()); | 640 DCHECK(request_.get()); |
| 641 // If |failed_file_request_status_| is not empty, which means the request | 641 // If |failed_file_request_status_| is not empty, which means the request |
| 642 // was a file request and encountered an error, then we need to use the | 642 // was a file request and encountered an error, then we need to use the |
| 643 // |failed_file_request_status_|. Otherwise use request_'s status. | 643 // |failed_file_request_status_|. Otherwise use request_'s status. |
| 644 OnCompletedRequest(failed_file_request_status_.get() ? | 644 OnCompletedRequest(failed_file_request_status_.get() ? |
| 645 failed_file_request_status_->error() : | 645 failed_file_request_status_->error() : |
| 646 request_->status().error(), | 646 request_->status().error(), |
| 647 std::string(), base::TimeTicks()); | 647 std::string(), base::TimeTicks::Now()); |
| 648 request_.reset(); // destroy on the io thread | 648 request_.reset(); // destroy on the io thread |
| 649 } | 649 } |
| 650 | 650 |
| 651 // Called on the IO thread. | 651 // Called on the IO thread. |
| 652 void MaybeUpdateUploadProgress() { | 652 void MaybeUpdateUploadProgress() { |
| 653 // If a redirect is received upload is cancelled in net::URLRequest, we | 653 // If a redirect is received upload is cancelled in net::URLRequest, we |
| 654 // should try to stop the |upload_progress_timer_| timer and return. | 654 // should try to stop the |upload_progress_timer_| timer and return. |
| 655 if (!request_->has_upload()) { | 655 if (!request_->has_upload()) { |
| 656 if (upload_progress_timer_.IsRunning()) | 656 if (upload_progress_timer_.IsRunning()) |
| 657 upload_progress_timer_.Stop(); | 657 upload_progress_timer_.Stop(); |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 if (!g_file_over_http_mappings) | 1157 if (!g_file_over_http_mappings) |
| 1158 g_file_over_http_mappings = new FileOverHTTPPathMappings(); | 1158 g_file_over_http_mappings = new FileOverHTTPPathMappings(); |
| 1159 g_file_over_http_mappings->AddMapping(file_path_template, http_prefix); | 1159 g_file_over_http_mappings->AddMapping(file_path_template, http_prefix); |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 // static | 1162 // static |
| 1163 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( | 1163 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
| 1164 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 1164 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
| 1165 return new ResourceLoaderBridgeImpl(request_info); | 1165 return new ResourceLoaderBridgeImpl(request_info); |
| 1166 } | 1166 } |
| OLD | NEW |