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

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

Issue 2781873002: Properly clean up notification on download open (Closed)
Patch Set: More rebase bugs 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/SystemDownloadNotifier.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java b/chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java
index 5953613e6c5d9d7de55d5a799eb9e7ab05f86bfa..b78f15abf806c9b1986ceca61e7513140fe03a25 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java
@@ -36,6 +36,7 @@ public class SystemDownloadNotifier implements DownloadNotifier, Observer {
private static final int DOWNLOAD_NOTIFICATION_TYPE_RESUME_ALL = 4;
private static final int DOWNLOAD_NOTIFICATION_TYPE_PAUSE = 5;
private static final int DOWNLOAD_NOTIFICATION_TYPE_INTERRUPT = 6;
+ private static final int DOWNLOAD_NOTIFICATION_TYPE_REMOVE_NOTIFICATION = 7;
private final Context mApplicationContext;
@Nullable private DownloadNotificationService mBoundService;
@@ -58,6 +59,7 @@ public class SystemDownloadNotifier implements DownloadNotifier, Observer {
public boolean canResolve;
public long systemDownloadId;
public boolean isSupportedMimeType;
+ public int notificationId;
public PendingNotificationInfo(int type, DownloadInfo downloadInfo) {
this.type = type;
@@ -220,6 +222,14 @@ public class SystemDownloadNotifier implements DownloadNotifier, Observer {
}
@Override
+ public void removeDownloadNotification(int notificationId, DownloadInfo downloadInfo) {
+ PendingNotificationInfo info = new PendingNotificationInfo(
+ DOWNLOAD_NOTIFICATION_TYPE_REMOVE_NOTIFICATION, downloadInfo);
+ info.notificationId = notificationId;
+ updateDownloadNotification(info, true);
+ }
+
+ @Override
public void resumePendingDownloads() {
if (!DownloadNotificationService.isTrackingResumableDownloads(mApplicationContext)) return;
@@ -294,6 +304,10 @@ public class SystemDownloadNotifier implements DownloadNotifier, Observer {
case DOWNLOAD_NOTIFICATION_TYPE_RESUME_ALL:
mBoundService.resumeAllPendingDownloads();
break;
+ case DOWNLOAD_NOTIFICATION_TYPE_REMOVE_NOTIFICATION:
+ mBoundService.cancelNotification(
+ notificationInfo.notificationId, info.getContentId());
+ break;
default:
assert false;
}

Powered by Google App Engine
This is Rietveld 408576698