summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authornileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 10:33:56 +0000
committernileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 10:33:56 +0000
commit8d6be6b2415793b58414a37f034560e5614443ae (patch)
treec7dfa031e6ef07bc27f64581259750eea1e578f6 /content
parent6bda9633b9c24dbb5f4529586fc3317d111dd3f7 (diff)
downloadchromium_src-8d6be6b2415793b58414a37f034560e5614443ae.zip
chromium_src-8d6be6b2415793b58414a37f034560e5614443ae.tar.gz
chromium_src-8d6be6b2415793b58414a37f034560e5614443ae.tar.bz2
Android: Use a ResourceThrottle to intercept GET downloads.
Earlier we used to pass all the relevant bits to WebContentsDelegate::CanDownload This also allows for DownloadRequestLimiter to work on Android (show the infobar when multiple downloads are initiated from a page) BUG= Review URL: https://chromiumcodereview.appspot.com/13649009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192740 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/android/download_controller_android_impl.cc20
-rw-r--r--content/browser/android/download_controller_android_impl.h2
-rw-r--r--content/public/browser/android/download_controller_android.h5
3 files changed, 11 insertions, 16 deletions
diff --git a/content/browser/android/download_controller_android_impl.cc b/content/browser/android/download_controller_android_impl.cc
index 2ade0d0..d8f5d91 100644
--- a/content/browser/android/download_controller_android_impl.cc
+++ b/content/browser/android/download_controller_android_impl.cc
@@ -79,10 +79,8 @@ void DownloadControllerAndroidImpl::Init(JNIEnv* env, jobject obj) {
}
void DownloadControllerAndroidImpl::CreateGETDownload(
- RenderViewHost* render_view_host,
- int request_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- int render_process_id = render_view_host->GetProcess()->GetID();
+ int render_process_id, int render_view_id, int request_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
GlobalRequestID global_id(render_process_id, request_id);
// We are yielding the UI thread and render_view_host may go away by
@@ -91,14 +89,12 @@ void DownloadControllerAndroidImpl::CreateGETDownload(
GetDownloadInfoCB cb = base::Bind(
&DownloadControllerAndroidImpl::StartAndroidDownload,
base::Unretained(this), render_process_id,
- render_view_host->GetRoutingID());
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(
- &DownloadControllerAndroidImpl::PrepareDownloadInfo,
- base::Unretained(this), global_id,
- base::Bind(&DownloadControllerAndroidImpl::StartDownloadOnUIThread,
- base::Unretained(this), cb)));
+ render_view_id);
+
+ PrepareDownloadInfo(
+ global_id,
+ base::Bind(&DownloadControllerAndroidImpl::StartDownloadOnUIThread,
+ base::Unretained(this), cb));
}
void DownloadControllerAndroidImpl::PrepareDownloadInfo(
diff --git a/content/browser/android/download_controller_android_impl.h b/content/browser/android/download_controller_android_impl.h
index 6dc87e2..b0917fb 100644
--- a/content/browser/android/download_controller_android_impl.h
+++ b/content/browser/android/download_controller_android_impl.h
@@ -75,7 +75,7 @@ class DownloadControllerAndroidImpl : public DownloadControllerAndroid,
virtual ~DownloadControllerAndroidImpl();
// DownloadControllerAndroid implementation.
- virtual void CreateGETDownload(RenderViewHost* source,
+ virtual void CreateGETDownload(int render_process_id, int render_view_id,
int request_id) OVERRIDE;
virtual void OnPostDownloadStarted(DownloadItem* download_item) OVERRIDE;
diff --git a/content/public/browser/android/download_controller_android.h b/content/public/browser/android/download_controller_android.h
index df0470e..b413205 100644
--- a/content/public/browser/android/download_controller_android.h
+++ b/content/public/browser/android/download_controller_android.h
@@ -9,8 +9,6 @@
namespace content {
class DownloadItem;
-class RenderViewHost;
-class WebContents;
// Interface to request GET downloads and send notifications for POST
// downloads.
@@ -21,7 +19,8 @@ class CONTENT_EXPORT DownloadControllerAndroid {
// Starts a new download request with Android. Should be called on the
// UI thread.
- virtual void CreateGETDownload(RenderViewHost* source, int request_id) = 0;
+ virtual void CreateGETDownload(int render_process_id, int render_view_id,
+ int request_id) = 0;
// Should be called when a POST download is started. Notifies the embedding
// app about the download. Should be called on the UI thread.