diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2010-07-16 14:06:47 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2010-07-16 14:06:47 -0700 |
commit | e7c06a6eb880bec19bfe43a0ac09ca9c6d20c049 (patch) | |
tree | 7da3d8e9502fcacf77870a2a9112609bacc3091a /src/com/android | |
parent | 539fde6807f0d9a5a86dc09ce362a2dc9ba0bc10 (diff) | |
parent | d159ec534823b87f9896843e95912b0df8c27e16 (diff) | |
download | packages_apps_Browser-e7c06a6eb880bec19bfe43a0ac09ca9c6d20c049.zip packages_apps_Browser-e7c06a6eb880bec19bfe43a0ac09ca9c6d20c049.tar.gz packages_apps_Browser-e7c06a6eb880bec19bfe43a0ac09ca9c6d20c049.tar.bz2 |
merge from open-source master
Change-Id: Idcbf7a3a8e9c171b62c210ad174b63dfed3ed42c
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); } } |