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

Unified Diff: content/browser/download/download_request_core.h

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_request_core.h
diff --git a/content/browser/download/download_request_core.h b/content/browser/download/download_request_core.h
index 22ca862ef85fae62508046d270652178b625d67d..d51e201dc4d0b8cd62307424a7ddf992fc3ae38c 100644
--- a/content/browser/download/download_request_core.h
+++ b/content/browser/download/download_request_core.h
@@ -20,7 +20,9 @@
#include "content/public/browser/download_url_parameters.h"
namespace net {
+class HttpResponseHeaders;
class URLRequest;
+class URLRequestStatus;
} // namespace net
namespace content {
@@ -59,8 +61,18 @@ class CONTENT_EXPORT DownloadRequestCore
//
// Only populates the response derived fields of DownloadCreateInfo, with the
// exception of |save_info|.
- void OnResponseStarted(scoped_ptr<DownloadCreateInfo>* info,
- scoped_ptr<ByteStreamReader>* stream_reader);
+ //
+ // If the return value is not DOWNLOAD_INTERRUPT_REASON_NONE, then |info| and
+ // |stream_reader| will remain unchanged. In this case, the request isn't
+ // expected to continue.
+ DownloadInterruptReason OnResponseStarted(
+ scoped_ptr<DownloadCreateInfo>* info,
+ scoped_ptr<ByteStreamReader>* stream_reader) WARN_UNUSED_RESULT;
+
+ // Should be called to handle a redirect. The caller should only allow the
+ // redirect to be followed if the returned interrupt reason is NONE.
+ DownloadInterruptReason OnRequestRedirected(
+ const net::RedirectInfo& redirect_info);
// Starts a read cycle. Creates a new IOBuffer which can be passed into
// URLRequest::Read(). Call OnReadCompleted() when the Read operation
@@ -102,6 +114,13 @@ class CONTENT_EXPORT DownloadRequestCore
net::URLRequest* request() const { return request_; }
private:
+ static DownloadInterruptReason HandleRequestStatus(
+ const net::URLRequestStatus& status);
+
+ static DownloadInterruptReason HandleSuccessfulServerResponse(
+ const net::HttpResponseHeaders& http_headers,
+ DownloadSaveInfo* save_info);
+
base::Closure on_ready_to_read_callback_;
net::URLRequest* request_;
scoped_ptr<DownloadSaveInfo> save_info_;
@@ -125,6 +144,7 @@ class CONTENT_EXPORT DownloadRequestCore
int pause_count_;
bool was_deferred_;
+ bool is_resumption_request_;
// Each successful OnWillRead will yield a buffer of this size.
static const int kReadBufSize = 32768; // bytes

Powered by Google App Engine
This is Rietveld 408576698