Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(874)

Unified Diff: content/browser/download/download_resource_handler.cc

Issue 1544603003: [Downloads] Do not store error responses during resumption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unify-downloader-core
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_resource_handler.cc
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc
index e06b3095e993c1939e86f1a2826efab93fb775c8..078602e2e59111f20a5de5853668f93072df5fba 100644
--- a/content/browser/download/download_resource_handler.cc
+++ b/content/browser/download/download_resource_handler.cc
@@ -129,7 +129,16 @@ bool DownloadResourceHandler::OnRequestRedirected(
const net::RedirectInfo& redirect_info,
ResourceResponse* response,
bool* defer) {
- return true;
+ DownloadInterruptReason result = core_.OnRequestRedirected(redirect_info);
+ if (result == DOWNLOAD_INTERRUPT_REASON_NONE)
+ return true;
+
+ // Allow the interrupt reason to propagate up the stack before we receive the
+ // OnResponseCompleted() call. The ResourceLoader will treat this as an ABORT,
+ // hence OnResponseCompleted() may conclude a more generic interrupt reason.
+ // We want the specific interrupt reason to be dispatched instead.
+ CallStartedCB(result);
+ return false;
}
// Send the download creation information to the download thread.
@@ -139,7 +148,12 @@ bool DownloadResourceHandler::OnResponseStarted(
scoped_ptr<DownloadCreateInfo> create_info;
scoped_ptr<ByteStreamReader> stream_reader;
- core_.OnResponseStarted(&create_info, &stream_reader);
+ DownloadInterruptReason result =
+ core_.OnResponseStarted(&create_info, &stream_reader);
+ if (result != DOWNLOAD_INTERRUPT_REASON_NONE) {
+ CallStartedCB(result);
+ return false;
+ }
const ResourceRequestInfoImpl* request_info = GetRequestInfo();
create_info->download_id = download_id_;

Powered by Google App Engine
This is Rietveld 408576698