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

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

Issue 2689373003: Introduce ParallelDownloadJob. (Closed)
Patch Set: nits. Created 3 years, 10 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
« no previous file with comments | « content/browser/download/download_job_impl.h ('k') | content/browser/download/download_job_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_job_impl.cc
diff --git a/content/browser/download/download_job_impl.cc b/content/browser/download/download_job_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c5239e867cc6b590e057bd5a3995a6d62778f6dd
--- /dev/null
+++ b/content/browser/download/download_job_impl.cc
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/download/download_job_impl.h"
+
+#include "content/public/browser/web_contents.h"
+
+namespace content {
+
+DownloadJobImpl::DownloadJobImpl(
+ DownloadItemImpl* download_item,
+ std::unique_ptr<DownloadRequestHandleInterface> request_handle)
+ : DownloadJob(download_item), request_handle_(std::move(request_handle)) {}
+
+DownloadJobImpl::~DownloadJobImpl() = default;
+
+void DownloadJobImpl::Start() {
+ DownloadJob::StartDownload();
+}
+
+void DownloadJobImpl::Cancel(bool user_cancel) {
+ if (request_handle_)
+ request_handle_->CancelRequest();
+}
+
+void DownloadJobImpl::Pause() {
+ DownloadJob::Pause();
+ if (request_handle_)
+ request_handle_->PauseRequest();
+}
+
+void DownloadJobImpl::Resume(bool resume_request) {
+ DownloadJob::Resume(resume_request);
+ if (!resume_request)
+ return;
+
+ if (request_handle_)
+ request_handle_->ResumeRequest();
+}
+
+WebContents* DownloadJobImpl::GetWebContents() const {
+ return request_handle_ ? request_handle_->GetWebContents() : nullptr;
+}
+
+} // namespace content
« no previous file with comments | « content/browser/download/download_job_impl.h ('k') | content/browser/download/download_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698