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

Unified Diff: components/download/internal/driver_entry.h

Issue 2880933002: Download driver for components/download. (Closed)
Patch Set: Polish comment. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/download/internal/download_driver.h ('k') | components/download/internal/driver_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/download/internal/driver_entry.h
diff --git a/components/download/internal/driver_entry.h b/components/download/internal/driver_entry.h
new file mode 100644
index 0000000000000000000000000000000000000000..a21a4312c9e26432007a48c617e5770d580576e2
--- /dev/null
+++ b/components/download/internal/driver_entry.h
@@ -0,0 +1,61 @@
+// 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.
+
+#ifndef COMPONENTS_DOWNLOAD_INTERNAL_DRIVER_ENTRY_H_
+#define COMPONENTS_DOWNLOAD_INTERNAL_DRIVER_ENTRY_H_
+
+#include <string>
+
+#include "base/memory/ref_counted.h"
+
+namespace net {
+class HttpResponseHeaders;
+} // namespace net
+
+namespace content {
+class DownloadItem;
+} // namespace content
+
+namespace download {
+
+// A snapshot of the states of a download. It's preferred to use the data on the
+// fly and query new ones from download driver, instead of caching the states.
+struct DriverEntry {
+ // States of the download. Mostly maps to
+ // content::DownloadItem::DownloadState.
+ enum class State {
+ IN_PROGRESS = 0,
+ COMPLETE = 1,
+ CANCELLED = 2,
+ INTERRUPTED = 3,
+ UNKNOWN = 4, /* Not created from a download item object. */
+ };
+
+ DriverEntry();
+ DriverEntry(const DriverEntry& other);
+ ~DriverEntry();
+
+ // The unique identifier of the download.
+ std::string guid;
+
+ // The current state of the download.
+ State state;
+
+ // If the download is paused.
+ bool paused;
+
+ // The number of bytes downloaded.
+ uint64_t bytes_downloaded;
+
+ // The expected total size of the download, set to 0 if the Content-Length
+ // http header is not presented.
+ uint64_t expected_total_size;
+
+ // The response headers for the most recent download request.
+ scoped_refptr<const net::HttpResponseHeaders> response_headers;
+};
+
+} // namespace download
+
+#endif // COMPONENTS_DOWNLOAD_INTERNAL_DRIVER_ENTRY_H_
« no previous file with comments | « components/download/internal/download_driver.h ('k') | components/download/internal/driver_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698