From bc5cc75c302eb49d15258155fc6f672fcbd62842 Mon Sep 17 00:00:00 2001 From: Kristian Monsen Date: Wed, 2 Mar 2011 13:14:03 +0000 Subject: Downloads from incognito tabs need to use the correct cookie Change-Id: Iee012fe4a32dd51b8a59763b9ceab1e7dbde5246 --- src/com/android/browser/DownloadHandler.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/com/android/browser/DownloadHandler.java') diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java index 4903a4166..17ad3206c 100644 --- a/src/com/android/browser/DownloadHandler.java +++ b/src/com/android/browser/DownloadHandler.java @@ -53,9 +53,11 @@ 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 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) { + String userAgent, String contentDisposition, String mimetype, + 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 @@ -93,7 +95,7 @@ public class DownloadHandler { } } onDownloadStartNoStream(activity, url, userAgent, contentDisposition, - mimetype); + mimetype, privateBrowsing); } // This is to work around the fact that java.net.URI throws Exceptions @@ -134,10 +136,11 @@ 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 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) { + String mimetype, boolean privateBrowsing) { String filename = URLUtil.guessFileName(url, contentDisposition, mimetype); @@ -198,7 +201,7 @@ public class DownloadHandler { request.setDescription(webAddress.getHost()); // XXX: Have to use the old url since the cookies were stored using the // old percent-encoded url. - String cookies = CookieManager.getInstance().getCookie(url); + String cookies = CookieManager.getInstance().getCookie(url, privateBrowsing); request.addRequestHeader("cookie", cookies); request.setNotificationVisibility( DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); -- cgit v1.2.3