| 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 #include "content/browser/download/download_request_core.h" | 5 #include "content/browser/download/download_request_core.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 344 } |
| 345 | 345 |
| 346 // Grab the first content-disposition header. There may be more than one, | 346 // Grab the first content-disposition header. There may be more than one, |
| 347 // though as of this writing, the network stack ensures if there are, they | 347 // though as of this writing, the network stack ensures if there are, they |
| 348 // are all duplicates. | 348 // are all duplicates. |
| 349 headers->EnumerateHeader(nullptr, "Content-Disposition", | 349 headers->EnumerateHeader(nullptr, "Content-Disposition", |
| 350 &create_info->content_disposition); | 350 &create_info->content_disposition); |
| 351 | 351 |
| 352 if (!headers->GetMimeType(&create_info->original_mime_type)) | 352 if (!headers->GetMimeType(&create_info->original_mime_type)) |
| 353 create_info->original_mime_type.clear(); | 353 create_info->original_mime_type.clear(); |
| 354 |
| 355 create_info->accept_range = |
| 356 headers->HasHeaderValue("Accept-Ranges", "bytes"); |
| 354 } | 357 } |
| 355 | 358 |
| 356 // Blink verifies that the requester of this download is allowed to set a | 359 // Blink verifies that the requester of this download is allowed to set a |
| 357 // suggested name for the security origin of the download URL. However, this | 360 // suggested name for the security origin of the download URL. However, this |
| 358 // assumption doesn't hold if there were cross origin redirects. Therefore, | 361 // assumption doesn't hold if there were cross origin redirects. Therefore, |
| 359 // clear the suggested_name for such requests. | 362 // clear the suggested_name for such requests. |
| 360 if (create_info->url_chain.size() > 1 && | 363 if (create_info->url_chain.size() > 1 && |
| 361 create_info->url_chain.front().GetOrigin() != | 364 create_info->url_chain.front().GetOrigin() != |
| 362 create_info->url_chain.back().GetOrigin()) | 365 create_info->url_chain.back().GetOrigin()) |
| 363 create_info->save_info->suggested_name.clear(); | 366 create_info->save_info->suggested_name.clear(); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 return DOWNLOAD_INTERRUPT_REASON_NONE; | 660 return DOWNLOAD_INTERRUPT_REASON_NONE; |
| 658 } | 661 } |
| 659 | 662 |
| 660 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) | 663 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) |
| 661 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; | 664 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; |
| 662 | 665 |
| 663 return DOWNLOAD_INTERRUPT_REASON_NONE; | 666 return DOWNLOAD_INTERRUPT_REASON_NONE; |
| 664 } | 667 } |
| 665 | 668 |
| 666 } // namespace content | 669 } // namespace content |
| OLD | NEW |