| Index: components/offline_pages/core/downloads/download_ui_item.h
|
| diff --git a/components/offline_pages/core/downloads/download_ui_item.h b/components/offline_pages/core/downloads/download_ui_item.h
|
| index aea7cf5ccebb9b8e8dc8d698d049b4c4051117f6..5d73f4ecd4f74c0a687a2ab96a475af4f8166890 100644
|
| --- a/components/offline_pages/core/downloads/download_ui_item.h
|
| +++ b/components/offline_pages/core/downloads/download_ui_item.h
|
| @@ -18,20 +18,51 @@ namespace offline_pages {
|
| struct OfflinePageItem;
|
| class SavePageRequest;
|
|
|
| +// The abstract "download item" that may be a media file, a web page (together
|
| +// with all the resources) or a PWA web package. This is a data bag that exposes
|
| +// only bits potentially visible by the user, not the internal data.
|
| struct DownloadUIItem {
|
| public:
|
| + // All Items start from PENDING and terminate at COMPLETED or are removed.
|
| + // In sync with state values in Java OfflinePageDownloadItem class.
|
| + enum DownloadState {
|
| + PENDING = 0,
|
| + DOWNLOADING = 1,
|
| + PAUSED = 2,
|
| + COMPLETED = 3,
|
| + };
|
| +
|
| + // The abstract notion of download progress. The |current| is always less
|
| + // than |max|, the download 'percentage' at any moment is current/max.
|
| + // Note the |max| can change over time, as more resources are discovered from
|
| + // the bytes already loaded (which is often happening when a web page is
|
| + // loaded and more resources are found in the markup).
|
| + struct DownloadProgress {
|
| + DownloadProgress(int64_t current, int64_t max)
|
| + : current(current),
|
| + max(max) {}
|
| +
|
| + int64_t current;
|
| + int64_t max;
|
| + };
|
| +
|
| DownloadUIItem();
|
| explicit DownloadUIItem(const OfflinePageItem& page);
|
| explicit DownloadUIItem(const SavePageRequest& request);
|
| DownloadUIItem(const DownloadUIItem& other);
|
| ~DownloadUIItem();
|
|
|
| - // Unique id.
|
| + // Unique id. Not necesarily a GUID, may be any string unique in the Chrome
|
| + // instance across all DownloadUIItem providers.
|
| std::string guid;
|
|
|
| // The URL of the captured page.
|
| GURL url;
|
|
|
| + DownloadState download_state;
|
| +
|
| + DownloadProgress download_progress;
|
| +
|
| // The Title of the captured page, if any. It can be empty string either
|
| // because the page is not yet fully loaded, or because it doesn't have any.
|
| base::string16 title;
|
|
|