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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotifier.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4658f1de5a0d4b2a3302202a0ee2122702532f7b..58d47749dd6ff15fded94f41ce9ca3755456729f 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
@@ -796,12 +796,14 @@ public class DownloadNotificationService extends Service {
}
/**
- * Cancel a download notification.
+ * Removes a download notification and all associated tracking. This method relies on the
+ * caller to provide the notification id, which is useful in the case where the internal
+ * tracking doesn't exist (e.g. in the case of a successful download, where we show the download
+ * completed notification and remove our internal state tracking).
* @param notificationId Notification ID of the download
* @param downloadGuid GUID of the download.
*/
- @VisibleForTesting
- void cancelNotification(int notificationId, String downloadGuid) {
+ public void cancelNotification(int notificationId, String downloadGuid) {
mNotificationManager.cancel(NOTIFICATION_NAMESPACE, notificationId);
mDownloadSharedPreferenceHelper.removeSharedPreferenceEntry(downloadGuid);
@@ -816,7 +818,8 @@ public class DownloadNotificationService extends Service {
}
/**
- * Called when a download is canceled.
+ * Called when a download is canceled. This method uses internal tracking to try to find the
+ * notification id to cancel.
* @param downloadGuid GUID of the download.
*/
@VisibleForTesting
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotifier.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698