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

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

Issue 2007983007: Fix an issue that filename is missing in download failure notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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/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 cccfc3e7b423c93c722de9a1abd2fdf8b27de7f7..a049b680e2432d4f210e83b7fd83643878688971 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
@@ -16,6 +16,7 @@ import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
+import android.text.TextUtils;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
@@ -261,6 +262,14 @@ public class DownloadNotificationService extends Service {
* @param fileName GUID of the download.
*/
public void notifyDownloadFailed(String downloadGuid, String fileName) {
+ // If the download is not in history db, fileName could be empty. Get it from
+ // SharedPreferences.
+ if (TextUtils.isEmpty(fileName)) {
+ DownloadSharedPreferenceEntry entry = getDownloadSharedPreferenceEntry(downloadGuid);
+ if (entry == null) return;
+ fileName = entry.fileName;
+ }
+
int notificationId = getNotificationId(downloadGuid);
NotificationCompat.Builder builder = buildNotification(
android.R.drawable.stat_sys_download_done, fileName,
« 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