Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java |
index a51f90892d9d559d49c2e63dd03c923010ec340a..b18982428c1c048c8eab3bed01fcc326770f4f95 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java |
@@ -361,7 +361,7 @@ public class DownloadNotificationService extends Service { |
notifyDownloadCanceled(entry.downloadGuid); |
if (cancelActualDownload) { |
DownloadServiceDelegate delegate = getServiceDelegate(entry.itemType); |
- delegate.cancelDownload(entry.downloadGuid, entry.isOffTheRecord, false); |
+ delegate.cancelDownload(entry.downloadGuid, entry.isOffTheRecord); |
delegate.destroyServiceDelegate(); |
} |
for (Observer observer : mObservers) observer.onDownloadCanceled(entry.downloadGuid); |
@@ -635,10 +635,6 @@ public class DownloadNotificationService extends Service { |
mContext.getResources().getString(R.string.download_notification_cancel_button), |
buildPendingIntent(cancelIntent, entry.notificationId)); |
- Intent dismissIntent = new Intent(cancelIntent); |
- dismissIntent.putExtra(EXTRA_NOTIFICATION_DISMISSED, true); |
- builder.setDeleteIntent(buildPendingIntent(dismissIntent, entry.notificationId)); |
- |
updateNotification(entry.notificationId, builder.build(), downloadGuid, |
entry.isOfflinePage(), |
new DownloadSharedPreferenceEntry(entry.notificationId, entry.isOffTheRecord, |
@@ -850,6 +846,11 @@ public class DownloadNotificationService extends Service { |
return; |
} else if (ACTION_DOWNLOAD_OPEN.equals(intent.getAction())) { |
// TODO(fgorski): Do we even need to do anything special here, before we launch Chrome? |
+ } else if (ACTION_DOWNLOAD_CANCEL.equals(intent.getAction()) |
+ && IntentUtils.safeGetBooleanExtra(intent, EXTRA_NOTIFICATION_DISMISSED, false)) { |
+ // User canceled a download by dismissing its notification from earlier versions, ignore |
+ // it. TODO(qinmin): remove this else-if block after M60. |
+ return; |
} |
BrowserParts parts = new EmptyBrowserParts() { |
@@ -873,8 +874,7 @@ public class DownloadNotificationService extends Service { |
// don't need to restart the browser process. http://crbug.com/579643. |
cancelNotification(entry.notificationId, entry.downloadGuid); |
downloadServiceDelegate.cancelDownload(entry.downloadGuid, |
- entry.isOffTheRecord, IntentUtils.safeGetBooleanExtra( |
- intent, EXTRA_NOTIFICATION_DISMISSED, false)); |
+ entry.isOffTheRecord); |
for (Observer observer : mObservers) { |
observer.onDownloadCanceled(entry.downloadGuid); |
} |
@@ -933,7 +933,7 @@ public class DownloadNotificationService extends Service { |
// Pass information directly to the DownloadManagerService. |
if (TextUtils.equals(action, ACTION_DOWNLOAD_CANCEL)) { |
- getServiceDelegate(itemType).cancelDownload(downloadGuid, isOffTheRecord, false); |
+ getServiceDelegate(itemType).cancelDownload(downloadGuid, isOffTheRecord); |
} else if (TextUtils.equals(action, ACTION_DOWNLOAD_PAUSE)) { |
getServiceDelegate(itemType).pauseDownload(downloadGuid, isOffTheRecord); |
} else if (TextUtils.equals(action, ACTION_DOWNLOAD_RESUME)) { |