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

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: fix comment Created 3 years, 10 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/offline_pages/core/downloads/download_ui_item.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..30afd0823ea2b2f9d31c72b73d51d0cc04d86256 100644
--- a/components/offline_pages/core/downloads/download_ui_item.cc
+++ b/components/offline_pages/core/downloads/download_ui_item.cc
@@ -9,11 +9,13 @@
namespace offline_pages {
-DownloadUIItem::DownloadUIItem() : total_bytes(0) {}
+DownloadUIItem::DownloadUIItem() : download_progress_bytes(0), total_bytes(0) {}
DownloadUIItem::DownloadUIItem(const OfflinePageItem& page)
: guid(page.client_id.id),
url(page.url),
+ download_state(DownloadState::COMPLETE),
+ download_progress_bytes(0),
title(page.title),
target_path(page.file_path),
start_time(page.creation_time),
@@ -22,12 +24,28 @@ DownloadUIItem::DownloadUIItem(const OfflinePageItem& page)
DownloadUIItem::DownloadUIItem(const SavePageRequest& request)
: guid(request.client_id().id),
url(request.url()),
+ download_progress_bytes(0), // TODO(dimich) Get this from Request.
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::IN_PROGRESS;
+ 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_bytes(other.download_progress_bytes),
title(other.title),
target_path(other.target_path),
start_time(other.start_time),
« no previous file with comments | « components/offline_pages/core/downloads/download_ui_item.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698