diff options
author | Selim Gurun <sgurun@google.com> | 2012-08-29 13:08:13 -0700 |
---|---|---|
committer | Selim Gurun <sgurun@google.com> | 2012-08-29 13:08:13 -0700 |
commit | 0b3d66fc2275fb5270cb7166cc991be7dc9d8ff7 (patch) | |
tree | 5ddaa951b49481b6162174d50da036baeda15930 /src/com/android/browser/DownloadHandler.java | |
parent | adb2b6554ff7670390a0acd5507dffe430a4cd0d (diff) | |
download | packages_apps_Browser-0b3d66fc2275fb5270cb7166cc991be7dc9d8ff7.zip packages_apps_Browser-0b3d66fc2275fb5270cb7166cc991be7dc9d8ff7.tar.gz packages_apps_Browser-0b3d66fc2275fb5270cb7166cc991be7dc9d8ff7.tar.bz2 |
Pass referer on download requests
Bug: 6662557
Change-Id: Ib7fdc4b3f1e0f7370631d8a222565faaee550bfb
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 5517e59..dee10ae 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) { |