summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/Controller.java
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-11-18 15:16:27 -0500
committerLeon Scroggins <scroggo@google.com>2010-11-19 10:14:24 -0500
commit63c0266b5d1fca4df859fe4fa3a9555d0783a2b6 (patch)
tree9d13c00d9278d4804409201d783000983e71bfc5 /src/com/android/browser/Controller.java
parentf47d0af5b694e1f0113942c07a8659d58518acc8 (diff)
downloadpackages_apps_browser-63c0266b5d1fca4df859fe4fa3a9555d0783a2b6.zip
packages_apps_browser-63c0266b5d1fca4df859fe4fa3a9555d0783a2b6.tar.gz
packages_apps_browser-63c0266b5d1fca4df859fe4fa3a9555d0783a2b6.tar.bz2
Move download requests to the background.
Bug:3189668 Do not create a DownloadHandler since the methods can all be static. Do not pass the length to DownloadHandler, since it is no longer used. Change-Id: I280160f62906d1acb263b45fde57062210005a0a
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r--src/com/android/browser/Controller.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index caaa2c2..63f104a 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -139,7 +139,6 @@ public class Controller
private UrlHandler mUrlHandler;
private UploadHandler mUploadHandler;
private IntentHandler mIntentHandler;
- private DownloadHandler mDownloadHandler;
private PageDialogsHandler mPageDialogsHandler;
private NetworkStateHandler mNetworkHandler;
@@ -213,7 +212,6 @@ public class Controller
mUrlHandler = new UrlHandler(this);
mIntentHandler = new IntentHandler(mActivity, this);
- mDownloadHandler = new DownloadHandler(mActivity);
mPageDialogsHandler = new PageDialogsHandler(mActivity, this);
PowerManager pm = (PowerManager) mActivity
@@ -405,8 +403,8 @@ public class Controller
break;
case R.id.save_link_context_menu_id:
case R.id.download_context_menu_id:
- mDownloadHandler
- .onDownloadStartNoStream(url, null, null, null, -1);
+ DownloadHandler.onDownloadStartNoStream(
+ mActivity, url, null, null, null);
break;
}
break;
@@ -909,8 +907,8 @@ public class Controller
@Override
public void onDownloadStart(Tab tab, String url, String userAgent,
String contentDisposition, String mimetype, long contentLength) {
- mDownloadHandler.onDownloadStart(url, userAgent, contentDisposition,
- mimetype, contentLength);
+ DownloadHandler.onDownloadStart(mActivity, url, userAgent,
+ contentDisposition, mimetype);
if (tab.getWebView().copyBackForwardList().getSize() == 0) {
// This Tab was opened for the sole purpose of downloading a
// file. Remove it.
@@ -1271,7 +1269,7 @@ public class Controller
menu.findItem(R.id.view_image_context_menu_id).setIntent(
new Intent(Intent.ACTION_VIEW, Uri.parse(extra)));
menu.findItem(R.id.download_context_menu_id).
- setOnMenuItemClickListener(new Download(extra));
+ setOnMenuItemClickListener(new Download(mActivity, extra));
menu.findItem(R.id.set_wallpaper_context_menu_id).
setOnMenuItemClickListener(new WallpaperHandler(mActivity,
extra));
@@ -1862,15 +1860,18 @@ public class Controller
}
}
- private class Download implements OnMenuItemClickListener {
+ private static class Download implements OnMenuItemClickListener {
+ private Activity mActivity;
private String mText;
public boolean onMenuItemClick(MenuItem item) {
- mDownloadHandler.onDownloadStartNoStream(mText, null, null, null, -1);
+ DownloadHandler.onDownloadStartNoStream(mActivity, mText, null,
+ null, null);
return true;
}
- public Download(String toDownload) {
+ public Download(Activity activity, String toDownload) {
+ mActivity = activity;
mText = toDownload;
}
}