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

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

Issue 2645133003: Introduce DownloadJob for DownloadItem refactoring. (Closed)
Patch Set: Small tweak to inline getter. Created 3 years, 11 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), type_(Type::FILE) {}
16
17 DownloadJob::~DownloadJob() = default;
18
19 void DownloadJob::OnAttached(DownloadJob::Manager* manager) {
20 manager_ = manager;
21 }
22
23 void DownloadJob::OnBeforeDetach() {
24 manager_ = nullptr;
25 }
26
27 void DownloadJob::StartedSavingResponse() {
28 DCHECK(manager_) << "DownloadJob::Manager is detached.";
29 manager_->StartSaving(this);
30 }
31
32 void DownloadJob::Interrupt(DownloadInterruptReason reason) {
33 DCHECK(manager_) << "DownloadJob::Manager is detached.";
34 manager_->OnDownloadInterrupted(this, reason);
35 }
36
37 void DownloadJob::Complete() {
38 DCHECK(manager_) << "DownloadJob::Manager is detached.";
39 manager_->OnDownloadComplete(this);
40 }
41
42 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698