| Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadInfo.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadInfo.java
|
| index 233c85cdd206e17ac906198f920a2da56a423505..2e622c943e3c75b2027c919d22b2a9e7d1c10bd1 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadInfo.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadInfo.java
|
| @@ -10,6 +10,7 @@ import org.chromium.base.annotations.CalledByNative;
|
| import org.chromium.components.offline_items_collection.ContentId;
|
| import org.chromium.components.offline_items_collection.LegacyHelpers;
|
| import org.chromium.components.offline_items_collection.OfflineItem;
|
| +import org.chromium.components.offline_items_collection.OfflineItem.Progress;
|
| import org.chromium.components.offline_items_collection.OfflineItemState;
|
| import org.chromium.components.offline_items_collection.OfflineItemVisuals;
|
| import org.chromium.content_public.browser.DownloadState;
|
| @@ -33,6 +34,7 @@ public final class DownloadInfo {
|
| private final String mContentDisposition;
|
| private final boolean mIsGETRequest;
|
| private final int mPercentCompleted;
|
| + private final Progress mProgress;
|
| private final long mTimeRemainingInMillis;
|
| private final boolean mIsResumable;
|
| private final boolean mIsPaused;
|
| @@ -63,6 +65,7 @@ public final class DownloadInfo {
|
| mIsGETRequest = builder.mIsGETRequest;
|
| mContentDisposition = builder.mContentDisposition;
|
| mPercentCompleted = builder.mPercentCompleted;
|
| + mProgress = builder.mProgress;
|
| mTimeRemainingInMillis = builder.mTimeRemainingInMillis;
|
| mIsResumable = builder.mIsResumable;
|
| mIsPaused = builder.mIsPaused;
|
| @@ -144,6 +147,10 @@ public final class DownloadInfo {
|
| return mPercentCompleted;
|
| }
|
|
|
| + public Progress getProgress() {
|
| + return mProgress;
|
| + }
|
| +
|
| /**
|
| * @return Remaining download time in milliseconds or -1 if it is unknown.
|
| */
|
| @@ -232,7 +239,7 @@ public final class DownloadInfo {
|
| .setIsPaused(item.state == OfflineItemState.PAUSED)
|
| .setIsResumable(item.isResumable)
|
| .setBytesReceived(item.receivedBytes)
|
| - .setPercentCompleted(item.percentCompleted)
|
| + .setProgress(item.progress)
|
| .setTimeRemainingInMillis(item.timeRemainingMs)
|
| .setIcon(visuals == null ? null : visuals.icon)
|
| .build();
|
| @@ -257,6 +264,7 @@ public final class DownloadInfo {
|
| private boolean mHasUserGesture;
|
| private String mContentDisposition;
|
| private int mPercentCompleted = -1;
|
| + private Progress mProgress;
|
| private long mTimeRemainingInMillis;
|
| private boolean mIsResumable = true;
|
| private boolean mIsPaused;
|
| @@ -345,6 +353,14 @@ public final class DownloadInfo {
|
| return this;
|
| }
|
|
|
| + public Builder setProgress(OfflineItem.Progress progress) {
|
| + mProgress = progress;
|
| + if (mProgress.max != 0) {
|
| + mPercentCompleted = (int) (progress.value / progress.max);
|
| + }
|
| + return this;
|
| + }
|
| +
|
| public Builder setTimeRemainingInMillis(long timeRemainingInMillis) {
|
| mTimeRemainingInMillis = timeRemainingInMillis;
|
| return this;
|
| @@ -426,6 +442,7 @@ public final class DownloadInfo {
|
| .setContentDisposition(downloadInfo.getContentDisposition())
|
| .setIsGETRequest(downloadInfo.isGETRequest())
|
| .setPercentCompleted(downloadInfo.getPercentCompleted())
|
| + .setProgress(downloadInfo.getProgress())
|
| .setTimeRemainingInMillis(downloadInfo.getTimeRemainingInMillis())
|
| .setIsResumable(downloadInfo.isResumable())
|
| .setIsPaused(downloadInfo.isPaused())
|
|
|