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

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

Issue 2861863002: offline_items_collection : Added helper class to determine progress (Closed)
Patch Set: findbugs Created 3 years, 7 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: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadItem.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadItem.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadItem.java
index f21ca94e1a41422c643534f45be137617380f681..646891ff69d231b7910a7cf9c80c916bc625a5c1 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadItem.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadItem.java
@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.download;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.components.offline_items_collection.ContentId;
+import org.chromium.components.offline_items_collection.OfflineItem.Progress;
/**
* A generic class representing a download item. The item can be either downloaded through the
@@ -15,7 +16,6 @@ import org.chromium.components.offline_items_collection.ContentId;
* DownloadManager must be queried for the correct status.
*/
public class DownloadItem {
- public static final int INDETERMINATE_DOWNLOAD_PERCENTAGE = -1;
static final long INVALID_DOWNLOAD_ID = -1L;
private final ContentId mContentId = new ContentId();
@@ -143,6 +143,7 @@ public class DownloadItem {
* @return Whether or not the download has an indeterminate percentage.
*/
public boolean isIndeterminate() {
- return getDownloadInfo().getPercentCompleted() == INDETERMINATE_DOWNLOAD_PERCENTAGE;
+ Progress progress = getDownloadInfo().getProgress();
+ return progress == null || progress.isIndeterminate();
}
}

Powered by Google App Engine
This is Rietveld 408576698