Index: components/offline_pages/core/downloads/download_ui_adapter.cc |
diff --git a/components/offline_pages/core/downloads/download_ui_adapter.cc b/components/offline_pages/core/downloads/download_ui_adapter.cc |
index bfc4526f042d79150909c6d5a2646569eaa5a38b..d73ed686aa5e8b2a72f52bde5354e0da75e98e80 100644 |
--- a/components/offline_pages/core/downloads/download_ui_adapter.cc |
+++ b/components/offline_pages/core/downloads/download_ui_adapter.cc |
@@ -192,6 +192,19 @@ int64_t DownloadUIAdapter::GetOfflineIdByGuid(const std::string& guid) const { |
return 0; |
} |
+void DownloadUIAdapter::UpdateProgress(int64_t offline_id, int64_t bytes) { |
+ for (auto& item : items_) { |
+ if (item.second->is_request && item.second->offline_id == offline_id) { |
+ if (bytes == item.second->ui_item->download_progress_bytes) |
+ return; |
+ |
+ item.second->ui_item->download_progress_bytes = bytes; |
+ for (Observer& observer : observers_) |
+ observer.ItemUpdated(*(item.second->ui_item)); |
+ } |
+ } |
+} |
+ |
// Note that several LoadCache calls may be issued before the async GetAllPages |
// comes back. |
void DownloadUIAdapter::LoadCache() { |