Index: components/offline_pages/core/background/offliner_stub.cc |
diff --git a/components/offline_pages/core/background/offliner_stub.cc b/components/offline_pages/core/background/offliner_stub.cc |
index 58b80a159286601b889932e8cecc78754d00f547..5e1cac4adfd82ff6e118b9fd3a60ee12fc3e0432 100644 |
--- a/components/offline_pages/core/background/offliner_stub.cc |
+++ b/components/offline_pages/core/background/offliner_stub.cc |
@@ -14,7 +14,9 @@ OfflinerStub::OfflinerStub() |
: disable_loading_(false), |
enable_callback_(false), |
cancel_called_(false), |
- snapshot_on_last_retry_(false) {} |
+ snapshot_on_last_retry_(false), |
+ started_count_(0LL), |
+ completed_count_(0LL) {} |
OfflinerStub::~OfflinerStub() {} |
@@ -60,4 +62,24 @@ bool OfflinerStub::HandleTimeout(int64_t request_id) { |
return false; |
} |
+void OfflinerStub::ObserveResourceTracking(ResourceDataType type, |
+ int64_t started_count, |
+ int64_t completed_count) { |
+ started_count_ = started_count; |
+ completed_count_ = completed_count; |
+} |
+ |
+// Returns the most recently seen counts for a specific resource type. |
+// TODO(petewil): Today this just supports images, later support all types. |
+void OfflinerStub::GetResourcePercentageCounts(const ResourceDataType type, |
+ int64_t* started, |
+ int64_t* completed) { |
+ if (type == ResourceDataType::IMAGE) { |
+ if (started) |
+ *started = started_count_; |
+ if (completed) |
+ *completed = completed_count_; |
+ } |
+} |
+ |
} // namespace offline_pages |