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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryAdapter.java

Issue 2721803002: Fix the inability to delete just-downloaded pages from Download Home. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryAdapter.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryAdapter.java
index f3f9905fe82789bc1f0b637f02c36efe92864074..be68e2c4601d2bf19c429b2ec063ba40ad587f1f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryAdapter.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryAdapter.java
@@ -585,6 +585,16 @@ public class DownloadHistoryAdapter extends DateDividedAdapter
DownloadHistoryItemWrapper existingWrapper = mOfflinePageItems.get(index);
existingWrapper.replaceItem(item);
+ // Re-add the file mapping once it finishes downloading. This accounts for the
+ // backend creating Offline Pages with a null file path, then updating it after the
+ // download starts. Doing it once after completion instead of at every update
+ // is a compromise that prevents us from rapidly and repeatedly updating the map
+ // with the same info is progress is reported.
+ if (item.getDownloadState()
+ == org.chromium.components.offlinepages.downloads.DownloadState.COMPLETE) {
+ mFilePathsToItemsMap.addItem(existingWrapper);
+ }
+
updateDisplayedItems();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698