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

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

Issue 2019793002: Fix an issue that filename is missing in download failure notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: 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 ebbfdeb5848a59a22da726b536510f5a66bf9498..316375ea0406f1d4fd9ba569bc30d21fa0c1bb07 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
@@ -17,6 +17,7 @@ import android.os.Build;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
+import android.text.TextUtils;
import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
@@ -242,6 +243,14 @@ public class DownloadNotificationService extends Service {
* @param fileName GUID of the download.
*/
public void notifyDownloadFailed(int notificationId, 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;
+ }
+
NotificationCompat.Builder builder = buildNotification(
android.R.drawable.stat_sys_download_done, fileName,
mContext.getResources().getString(R.string.download_notification_failed));
« 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