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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 int request_id, 412 int request_id,
413 bool is_content_initiated, 413 bool is_content_initiated,
414 bool must_download, 414 bool must_download,
415 ScopedVector<content::ResourceThrottle>* throttles) { 415 ScopedVector<content::ResourceThrottle>* throttles) {
416 BrowserThread::PostTask( 416 BrowserThread::PostTask(
417 BrowserThread::UI, FROM_HERE, 417 BrowserThread::UI, FROM_HERE,
418 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); 418 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id));
419 419
420 // If it's from the web, we don't trust it, so we push the throttle on. 420 // If it's from the web, we don't trust it, so we push the throttle on.
421 if (is_content_initiated) { 421 if (is_content_initiated) {
422 const content::ResourceRequestInfo* info =
423 content::ResourceRequestInfo::ForRequest(request);
422 throttles->push_back(new DownloadResourceThrottle( 424 throttles->push_back(new DownloadResourceThrottle(
423 download_request_limiter_, child_id, route_id, request->url(), 425 download_request_limiter_, info->GetWebContentsGetterForRequest(),
424 request->method())); 426 request->url(), request->method()));
425 #if defined(OS_ANDROID) 427 #if defined(OS_ANDROID)
426 throttles->push_back( 428 throttles->push_back(
427 new chrome::InterceptDownloadResourceThrottle( 429 new chrome::InterceptDownloadResourceThrottle(
428 request, child_id, route_id, request_id)); 430 request, child_id, route_id, request_id));
429 #endif 431 #endif
430 } 432 }
431 433
432 // If this isn't a new request, we've seen this before and added the standard 434 // If this isn't a new request, we've seen this before and added the standard
433 // resource throttles already so no need to add it again. 435 // resource throttles already so no need to add it again.
434 if (!request->is_pending()) { 436 if (!request->is_pending()) {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); 739 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request);
738 return false; 740 return false;
739 } 741 }
740 742
741 // static 743 // static
742 void ChromeResourceDispatcherHostDelegate:: 744 void ChromeResourceDispatcherHostDelegate::
743 SetExternalProtocolHandlerDelegateForTesting( 745 SetExternalProtocolHandlerDelegateForTesting(
744 ExternalProtocolHandler::Delegate* delegate) { 746 ExternalProtocolHandler::Delegate* delegate) {
745 g_external_protocol_handler_delegate = delegate; 747 g_external_protocol_handler_delegate = delegate;
746 } 748 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698