diff options
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/browser/DownloadTouchIcon.java | 13 | ||||
-rw-r--r-- | src/com/android/browser/FetchUrlMimeType.java | 7 | ||||
-rw-r--r-- | src/com/android/browser/Tab.java | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/com/android/browser/DownloadTouchIcon.java b/src/com/android/browser/DownloadTouchIcon.java index b5369ae..14404ff 100644 --- a/src/com/android/browser/DownloadTouchIcon.java +++ b/src/com/android/browser/DownloadTouchIcon.java @@ -23,15 +23,18 @@ import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.http.AndroidHttpClient; +import android.net.Proxy; import android.os.AsyncTask; import android.provider.Browser; import android.webkit.WebView; import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.params.HttpClientParams; +import org.apache.http.conn.params.ConnRouteParams; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -43,10 +46,12 @@ class DownloadTouchIcon extends AsyncTask<String, Void, Void> { private final String mOriginalUrl; private final String mUrl; private final String mUserAgent; + private final BrowserActivity mActivity; /* package */ Tab mTab; - public DownloadTouchIcon(Tab tab, ContentResolver cr, WebView view) { + public DownloadTouchIcon(Tab tab, BrowserActivity activity, ContentResolver cr, WebView view) { mTab = tab; + mActivity = activity; mContentResolver = cr; // Store these in case they change. mOriginalUrl = view.getOriginalUrl(); @@ -56,6 +61,7 @@ class DownloadTouchIcon extends AsyncTask<String, Void, Void> { public DownloadTouchIcon(ContentResolver cr, String url) { mTab = null; + mActivity = null; mContentResolver = cr; mOriginalUrl = null; mUrl = url; @@ -71,6 +77,11 @@ class DownloadTouchIcon extends AsyncTask<String, Void, Void> { AndroidHttpClient client = AndroidHttpClient.newInstance( mUserAgent); + HttpHost httpHost = Proxy.getPreferredHttpHost(mActivity, url); + if (httpHost != null) { + ConnRouteParams.setDefaultProxy(client.getParams(), httpHost); + } + HttpGet request = new HttpGet(url); // Follow redirects diff --git a/src/com/android/browser/FetchUrlMimeType.java b/src/com/android/browser/FetchUrlMimeType.java index 1e4debf..9bd0cf9 100644 --- a/src/com/android/browser/FetchUrlMimeType.java +++ b/src/com/android/browser/FetchUrlMimeType.java @@ -17,12 +17,15 @@ package com.android.browser; import android.content.ContentValues; +import android.net.Proxy; import android.net.Uri; import android.net.http.AndroidHttpClient; +import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.Header; import org.apache.http.client.methods.HttpHead; +import org.apache.http.conn.params.ConnRouteParams; import java.io.IOException; @@ -67,6 +70,10 @@ class FetchUrlMimeType extends AsyncTask<ContentValues, String, String> { // seems ok with that. AndroidHttpClient client = AndroidHttpClient.newInstance( mValues.getAsString(Downloads.Impl.COLUMN_USER_AGENT)); + HttpHost httpHost = Proxy.getPreferredHttpHost(mActivity, uri); + if (httpHost != null) { + ConnRouteParams.setDefaultProxy(client.getParams(), httpHost); + } HttpHead request = new HttpHead(uri); String cookie = mValues.getAsString(Downloads.Impl.COLUMN_COOKIE_DATA); diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index d2fed22..5795b05 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -1035,7 +1035,7 @@ class Tab { } // Have only one async task at a time. if (mTouchIconLoader == null) { - mTouchIconLoader = new DownloadTouchIcon(Tab.this, cr, view); + mTouchIconLoader = new DownloadTouchIcon(Tab.this, mActivity, cr, view); mTouchIconLoader.execute(url); } } |