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

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

Issue 2013643002: Fix a crash when download a DRM file through context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/ChromeDownloadDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
index 5fcd130907df5b836c77eef213e19abef85bd011..7921771a81372d8c25470dd2dacad21928ac22b3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
@@ -19,6 +19,7 @@ import android.text.TextUtils;
import android.util.Pair;
import android.view.View;
import android.webkit.MimeTypeMap;
+import android.webkit.URLUtil;
import android.widget.TextView;
import org.chromium.base.Log;
@@ -595,8 +596,11 @@ public class ChromeDownloadDelegate implements ContentViewDownloadDelegate {
// OMA downloads have extension "dm" or "dd". For the latter, it
// can be handled when native download completes.
if (path != null && (path.endsWith(".dm"))) {
- final DownloadInfo downloadInfo = new DownloadInfo.Builder().setUrl(url).build();
if (mTab == null) return true;
+ String fileName = URLUtil.guessFileName(
+ url, null, OMADownloadHandler.OMA_DRM_MESSAGE_MIME);
+ final DownloadInfo downloadInfo =
+ new DownloadInfo.Builder().setUrl(url).setFileName(fileName).build();
WindowAndroid window = mTab.getWindowAndroid();
if (window.hasPermission(permission.WRITE_EXTERNAL_STORAGE)) {
onDownloadStartNoStream(downloadInfo);
« 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