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

Unified Diff: components/offline_pages/core/downloads/download_ui_item.cc

Issue 2631933002: Adding status info to DownloadUIItem and piping it through. (Closed)
Patch Set: feedback, test compile Created 3 years, 11 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
Index: components/offline_pages/core/downloads/download_ui_item.cc
diff --git a/components/offline_pages/core/downloads/download_ui_item.cc b/components/offline_pages/core/downloads/download_ui_item.cc
index c5bdef820282100d5ef0eb5204db95f76c19677e..dd205bf42c66fe36a988d414f657e08ea9c149a6 100644
--- a/components/offline_pages/core/downloads/download_ui_item.cc
+++ b/components/offline_pages/core/downloads/download_ui_item.cc
@@ -9,11 +9,15 @@
namespace offline_pages {
-DownloadUIItem::DownloadUIItem() : total_bytes(0) {}
+DownloadUIItem::DownloadUIItem()
+ : download_progress(DownloadProgress(1,1)),
+ total_bytes(0) {}
DownloadUIItem::DownloadUIItem(const OfflinePageItem& page)
: guid(page.client_id.id),
url(page.url),
+ download_state(DownloadState::COMPLETED),
+ download_progress(DownloadProgress(1,1)),
dewittj 2017/01/18 19:24:07 current is 1 byte?
Dmitry Titov 2017/01/27 04:26:24 Done.
title(page.title),
target_path(page.file_path),
start_time(page.creation_time),
@@ -22,12 +26,28 @@ DownloadUIItem::DownloadUIItem(const OfflinePageItem& page)
DownloadUIItem::DownloadUIItem(const SavePageRequest& request)
: guid(request.client_id().id),
url(request.url()),
+ download_progress(DownloadProgress(1,0)),
dewittj 2017/01/18 19:24:07 current > max?
Dmitry Titov 2017/01/27 04:26:24 Done.
start_time(request.creation_time()),
- total_bytes(-1L) {}
+ total_bytes(-1L) {
+ switch (request.request_state()) {
+ case SavePageRequest::RequestState::AVAILABLE:
+ download_state = DownloadState::PENDING;
+ break;
+ case SavePageRequest::RequestState::OFFLINING:
+ download_state = DownloadState::DOWNLOADING;
+ break;
+ case SavePageRequest::RequestState::PAUSED:
+ download_state = DownloadState::PAUSED;
+ break;
+ }
+ // TODO(dimich): Fill in download_progress, add change notifications for it.
+}
DownloadUIItem::DownloadUIItem(const DownloadUIItem& other)
: guid(other.guid),
url(other.url),
+ download_state(other.download_state),
+ download_progress(other.download_progress),
title(other.title),
target_path(other.target_path),
start_time(other.start_time),

Powered by Google App Engine
This is Rietveld 408576698