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

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

Issue 2789083002: Properly clean up notification on download open (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/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 7ce595f7b5aeb50f49c0e0016124d5cf79ea0d8a..b6d691186553bb14d40cdfb4adb4ca83a6cc4ff4 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
@@ -35,6 +35,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;
@@ -57,6 +58,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;
@@ -219,6 +221,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;
@@ -295,6 +305,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.getDownloadGuid());
+ break;
default:
assert false;
}

Powered by Google App Engine
This is Rietveld 408576698