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

Unified Diff: components/offline_pages/core/downloads/download_ui_adapter.cc

Issue 2711693002: [Offline Pages] Make prerenderer notify us of network progress. (Closed)
Patch Set: last minute fixes 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 side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698