| Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
|
| index 4f962085b7b95e6eed148bfd67c32894673a8be8..7e2cd465f10b951afb637c930d13b834d9d1a012 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
|
| @@ -116,7 +116,6 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
|
|
| private final LongSparseArray<DownloadItem> mSystemDownloadIdMap =
|
| new LongSparseArray<DownloadItem>();
|
| - // Using vector for thread safety.
|
| @VisibleForTesting protected final List<String> mAutoResumableDownloadIds =
|
| new ArrayList<String>();
|
| private final List<DownloadUmaStatsEntry> mUmaEntries = new ArrayList<DownloadUmaStatsEntry>();
|
| @@ -555,16 +554,14 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
| }
|
| break;
|
| case DOWNLOAD_STATUS_FAILED:
|
| - mDownloadNotifier.notifyDownloadFailed(info);
|
| downloadItems.add(item);
|
| + mDownloadNotifier.notifyDownloadFailed(info);
|
| Log.w(TAG, "Download failed: " + info.getFilePath());
|
| break;
|
| case DOWNLOAD_STATUS_IN_PROGRESS:
|
| if (info.isPaused()) {
|
| - mDownloadNotifier.notifyDownloadPaused(info, false);
|
| - if (info.isResumable()) {
|
| - recordDownloadResumption(UMA_DOWNLOAD_RESUMPTION_MANUAL_PAUSE);
|
| - }
|
| + mDownloadNotifier.notifyDownloadPaused(info);
|
| + recordDownloadResumption(UMA_DOWNLOAD_RESUMPTION_MANUAL_PAUSE);
|
| } else {
|
| mDownloadNotifier.notifyDownloadProgress(info,
|
| progress.mStartTimeInMillis, progress.mCanDownloadWhileMetered);
|
| @@ -574,7 +571,7 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
| mDownloadNotifier.notifyDownloadCanceled(item.getId());
|
| break;
|
| case DOWNLOAD_STATUS_INTERRUPTED:
|
| - mDownloadNotifier.notifyDownloadPaused(info, progress.mIsAutoResumable);
|
| + mDownloadNotifier.notifyDownloadInterrupted(info, progress.mIsAutoResumable);
|
| break;
|
| default:
|
| assert false;
|
| @@ -1099,18 +1096,18 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
| progress.mCanDownloadWhileMetered = isActiveNetworkMetered(mContext);
|
| }
|
| }
|
| - nativeResumeDownload(getNativeDownloadManagerService(), item.getId());
|
| + nativeResumeDownload(getNativeDownloadManagerService(), item.getId(),
|
| + item.getDownloadInfo().isOffTheRecord());
|
| }
|
|
|
| /**
|
| * Called to cancel a download.
|
| * @param downloadGuid GUID of the download.
|
| + * @param isOffTheRecord Whether the download is off the record.
|
| * @param isNotificationDismissed Whether cancel is caused by dismissing the notification.
|
| */
|
| - void cancelDownload(String downloadGuid, boolean isNotificationDismissed) {
|
| - DownloadProgress progress = mDownloadProgressMap.get(downloadGuid);
|
| - boolean isOffTheRecord = progress == null
|
| - ? false : progress.mDownloadItem.getDownloadInfo().isOffTheRecord();
|
| + void cancelDownload(String downloadGuid, boolean isOffTheRecord,
|
| + boolean isNotificationDismissed) {
|
| nativeCancelDownload(getNativeDownloadManagerService(), downloadGuid, isOffTheRecord,
|
| isNotificationDismissed);
|
| recordDownloadFinishedUMA(DOWNLOAD_STATUS_CANCELLED, downloadGuid, 0);
|
| @@ -1119,9 +1116,10 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
| /**
|
| * Called to pause a download.
|
| * @param downloadGuid GUID of the download.
|
| + * @param isOffTheRecord Whether the download is off the record.
|
| */
|
| - void pauseDownload(String downloadGuid) {
|
| - nativePauseDownload(getNativeDownloadManagerService(), downloadGuid);
|
| + void pauseDownload(String downloadGuid, boolean isOffTheRecord) {
|
| + nativePauseDownload(getNativeDownloadManagerService(), downloadGuid, isOffTheRecord);
|
| DownloadProgress progress = mDownloadProgressMap.get(downloadGuid);
|
| // Calling pause will stop listening to the download item. Update its progress now.
|
| // If download is already completed, canceled or failed, there is no need to update the
|
| @@ -1557,10 +1555,11 @@ public class DownloadManagerService extends BroadcastReceiver implements
|
|
|
| private native long nativeInit();
|
| private native void nativeResumeDownload(
|
| - long nativeDownloadManagerService, String downloadGuid);
|
| + long nativeDownloadManagerService, String downloadGuid, boolean isOffTheRecord);
|
| private native void nativeCancelDownload(
|
| long nativeDownloadManagerService, String downloadGuid, boolean isOffTheRecord,
|
| boolean isNotificationDismissed);
|
| - private native void nativePauseDownload(long nativeDownloadManagerService, String downloadGuid);
|
| + private native void nativePauseDownload(long nativeDownloadManagerService, String downloadGuid,
|
| + boolean isOffTheRecord);
|
| private native void nativeGetAllDownloads(long nativeDownloadManagerService);
|
| }
|
|
|