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

Unified Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 10381122: Add flag to specify if explicitly requested download is from web. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to LKGR and integrated into DownloadUrlParams. Created 8 years, 7 months 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: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
index 92def35ac179459a90e16e00121884a1c5744e10..29fcd22f3d7dd1ba29240b731c148385d9b028e7 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -203,27 +203,28 @@ void ChromeResourceDispatcherHostDelegate::DownloadStarting(
int child_id,
int route_id,
int request_id,
- bool is_new_request,
+ bool is_content_initiated,
ScopedVector<content::ResourceThrottle>* throttles) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id));
- // If this isn't a new request, we've seen this before and added the safe
- // browsing resource throttle already so no need to add it again. This code
- // path is only hit for requests initiated through the browser, and not the
- // web, so no need to add the download throttle.
- if (is_new_request) {
+ // If it's from the web, we don't trust it, so we push the throttle on.
+ if (is_content_initiated) {
+ throttles->push_back(new DownloadResourceThrottle(
+ download_request_limiter_, child_id, route_id, request_id,
+ request->method()));
+ }
+
+ // If this isn't a new request, we've seen this before and added the standard
+ // resource throttles already so no need to add it again.
+ if (!request->is_pending()) {
AppendStandardResourceThrottles(request,
resource_context,
child_id,
route_id,
ResourceType::MAIN_FRAME,
throttles);
- } else {
- throttles->push_back(new DownloadResourceThrottle(
- download_request_limiter_, child_id, route_id, request_id,
- request->method()));
}
}

Powered by Google App Engine
This is Rietveld 408576698