Index: content/browser/download/download_resource_handler.h |
diff --git a/content/browser/download/download_resource_handler.h b/content/browser/download/download_resource_handler.h |
index 60fbc944387667cc939a5f5a2e7d74a4052bcccd..209c575529ca5152ba3b35edf1bf98b39744d6a9 100644 |
--- a/content/browser/download/download_resource_handler.h |
+++ b/content/browser/download/download_resource_handler.h |
@@ -9,7 +9,9 @@ |
#include "base/callback.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
#include "base/timer/timer.h" |
+#include "content/browser/download/download_request_model.h" |
#include "content/browser/loader/resource_handler.h" |
#include "content/public/browser/download_manager.h" |
#include "content/public/browser/download_save_info.h" |
@@ -17,7 +19,6 @@ |
#include "content/public/browser/global_request_id.h" |
#include "net/base/net_errors.h" |
- |
namespace net { |
class URLRequest; |
} // namespace net |
@@ -33,17 +34,7 @@ class CONTENT_EXPORT DownloadResourceHandler |
: public ResourceHandler, |
public base::SupportsWeakPtr<DownloadResourceHandler> { |
public: |
- // Size of the buffer used between the DownloadResourceHandler and the |
- // downstream receiver of its output. |
- static const int kDownloadByteStreamSize; |
- |
- // started_cb will be called exactly once on the UI thread. |
- // |id| should be invalid if the id should be automatically assigned. |
- DownloadResourceHandler( |
- uint32 id, |
- net::URLRequest* request, |
- const DownloadUrlParameters::OnStartedCallback& started_cb, |
- scoped_ptr<DownloadSaveInfo> save_info); |
+ explicit DownloadResourceHandler(net::URLRequest* request); |
virtual bool OnUploadProgress(int request_id, |
uint64 position, |
@@ -95,47 +86,15 @@ class CONTENT_EXPORT DownloadResourceHandler |
// on the IO thread. |
void CallStartedCB(DownloadItem* item, net::Error error); |
- // If the content-length header is not present (or contains something other |
- // than numbers), the incoming content_length is -1 (unknown size). |
- // Set the content length to 0 to indicate unknown size to DownloadManager. |
- void SetContentLength(const int64& content_length); |
- |
- void SetContentDisposition(const std::string& content_disposition); |
+ DownloadRequestModel request_model_; |
- uint32 download_id_; |
GlobalRequestID global_id_; |
int render_view_id_; |
- std::string content_disposition_; |
- int64 content_length_; |
- net::URLRequest* request_; |
- // This is read only on the IO thread, but may only |
- // be called on the UI thread. |
- DownloadUrlParameters::OnStartedCallback started_cb_; |
- scoped_ptr<DownloadSaveInfo> save_info_; |
- |
- // Data flow |
- scoped_refptr<net::IOBuffer> read_buffer_; // From URLRequest. |
- scoped_ptr<ByteStreamWriter> stream_writer_; // To rest of system. |
- |
- // The following are used to collect stats. |
- base::TimeTicks download_start_time_; |
- base::TimeTicks last_read_time_; |
- base::TimeTicks last_stream_pause_time_; |
- base::TimeDelta total_pause_time_; |
- size_t last_buffer_size_; |
- int64 bytes_read_; |
- std::string accept_ranges_; |
- std::string etag_; |
- |
- int pause_count_; |
- bool was_deferred_; |
+ bool did_defer_request_; |
// For DCHECKing |
bool on_response_started_called_; |
- static const int kReadBufSize = 32768; // bytes |
- static const int kThrottleTimeMs = 200; // milliseconds |
- |
DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); |
}; |