OLD | NEW |
(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_INTERNAL_DRIVER_ENTRY_H_ |
| 6 #define COMPONENTS_DOWNLOAD_INTERNAL_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 DriverEntry(); |
| 36 DriverEntry(const DriverEntry& other); |
| 37 ~DriverEntry(); |
| 38 |
| 39 // The unique identifier of the download. |
| 40 std::string guid; |
| 41 |
| 42 // The current state of the download. |
| 43 State state; |
| 44 |
| 45 // If the download is paused. |
| 46 bool paused; |
| 47 |
| 48 // The number of bytes downloaded. |
| 49 uint64_t bytes_downloaded; |
| 50 |
| 51 // The expected total size of the download, set to 0 if the Content-Length |
| 52 // http header is not presented. |
| 53 uint64_t expected_total_size; |
| 54 |
| 55 // The response headers for the most recent download request. |
| 56 scoped_refptr<const net::HttpResponseHeaders> response_headers; |
| 57 }; |
| 58 |
| 59 } // namespace download |
| 60 |
| 61 #endif // COMPONENTS_DOWNLOAD_INTERNAL_DRIVER_ENTRY_H_ |
OLD | NEW |