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

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

Issue 2871123006: Missing webcontents shouldn't block download interception (Closed)
Patch Set: Created 3 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
Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadController.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadController.java
index d6b2790b0290e94f69e1754a099d5f91167dd74d..919426ef53e0590e3321c69c3ac4d61b47070a60 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadController.java
@@ -190,6 +190,40 @@ public class DownloadController {
builder.create().show();
}
+ /**
+ * Enqueue a request to download a file using Android DownloadManager.
+ * @param url Url to download.
+ * @param userAgent User agent to use.
+ * @param contentDisposition Content disposition of the request.
+ * @param mimeType MIME type.
+ * @param cookie Cookie to use.
+ * @param referrer Referrer to use.
+ */
+ @CalledByNative
+ private static void enqueueAndroidDownloadManagerRequest(String url, String userAgent,
+ String fileName, String mimeType, String cookie, String referrer) {
+ DownloadInfo downloadInfo = new DownloadInfo.Builder()
+ .setUrl(url)
+ .setUserAgent(userAgent)
+ .setFileName(fileName)
+ .setMimeType(mimeType)
+ .setCookie(cookie)
+ .setReferrer(referrer)
+ .setIsGETRequest(true)
+ .build();
+ enqueueDownloadManagerRequest(downloadInfo);
+ }
+
+ /**
+ * Enqueue a request to download a file using Android DownloadManager.
+ *
+ * @param info Download information about the download.
+ */
+ static void enqueueDownloadManagerRequest(final DownloadInfo info) {
David Trainor- moved to gerrit 2017/05/17 17:14:03 Should this have the same name as above?
qinmin 2017/05/17 17:50:12 There is an issue with our JNI generator if two fu
+ DownloadManagerService.getDownloadManagerService().enqueueDownloadManagerRequest(
+ new DownloadItem(true, info), true);
+ }
+
/**
* Called when a download is started.
*/

Powered by Google App Engine
This is Rietveld 408576698