summaryrefslogtreecommitdiffstats
path: root/content/browser/download/download_file_impl.cc
diff options
context:
space:
mode:
authorahendrickson@chromium.org <ahendrickson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 19:22:41 +0000
committerahendrickson@chromium.org <ahendrickson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 19:22:41 +0000
commit443853c674eeabd922bfcda2caf0411f47c9a93c (patch)
tree425513cd9998b67aa183aa6f7c9a700761de533f /content/browser/download/download_file_impl.cc
parentb6dbdce9b4c536b4d0208ab2a0bf39bd219824bf (diff)
downloadchromium_src-443853c674eeabd922bfcda2caf0411f47c9a93c.zip
chromium_src-443853c674eeabd922bfcda2caf0411f47c9a93c.tar.gz
chromium_src-443853c674eeabd922bfcda2caf0411f47c9a93c.tar.bz2
In order to resume a download some more information needs to be gathered.
This CL adds member data to classes to support this. It is the first of several CLs to implement download resumption. In addition hash information is propagated from DownloadFile to DownloadItem, because a new DownloadFile will be created when the download is resumed. It will also need to be persisted in order to resume across chrome runs. The plan is that data will be collected in DownloadResourceHandler::OnResponseStarted() and passed down to DownloadItem. On resume, it will pass the information from the resuming DownloadItem to ResourceDispatcherHost::BeginDownload(), which will set any required headers. BUG= 7648 TEST=None Review URL: http://codereview.chromium.org/8404049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/download/download_file_impl.cc')
-rw-r--r--content/browser/download/download_file_impl.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc
index f065746..4cff9e8 100644
--- a/content/browser/download/download_file_impl.cc
+++ b/content/browser/download/download_file_impl.cc
@@ -86,11 +86,14 @@ int DownloadFile::GetUniquePathNumberWithSuffix(
DownloadFileImpl::DownloadFileImpl(
const DownloadCreateInfo* info,
DownloadRequestHandleInterface* request_handle,
- content::DownloadManager* download_manager)
+ content::DownloadManager* download_manager,
+ bool calculate_hash)
: file_(info->save_info.file_path,
info->url(),
info->referrer_url,
info->received_bytes,
+ calculate_hash,
+ info->save_info.hash_state,
info->save_info.file_stream),
id_(info->download_id),
request_handle_(request_handle),
@@ -103,8 +106,8 @@ DownloadFileImpl::~DownloadFileImpl() {
}
// BaseFile delegated functions.
-net::Error DownloadFileImpl::Initialize(bool calculate_hash) {
- return file_.Initialize(calculate_hash);
+net::Error DownloadFileImpl::Initialize() {
+ return file_.Initialize();
}
net::Error DownloadFileImpl::AppendDataToFile(const char* data,
@@ -148,8 +151,12 @@ int64 DownloadFileImpl::CurrentSpeed() const {
return file_.CurrentSpeed();
}
-bool DownloadFileImpl::GetSha256Hash(std::string* hash) {
- return file_.GetSha256Hash(hash);
+bool DownloadFileImpl::GetHash(std::string* hash) {
+ return file_.GetHash(hash);
+}
+
+std::string DownloadFileImpl::GetHashState() {
+ return file_.GetHashState();
}
// DownloadFileInterface implementation.