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

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

Issue 2645133003: Introduce DownloadJob for DownloadItem refactoring. (Closed)
Patch Set: Conditionally call to delegate. 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/download/download_job.h"
6
7 namespace content {
8
9 // Unknown download progress.
10 const int kDownloadProgressUnknown = -1;
11
12 // Unknown download speed.
13 const int kDownloadSpeedUnknown = -1;
14
15 DownloadJob::DownloadJob() : manager_(nullptr) {}
16
17 DownloadJob::~DownloadJob() = default;
18
19 void DownloadJob::OnAttached(DownloadJob::Manager* manager) {
20 DCHECK(!manager_) << "DownloadJob::Manager has already been attached.";
21 manager_ = manager;
22 }
23
24 void DownloadJob::OnBeforeDetach() {
25 manager_ = nullptr;
26 }
27
28 void DownloadJob::StartedSavingResponse() {
29 if (manager_)
30 manager_->OnSavingStarted(this);
31 }
32
33 void DownloadJob::Interrupt(DownloadInterruptReason reason) {
34 if (manager_)
35 manager_->OnDownloadInterrupted(this, reason);
36 }
37
38 void DownloadJob::Complete() {
39 if (manager_)
40 manager_->OnDownloadComplete(this);
41 }
42
43 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_job.h ('k') | content/browser/download/download_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698