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

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

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.cc
diff --git a/components/offline_items_collection/core/offline_item.cc b/components/offline_items_collection/core/offline_item.cc
index 834938dc63ed2b2e56944721bce2ca757d6ae4cf..c99a3474816d152c5c889db38ed5680fbe518af4 100644
--- a/components/offline_items_collection/core/offline_item.cc
+++ b/components/offline_items_collection/core/offline_item.cc
@@ -26,6 +26,16 @@ bool ContentId::operator<(const ContentId& content_id) const {
std::tie(content_id.name_space, content_id.id);
}
+OfflineItem::Progress::Progress() : value(0), max(-1), unit(BYTES) {}
+
+OfflineItem::Progress::Progress(const Progress& other) = default;
+
+OfflineItem::Progress::~Progress() = default;
+
+bool OfflineItem::Progress::operator==(const Progress& other) const {
+ return value == other.value && max == other.max && unit == other.unit;
+}
+
OfflineItem::OfflineItem()
: filter(OfflineItemFilter::FILTER_OTHER),
is_transient(false),
@@ -37,7 +47,6 @@ OfflineItem::OfflineItem()
is_resumable(false),
allow_metered(false),
received_bytes(0),
- percent_completed(0),
time_remaining_ms(0) {}
OfflineItem::OfflineItem(const OfflineItem& other) = default;
@@ -65,7 +74,7 @@ bool OfflineItem::operator==(const OfflineItem& offline_item) const {
is_resumable == offline_item.is_resumable &&
allow_metered == offline_item.allow_metered &&
received_bytes == offline_item.received_bytes &&
- percent_completed == offline_item.percent_completed &&
+ progress == offline_item.progress &&
time_remaining_ms == offline_item.time_remaining_ms;
}

Powered by Google App Engine
This is Rietveld 408576698