| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 std::move(element_readers), params->post_id())); | 140 std::move(element_readers), params->post_id())); |
| 141 } | 141 } |
| 142 | 142 |
| 143 int load_flags = request->load_flags(); | 143 int load_flags = request->load_flags(); |
| 144 if (params->prefer_cache()) { | 144 if (params->prefer_cache()) { |
| 145 // If there is upload data attached, only retrieve from cache because there | 145 // If there is upload data attached, only retrieve from cache because there |
| 146 // is no current mechanism to prompt the user for their consent for a | 146 // is no current mechanism to prompt the user for their consent for a |
| 147 // re-post. For GETs, try to retrieve data from the cache and skip | 147 // re-post. For GETs, try to retrieve data from the cache and skip |
| 148 // validating the entry if present. | 148 // validating the entry if present. |
| 149 if (request->get_upload()) | 149 if (request->get_upload()) |
| 150 load_flags |= net::LOAD_ONLY_FROM_CACHE; | 150 load_flags |= net::LOAD_ONLY_FROM_CACHE | net::LOAD_SKIP_CACHE_VALIDATION; |
| 151 else | 151 else |
| 152 load_flags |= net::LOAD_PREFERRING_CACHE; | 152 load_flags |= net::LOAD_SKIP_CACHE_VALIDATION; |
| 153 } else { | 153 } else { |
| 154 load_flags |= net::LOAD_DISABLE_CACHE; | 154 load_flags |= net::LOAD_DISABLE_CACHE; |
| 155 } | 155 } |
| 156 request->SetLoadFlags(load_flags); | 156 request->SetLoadFlags(load_flags); |
| 157 | 157 |
| 158 bool has_last_modified = !params->last_modified().empty(); | 158 bool has_last_modified = !params->last_modified().empty(); |
| 159 bool has_etag = !params->etag().empty(); | 159 bool has_etag = !params->etag().empty(); |
| 160 | 160 |
| 161 // If we've asked for a range, we want to make sure that we only get that | 161 // If we've asked for a range, we want to make sure that we only get that |
| 162 // range if our current copy of the information is good. We shouldn't be | 162 // range if our current copy of the information is good. We shouldn't be |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 return DOWNLOAD_INTERRUPT_REASON_NONE; | 627 return DOWNLOAD_INTERRUPT_REASON_NONE; |
| 628 } | 628 } |
| 629 | 629 |
| 630 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) | 630 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) |
| 631 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; | 631 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; |
| 632 | 632 |
| 633 return DOWNLOAD_INTERRUPT_REASON_NONE; | 633 return DOWNLOAD_INTERRUPT_REASON_NONE; |
| 634 } | 634 } |
| 635 | 635 |
| 636 } // namespace content | 636 } // namespace content |
| OLD | NEW |