OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/offline_pages/downloads/download_ui_item.h" | 5 #include "components/offline_pages/core/downloads/download_ui_item.h" |
6 | 6 |
7 #include "components/offline_pages/background/save_page_request.h" | 7 #include "components/offline_pages/core/background/save_page_request.h" |
8 #include "components/offline_pages/offline_page_item.h" | 8 #include "components/offline_pages/core/offline_page_item.h" |
9 | 9 |
10 namespace offline_pages { | 10 namespace offline_pages { |
11 | 11 |
12 DownloadUIItem::DownloadUIItem() | 12 DownloadUIItem::DownloadUIItem() : total_bytes(0) {} |
13 : total_bytes(0) { | |
14 } | |
15 | 13 |
16 DownloadUIItem::DownloadUIItem(const OfflinePageItem& page) | 14 DownloadUIItem::DownloadUIItem(const OfflinePageItem& page) |
17 : guid(page.client_id.id), | 15 : guid(page.client_id.id), |
18 url(page.url), | 16 url(page.url), |
19 title(page.title), | 17 title(page.title), |
20 target_path(page.file_path), | 18 target_path(page.file_path), |
21 start_time(page.creation_time), | 19 start_time(page.creation_time), |
22 total_bytes(page.file_size), | 20 total_bytes(page.file_size), |
23 is_offlining(false) {} | 21 is_offlining(false) {} |
24 | 22 |
25 DownloadUIItem::DownloadUIItem(const SavePageRequest& request) | 23 DownloadUIItem::DownloadUIItem(const SavePageRequest& request) |
26 : guid(request.client_id().id), | 24 : guid(request.client_id().id), |
27 url(request.url()), | 25 url(request.url()), |
28 start_time(request.creation_time()), | 26 start_time(request.creation_time()), |
29 total_bytes(-1L), | 27 total_bytes(-1L), |
30 is_offlining(request.request_state() == | 28 is_offlining(request.request_state() == |
31 SavePageRequest::RequestState::OFFLINING) {} | 29 SavePageRequest::RequestState::OFFLINING) {} |
32 | 30 |
33 DownloadUIItem::DownloadUIItem(const DownloadUIItem& other) | 31 DownloadUIItem::DownloadUIItem(const DownloadUIItem& other) |
34 : guid(other.guid), | 32 : guid(other.guid), |
35 url(other.url), | 33 url(other.url), |
36 title(other.title), | 34 title(other.title), |
37 target_path(other.target_path), | 35 target_path(other.target_path), |
38 start_time(other.start_time), | 36 start_time(other.start_time), |
39 total_bytes(other.total_bytes), | 37 total_bytes(other.total_bytes), |
40 is_offlining(other.is_offlining) {} | 38 is_offlining(other.is_offlining) {} |
41 | 39 |
42 DownloadUIItem::~DownloadUIItem() { | 40 DownloadUIItem::~DownloadUIItem() {} |
43 } | |
44 | 41 |
45 } // namespace offline_pages | 42 } // namespace offline_pages |
OLD | NEW |