Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1893)

Unified Diff: content/browser/android/download_controller_android_impl.cc

Issue 1467563002: Use ResourceRequestInfo::GetWebContents in DownloadRequestLimiter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-contents-callback
Patch Set: Addressed davidben's comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/android/download_controller_android_impl.cc
diff --git a/content/browser/android/download_controller_android_impl.cc b/content/browser/android/download_controller_android_impl.cc
index be0b9018350d4c94026a1741fbcd453b6e6cddd1..c2d00e3b3c2fdaf09221000a65d9a9e059264ddd 100644
--- a/content/browser/android/download_controller_android_impl.cc
+++ b/content/browser/android/download_controller_android_impl.cc
@@ -181,16 +181,10 @@ void DownloadControllerAndroidImpl::CancelDeferredDownload(
}
void DownloadControllerAndroidImpl::AcquireFileAccessPermission(
- int render_process_id,
- int render_view_id,
+ WebContents* web_contents,
const DownloadControllerAndroid::AcquireFileAccessPermissionCallback& cb) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- WebContents* web_contents = GetWebContents(render_process_id, render_view_id);
- if (!web_contents) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE, base::Bind(cb, false));
- return;
- }
+ DCHECK(web_contents);
ScopedJavaLocalRef<jobject> view =
GetContentViewCoreFromWebContents(web_contents);
@@ -354,7 +348,7 @@ void DownloadControllerAndroidImpl::StartAndroidDownload(
}
AcquireFileAccessPermission(
- render_process_id, render_view_id,
+ web_contents,
base::Bind(&DownloadControllerAndroidImpl::StartAndroidDownloadInternal,
base::Unretained(this), render_process_id, render_view_id,
info));
@@ -530,9 +524,8 @@ void DownloadControllerAndroidImpl::StartContextMenuDownload(
int process_id = web_contents->GetRenderProcessHost()->GetID();
int routing_id = web_contents->GetRoutingID();
AcquireFileAccessPermission(
- process_id, routing_id,
- base::Bind(&CreateContextMenuDownload, process_id, routing_id, params,
- is_link, extra_headers));
+ web_contents, base::Bind(&CreateContextMenuDownload, process_id,
+ routing_id, params, is_link, extra_headers));
}
void DownloadControllerAndroidImpl::DangerousDownloadValidated(
« no previous file with comments | « content/browser/android/download_controller_android_impl.h ('k') | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698