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

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

Issue 2391053002: [Downloads UI] Handle multiple onAllDownloadItemsRetrieved() calls (Closed)
Patch Set: [Downloads UI] Handle multiple onAllDownloadItemsRetrieved() calls Created 4 years, 2 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 52f4a758010c22749eb85b87f278d996da2e1fda..79d5b284b927cc5db69a7d5e5fcb594b3f1b1f05 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
@@ -70,6 +70,10 @@ public class DownloadHistoryAdapter extends DateDividedAdapter implements Downlo
private OfflinePageDownloadBridge.Observer mOfflinePageObserver;
private int mFilter = DownloadFilter.FILTER_ALL;
+ private boolean mAllDownloadItemsRetrieved;
+ private boolean mAllOffTheRecordDownloadItemsRetrieved;
+ private boolean mAllOfflinePagesRetrieved;
+
DownloadHistoryAdapter(boolean showOffTheRecord, ComponentName parentComponent) {
mShowOffTheRecord = showOffTheRecord;
mParentComponent = parentComponent;
@@ -97,6 +101,16 @@ public class DownloadHistoryAdapter extends DateDividedAdapter implements Downlo
public void onAllDownloadsRetrieved(List<DownloadItem> result, boolean isOffTheRecord) {
if (isOffTheRecord && !mShowOffTheRecord) return;
+ if ((!isOffTheRecord && mAllDownloadItemsRetrieved)
+ || (isOffTheRecord && mAllOffTheRecordDownloadItemsRetrieved)) {
+ return;
+ }
+ if (!isOffTheRecord) {
+ mAllDownloadItemsRetrieved = true;
+ } else {
+ mAllOffTheRecordDownloadItemsRetrieved = true;
+ }
+
mLoadingDelegate.updateLoadingState(
isOffTheRecord ? LoadingStateDelegate.OFF_THE_RECORD_HISTORY_LOADED
: LoadingStateDelegate.DOWNLOAD_HISTORY_LOADED);
@@ -128,6 +142,9 @@ public class DownloadHistoryAdapter extends DateDividedAdapter implements Downlo
/** Called when the user's offline page history has been gathered. */
private void onAllOfflinePagesRetrieved(List<OfflinePageDownloadItem> result) {
+ if (mAllOfflinePagesRetrieved) return;
+ mAllOfflinePagesRetrieved = true;
+
mLoadingDelegate.updateLoadingState(LoadingStateDelegate.OFFLINE_PAGE_LOADED);
mOfflinePageItems.clear();
for (OfflinePageDownloadItem item : result) {
« 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