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

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

Issue 2737833002: Don't cancel download when dismissing the notification (Closed)
Patch Set: Created 3 years, 9 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/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 29ce08ba0c8c2bb34ef07da7873e916638cbc63e..038535ab59443ae2198591bf0a282e946a1d2955 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
@@ -360,7 +360,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);
@@ -636,10 +636,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());
// Update the SharedPreference entry with the new isAutoResumable value.
mDownloadSharedPreferenceHelper.addOrReplaceSharedPreferenceEntry(
@@ -854,6 +850,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() {
@@ -877,8 +878,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);
}
@@ -937,7 +937,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)) {

Powered by Google App Engine
This is Rietveld 408576698