Chromium Code Reviews| 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), |