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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 1692693003: add a flag to enable/disable download interception on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: allow server trial to be overriden Created 4 years, 10 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 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 <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); 411 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id));
412 412
413 // If it's from the web, we don't trust it, so we push the throttle on. 413 // If it's from the web, we don't trust it, so we push the throttle on.
414 if (is_content_initiated) { 414 if (is_content_initiated) {
415 const content::ResourceRequestInfo* info = 415 const content::ResourceRequestInfo* info =
416 content::ResourceRequestInfo::ForRequest(request); 416 content::ResourceRequestInfo::ForRequest(request);
417 throttles->push_back(new DownloadResourceThrottle( 417 throttles->push_back(new DownloadResourceThrottle(
418 download_request_limiter_, info->GetWebContentsGetterForRequest(), 418 download_request_limiter_, info->GetWebContentsGetterForRequest(),
419 request->url(), request->method())); 419 request->url(), request->method()));
420 #if BUILDFLAG(ANDROID_JAVA_UI) 420 #if BUILDFLAG(ANDROID_JAVA_UI)
421 throttles->push_back( 421 if (chrome::InterceptDownloadResourceThrottle::
svaldez 2016/02/12 15:21:19 Consider getting rid of the check here, and instea
qinmin 2016/02/12 17:27:00 Done. However, there is a very tiny performance hi
422 new chrome::InterceptDownloadResourceThrottle( 422 IsDownloadInterceptionEnabled()) {
423 request, child_id, route_id, request_id)); 423 throttles->push_back(new chrome::InterceptDownloadResourceThrottle(
424 request, child_id, route_id, request_id));
425 }
424 #endif 426 #endif
425 } 427 }
426 428
427 // If this isn't a new request, we've seen this before and added the standard 429 // If this isn't a new request, we've seen this before and added the standard
428 // resource throttles already so no need to add it again. 430 // resource throttles already so no need to add it again.
429 if (!request->is_pending()) { 431 if (!request->is_pending()) {
430 AppendStandardResourceThrottles(request, 432 AppendStandardResourceThrottles(request,
431 resource_context, 433 resource_context,
432 content::RESOURCE_TYPE_MAIN_FRAME, 434 content::RESOURCE_TYPE_MAIN_FRAME,
433 throttles); 435 throttles);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); 731 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request);
730 return false; 732 return false;
731 } 733 }
732 734
733 // static 735 // static
734 void ChromeResourceDispatcherHostDelegate:: 736 void ChromeResourceDispatcherHostDelegate::
735 SetExternalProtocolHandlerDelegateForTesting( 737 SetExternalProtocolHandlerDelegateForTesting(
736 ExternalProtocolHandler::Delegate* delegate) { 738 ExternalProtocolHandler::Delegate* delegate) {
737 g_external_protocol_handler_delegate = delegate; 739 g_external_protocol_handler_delegate = delegate;
738 } 740 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698