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

Side by Side Diff: content/browser/download/download_job_impl.cc

Issue 2767593003: Handle early pause, cancel for parallel requests. (Closed)
Patch Set: Work on feedback. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/download/download_job_impl.h" 5 #include "content/browser/download/download_job_impl.h"
6 6
7 #include "content/public/browser/web_contents.h" 7 #include "content/public/browser/web_contents.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 DownloadJobImpl::DownloadJobImpl( 11 DownloadJobImpl::DownloadJobImpl(
12 DownloadItemImpl* download_item, 12 DownloadItemImpl* download_item,
13 std::unique_ptr<DownloadRequestHandleInterface> request_handle) 13 std::unique_ptr<DownloadRequestHandleInterface> request_handle)
14 : DownloadJob(download_item), request_handle_(std::move(request_handle)) {} 14 : DownloadJob(download_item), request_handle_(std::move(request_handle)) {}
15 15
16 DownloadJobImpl::~DownloadJobImpl() = default; 16 DownloadJobImpl::~DownloadJobImpl() = default;
17 17
18 void DownloadJobImpl::Start() { 18 void DownloadJobImpl::Start() {
19 DownloadJob::StartDownload(); 19 DownloadJob::StartDownload();
20 } 20 }
21 21
22 void DownloadJobImpl::Cancel(bool user_cancel) { 22 void DownloadJobImpl::Cancel(bool user_cancel) {
23 DownloadJob::Cancel(user_cancel);
24
23 if (request_handle_) 25 if (request_handle_)
24 request_handle_->CancelRequest(); 26 request_handle_->CancelRequest();
25 } 27 }
26 28
27 void DownloadJobImpl::Pause() { 29 void DownloadJobImpl::Pause() {
28 DownloadJob::Pause(); 30 DownloadJob::Pause();
29 if (request_handle_) 31 if (request_handle_)
30 request_handle_->PauseRequest(); 32 request_handle_->PauseRequest();
31 } 33 }
32 34
33 void DownloadJobImpl::Resume(bool resume_request) { 35 void DownloadJobImpl::Resume(bool resume_request) {
34 DownloadJob::Resume(resume_request); 36 DownloadJob::Resume(resume_request);
35 if (!resume_request) 37 if (!resume_request)
36 return; 38 return;
37 39
38 if (request_handle_) 40 if (request_handle_)
39 request_handle_->ResumeRequest(); 41 request_handle_->ResumeRequest();
40 } 42 }
41 43
42 WebContents* DownloadJobImpl::GetWebContents() const { 44 WebContents* DownloadJobImpl::GetWebContents() const {
43 return request_handle_ ? request_handle_->GetWebContents() : nullptr; 45 return request_handle_ ? request_handle_->GetWebContents() : nullptr;
44 } 46 }
45 47
46 } // namespace content 48 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698