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

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: 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 f54de5dbcdf2d980ebc79b460e5a4cd4bf0de7dc..e6bf199c3b74f65097bf1ab606203c75f5edfa7e 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -177,27 +177,28 @@ void ChromeResourceDispatcherHostDelegate::DownloadStarting(
int child_id,
int route_id,
int request_id,
- bool is_new_request,
+ bool from_web,
ScopedVector<content::ResourceThrottle>* throttles) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id));
+ // If it's from the web, we don't trust it, so we push the throttle on.
+ if (from_web) {
darin (slow to review) 2012/05/12 18:23:08 elsewhere, we use "content-initiated" versus "brow
Randy Smith (Not in Mondays) 2012/05/12 19:56:37 Done.
+ 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 safe
darin (slow to review) 2012/05/12 18:23:08 nit: this comment should be changed to say "and ad
Randy Smith (Not in Mondays) 2012/05/12 19:56:37 Done.
- // 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) {
+ // browsing resource throttle already so no need to add it again.
+ if (!request->is_pending()) {
darin (slow to review) 2012/05/12 18:23:08 Definitely OK to make this change. I had this on
Randy Smith (Not in Mondays) 2012/05/12 19:56:37 Done.
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