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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/DownloadController.java

Issue 152683003: Pass the filename obtained from content-disposition header for download (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed some comments Created 6 years, 10 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 unified diff | Download patch
« no previous file with comments | « content/browser/android/download_controller_android_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 8
9 import org.chromium.base.CalledByNative; 9 import org.chromium.base.CalledByNative;
10 import org.chromium.base.JNINamespace; 10 import org.chromium.base.JNINamespace;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 /** 61 /**
62 * Notifies the download delegate of a new GET download and passes all the i nformation 62 * Notifies the download delegate of a new GET download and passes all the i nformation
63 * needed to download the file. 63 * needed to download the file.
64 * 64 *
65 * The download delegate is expected to handle the download. 65 * The download delegate is expected to handle the download.
66 */ 66 */
67 @CalledByNative 67 @CalledByNative
68 public void newHttpGetDownload(ContentViewCore view, String url, 68 public void newHttpGetDownload(ContentViewCore view, String url,
69 String userAgent, String contentDisposition, String mimeType, 69 String userAgent, String contentDisposition, String mimeType,
70 String cookie, String referer, long contentLength) { 70 String cookie, String referer, String filename, long contentLength) {
71 ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView( view); 71 ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView( view);
72 72
73 if (downloadDelegate != null) { 73 if (downloadDelegate != null) {
74 DownloadInfo downloadInfo = new DownloadInfo.Builder() 74 DownloadInfo downloadInfo = new DownloadInfo.Builder()
75 .setUrl(url) 75 .setUrl(url)
76 .setUserAgent(userAgent) 76 .setUserAgent(userAgent)
77 .setContentDisposition(contentDisposition) 77 .setContentDisposition(contentDisposition)
78 .setMimeType(mimeType) 78 .setMimeType(mimeType)
79 .setCookie(cookie) 79 .setCookie(cookie)
80 .setReferer(referer) 80 .setReferer(referer)
81 .setFileName(filename)
81 .setContentLength(contentLength) 82 .setContentLength(contentLength)
82 .setIsGETRequest(true) 83 .setIsGETRequest(true)
83 .build(); 84 .build();
84 downloadDelegate.requestHttpGetDownload(downloadInfo); 85 downloadDelegate.requestHttpGetDownload(downloadInfo);
85 } 86 }
86 } 87 }
87 88
88 /** 89 /**
89 * Notifies the download delegate that a new download has started. This can 90 * Notifies the download delegate that a new download has started. This can
90 * be either a POST download or a GET download with authentication. 91 * be either a POST download or a GET download with authentication.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 int downloadId) { 159 int downloadId) {
159 ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView( view); 160 ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView( view);
160 if (downloadDelegate != null) { 161 if (downloadDelegate != null) {
161 downloadDelegate.onDangerousDownload(filename, downloadId); 162 downloadDelegate.onDangerousDownload(filename, downloadId);
162 } 163 }
163 } 164 }
164 165
165 // native methods 166 // native methods
166 private native void nativeInit(); 167 private native void nativeInit();
167 } 168 }
OLDNEW
« no previous file with comments | « content/browser/android/download_controller_android_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698