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

Side by Side Diff: components/download/content/driver_entry.h

Issue 2880933002: Download driver for components/download. (Closed)
Patch Set: Work on feedbacks. Created 3 years, 7 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 #ifndef COMPONENTS_DOWNLOAD_CONTENT_DRIVER_ENTRY_H_
6 #define COMPONENTS_DOWNLOAD_CONTENT_DRIVER_ENTRY_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11
12 namespace net {
13 class HttpResponseHeaders;
14 } // namespace net
15
16 namespace content {
17 class DownloadItem;
18 } // namespace content
19
20 namespace download {
21
22 // A snapshot of the states of a download. It's preferred to use the data on the
23 // fly and query new ones from download driver, instead of caching the states.
24 struct DriverEntry {
25 // States of the download. Mostly maps to
26 // content::DownloadItem::DownloadState.
27 enum class State {
28 IN_PROGRESS = 0,
29 COMPLETE = 1,
30 CANCELLED = 2,
31 INTERRUPTED = 3,
32 UNKNOWN = 4, /* Not created from a download item object. */
33 };
34
35 // Create an entry from a download item.
36 static DriverEntry Create(const content::DownloadItem* item);
37 DriverEntry();
38 DriverEntry(const DriverEntry& other);
39 ~DriverEntry();
40
41 // Returns true if the driver entry is not filled with valid data.
42 bool empty() const;
David Trainor- moved to gerrit 2017/05/18 18:29:44 valid?
xingliu 2017/05/18 22:21:50 Done.
43
44 // The unique identifier of the download.
45 std::string guid;
46
47 // The current state of the download.
48 State state;
49
50 // If the download is paused.
51 bool paused;
52
53 // The number of bytes downloaded.
54 uint64_t bytes_downloaded;
55
56 // The expected total size of the download, set to 0 if the Content-Length
57 // http header is not presented.
58 uint64_t expected_total_size;
59
60 // The response headers for the download.
David Trainor- moved to gerrit 2017/05/18 18:29:44 "...for the most recent download request?"
xingliu 2017/05/18 22:21:50 Done.
61 scoped_refptr<const net::HttpResponseHeaders> response_headers;
62 };
63
64 } // namespace download
65
66 #endif // COMPONENTS_DOWNLOAD_CONTENT_DRIVER_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698