| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/download/parallel_download_job.h" | 5 #include "content/browser/download/parallel_download_job.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "content/browser/download/download_create_info.h" | 8 #include "content/browser/download/download_create_info.h" |
| 9 #include "content/browser/download/parallel_download_utils.h" | 9 #include "content/browser/download/parallel_download_utils.h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 storage_partition->GetURLRequestContext())); | 202 storage_partition->GetURLRequestContext())); |
| 203 download_params->set_file_path(download_item_->GetFullPath()); | 203 download_params->set_file_path(download_item_->GetFullPath()); |
| 204 download_params->set_last_modified(download_item_->GetLastModifiedTime()); | 204 download_params->set_last_modified(download_item_->GetLastModifiedTime()); |
| 205 download_params->set_etag(download_item_->GetETag()); | 205 download_params->set_etag(download_item_->GetETag()); |
| 206 download_params->set_offset(offset); | 206 download_params->set_offset(offset); |
| 207 | 207 |
| 208 // Setting the length will result in range request to fetch a slice of the | 208 // Setting the length will result in range request to fetch a slice of the |
| 209 // file. | 209 // file. |
| 210 download_params->set_length(length); | 210 download_params->set_length(length); |
| 211 | 211 |
| 212 // Subsequent range requests don't need the "If-Range" header. |
| 213 download_params->set_use_if_range(false); |
| 214 |
| 212 // Subsequent range requests have the same referrer URL as the original | 215 // Subsequent range requests have the same referrer URL as the original |
| 213 // download request. | 216 // download request. |
| 214 download_params->set_referrer(Referrer(download_item_->GetReferrerUrl(), | 217 download_params->set_referrer(Referrer(download_item_->GetReferrerUrl(), |
| 215 blink::WebReferrerPolicyAlways)); | 218 blink::WebReferrerPolicyAlways)); |
| 216 // Send the request. | 219 // Send the request. |
| 217 worker->SendRequest(std::move(download_params)); | 220 worker->SendRequest(std::move(download_params)); |
| 218 DCHECK(workers_.find(offset) == workers_.end()); | 221 DCHECK(workers_.find(offset) == workers_.end()); |
| 219 workers_[offset] = std::move(worker); | 222 workers_[offset] = std::move(worker); |
| 220 } | 223 } |
| 221 | 224 |
| 222 } // namespace content | 225 } // namespace content |
| OLD | NEW |