diff options
Diffstat (limited to 'src/com/android/browser/DownloadHandler.java')
| -rw-r--r-- | src/com/android/browser/DownloadHandler.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java index 5517e590..dee10ae2 100644 --- a/src/com/android/browser/DownloadHandler.java +++ b/src/com/android/browser/DownloadHandler.java @@ -21,7 +21,6 @@ import android.app.AlertDialog; import android.app.DownloadManager; import android.content.ActivityNotFoundException; import android.content.ComponentName; -import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -53,11 +52,12 @@ public class DownloadHandler { * @param userAgent User agent of the downloading application. * @param contentDisposition Content-disposition http header, if present. * @param mimetype The mimetype of the content reported by the server + * @param referer The referer associated with the downloaded url * @param privateBrowsing If the request is coming from a private browsing tab. */ public static void onDownloadStart(Activity activity, String url, String userAgent, String contentDisposition, String mimetype, - boolean privateBrowsing) { + String referer, boolean privateBrowsing) { // if we're dealing wih A/V content that's not explicitly marked // for download, check if it's streamable. if (contentDisposition == null @@ -95,7 +95,7 @@ public class DownloadHandler { } } onDownloadStartNoStream(activity, url, userAgent, contentDisposition, - mimetype, privateBrowsing); + mimetype, referer, privateBrowsing); } // This is to work around the fact that java.net.URI throws Exceptions @@ -136,11 +136,12 @@ public class DownloadHandler { * @param userAgent User agent of the downloading application. * @param contentDisposition Content-disposition http header, if present. * @param mimetype The mimetype of the content reported by the server + * @param referer The referer associated with the downloaded url * @param privateBrowsing If the request is coming from a private browsing tab. */ /*package */ static void onDownloadStartNoStream(Activity activity, String url, String userAgent, String contentDisposition, - String mimetype, boolean privateBrowsing) { + String mimetype, String referer, boolean privateBrowsing) { String filename = URLUtil.guessFileName(url, contentDisposition, mimetype); @@ -204,6 +205,7 @@ public class DownloadHandler { String cookies = CookieManager.getInstance().getCookie(url, privateBrowsing); request.addRequestHeader("cookie", cookies); request.addRequestHeader("User-Agent", userAgent); + request.addRequestHeader("Referer", referer); request.setNotificationVisibility( DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); if (mimetype == null) { |
