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

Side by Side Diff: components/offline_pages/core/downloads/download_ui_item.h

Issue 2631933002: Adding status info to DownloadUIItem and piping it through. (Closed)
Patch Set: fix dependency for tests 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 unified diff | Download patch
OLDNEW
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 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ITEM_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ITEM_H_
6 #define COMPONENTS_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ITEM_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ITEM_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace offline_pages { 16 namespace offline_pages {
17 17
18 struct OfflinePageItem; 18 struct OfflinePageItem;
19 class SavePageRequest; 19 class SavePageRequest;
20 20
21 // The abstract "download item" that may be a media file, a web page (together
22 // with all the resources) or a PWA web package. This is a data bag that exposes
23 // only bits potentially visible by the user, not the internal data.
21 struct DownloadUIItem { 24 struct DownloadUIItem {
22 public: 25 public:
26 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.offlinepages.downloads
27 enum DownloadState { PENDING = 0, IN_PROGRESS = 1, PAUSED = 2, COMPLETE = 3 };
28
23 DownloadUIItem(); 29 DownloadUIItem();
24 explicit DownloadUIItem(const OfflinePageItem& page); 30 explicit DownloadUIItem(const OfflinePageItem& page);
25 explicit DownloadUIItem(const SavePageRequest& request); 31 explicit DownloadUIItem(const SavePageRequest& request);
26 DownloadUIItem(const DownloadUIItem& other); 32 DownloadUIItem(const DownloadUIItem& other);
27 ~DownloadUIItem(); 33 ~DownloadUIItem();
28 34
29 // Unique id. 35 // Unique id. It is filled with the offline_id, which should be ok
fgorski 2017/01/30 21:39:51 nit: ID
Dmitry Titov 2017/02/08 00:45:08 Done. Also reverted the rest of the comment since
36 // since there is no cross-exchange of these items between download backends.
30 std::string guid; 37 std::string guid;
31 38
32 // The URL of the captured page. 39 // The URL of the captured page.
33 GURL url; 40 GURL url;
34 41
42 DownloadState download_state;
43
44 int64_t download_progress_bytes;
45
35 // The Title of the captured page, if any. It can be empty string either 46 // The Title of the captured page, if any. It can be empty string either
36 // because the page is not yet fully loaded, or because it doesn't have any. 47 // because the page is not yet fully loaded, or because it doesn't have any.
37 base::string16 title; 48 base::string16 title;
38 49
39 // The file path to the archive with a local copy of the page. 50 // The file path to the archive with a local copy of the page.
40 base::FilePath target_path; 51 base::FilePath target_path;
41 52
42 // The time when the offline archive was created. 53 // The time when the offline archive was created.
43 base::Time start_time; 54 base::Time start_time;
44 55
45 // The size of the offline copy. 56 // The size of the offline copy.
46 int64_t total_bytes; 57 int64_t total_bytes;
47 }; 58 };
48 59
49 } // namespace offline_pages 60 } // namespace offline_pages
50 61
51 #endif // COMPONENTS_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ITEM_H_ 62 #endif // COMPONENTS_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698