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

Unified Diff: components/offline_items_collection/core/offline_item.h

Issue 2861863002: offline_items_collection : Added helper class to determine progress (Closed)
Patch Set: more Created 3 years, 8 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_items_collection/core/offline_item.h
diff --git a/components/offline_items_collection/core/offline_item.h b/components/offline_items_collection/core/offline_item.h
index c588253f1f447f55b205f9a8071695a17e795ac9..e55a41b85870254fb2f1308590fe19af5c2ad4c0 100644
--- a/components/offline_items_collection/core/offline_item.h
+++ b/components/offline_items_collection/core/offline_item.h
@@ -9,6 +9,7 @@
#include "base/time/time.h"
#include "components/offline_items_collection/core/offline_item_filter.h"
+#include "components/offline_items_collection/core/offline_item_progress_unit.h"
#include "components/offline_items_collection/core/offline_item_state.h"
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
@@ -46,6 +47,25 @@ struct ContentId {
//
// A new feature should expose these OfflineItems via an OfflineContentProvider.
struct OfflineItem {
+ // This struct holds the essential pieces of information to compute the
+ // download progress percentage for an offline item to display in the UI.
David Trainor- moved to gerrit 2017/05/03 22:06:32 remove "percentage"
shaktisahu 2017/05/05 02:09:37 Done.
+ struct Progress {
+ Progress();
+ Progress(const Progress& other);
+ ~Progress();
+
+ bool operator==(const Progress& progress) const;
+
+ // Current value of the download progress.
+ int64_t value;
+
+ // The maximum value of the download progress. -1 indicates indeterminate.
David Trainor- moved to gerrit 2017/05/03 22:06:32 Can this just be a base::Optional? If it's not th
shaktisahu 2017/05/05 02:09:37 Done.
+ int64_t max;
+
+ // The unit of progress to be displayed in the UI.
+ OfflineItemProgressUnit unit;
+ };
+
OfflineItem();
OfflineItem(const OfflineItem& other);
explicit OfflineItem(const ContentId& id);
@@ -122,11 +142,8 @@ struct OfflineItem {
// if |state| is COMPLETE.
int64_t received_bytes;
- // How complete (from 0 to 100) the offlining process is for this item. -1
- // represents that progress cannot be determined for this item and an
- // indeterminate progress bar should be used. This field is not used if
- // |state| is COMPLETE.
- int percent_completed;
+ // Represents the current progress of this item.
David Trainor- moved to gerrit 2017/05/03 22:06:32 Keep some of the information here. The field is n
shaktisahu 2017/05/05 02:09:37 Done.
+ Progress progress;
// The estimated time remaining for the download in milliseconds. -1
// represents an unknown time remaining. This field is not used if |state| is

Powered by Google App Engine
This is Rietveld 408576698