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

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

Issue 2387453002: Use system download completion notification if app notification is disabled. (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | 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/DownloadManagerDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java
index 95e85851106b07085b98ec73c18c08ff74327fbd..28b3a35dc18a597f962e36edd45575dfff1c9ba4 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerDelegate.java
@@ -10,6 +10,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
+import android.support.v4.app.NotificationManagerCompat;
import org.chromium.base.Log;
@@ -35,6 +36,8 @@ public class DownloadManagerDelegate {
String path, long length, String originalUrl, String referer) {
DownloadManager manager =
(DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE);
+ NotificationManagerCompat notificationManager = NotificationManagerCompat.from(mContext);
+ boolean useSystemNotification = !notificationManager.areNotificationsEnabled();
String newMimeType =
ChromeDownloadDelegate.remapGenericMimeType(mimeType, originalUrl, fileName);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
@@ -46,7 +49,7 @@ public class DownloadManagerDelegate {
Uri originalUri = Uri.parse(originalUrl);
Uri refererUri = referer == null ? Uri.EMPTY : Uri.parse(referer);
return (Long) method.invoke(manager, fileName, description, true, newMimeType, path,
- length, false, originalUri, refererUri);
+ length, useSystemNotification, originalUri, refererUri);
} catch (SecurityException e) {
Log.e(TAG, "Cannot access the needed method.");
} catch (NoSuchMethodException e) {
@@ -58,7 +61,7 @@ public class DownloadManagerDelegate {
}
}
return manager.addCompletedDownload(fileName, description, true, newMimeType, path, length,
- false);
+ useSystemNotification);
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698