Chromium Code Reviews| Index: components/download/content/driver_entry.h |
| diff --git a/components/download/content/driver_entry.h b/components/download/content/driver_entry.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..55c979d0ec00887c840aa8de9f2edaec372a9b64 |
| --- /dev/null |
| +++ b/components/download/content/driver_entry.h |
| @@ -0,0 +1,66 @@ |
| +// 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_CONTENT_DRIVER_ENTRY_H_ |
| +#define COMPONENTS_DOWNLOAD_CONTENT_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. */ |
| + }; |
| + |
| + // Create an entry from a download item. |
| + static DriverEntry Create(const content::DownloadItem* item); |
| + DriverEntry(); |
| + DriverEntry(const DriverEntry& other); |
| + ~DriverEntry(); |
| + |
| + // Returns true if the driver entry is not filled with valid data. |
| + bool empty() const; |
|
David Trainor- moved to gerrit
2017/05/18 18:29:44
valid?
xingliu
2017/05/18 22:21:50
Done.
|
| + |
| + // 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 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.
|
| + scoped_refptr<const net::HttpResponseHeaders> response_headers; |
| +}; |
| + |
| +} // namespace download |
| + |
| +#endif // COMPONENTS_DOWNLOAD_CONTENT_DRIVER_ENTRY_H_ |