| 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 351d35a985508162f152020cee1f22be9fe04bae..986d54df2f8feaeb91c490cd26289e7b4fba4698 100644
|
| --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
|
| @@ -26,6 +26,7 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_io_data.h"
|
| #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_android.h"
|
| +#include "chrome/browser/renderer_host/data_reduction_proxy_throttling_utils_android.h"
|
| #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h"
|
| #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h"
|
| #include "chrome/browser/safe_browsing/safe_browsing_service.h"
|
| @@ -488,14 +489,29 @@ void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
|
|
|
| // Insert either safe browsing or data reduction proxy throttle at the front
|
| // of the list, so one of them gets to decide if the resource is safe.
|
| - content::ResourceThrottle* first_throttle = NULL;
|
| + bool need_safe_browsing_throttle = true;
|
| + content::ResourceThrottle* first_throttle = nullptr;
|
| #if defined(OS_ANDROID)
|
| - first_throttle = DataReductionProxyResourceThrottle::MaybeCreate(
|
| - request, resource_context, resource_type, safe_browsing_.get());
|
| + if (!IsResourceTypeFrame(resource_type)) {
|
| + first_throttle = DataReductionProxyResourceThrottle::MaybeCreate(
|
| + request, resource_context, safe_browsing_.get());
|
| + need_safe_browsing_throttle = first_throttle == nullptr;
|
| + } else {
|
| + ProfileIOData* io_data =
|
| + ProfileIOData::FromResourceContext(resource_context);
|
| + // Do not create a SafeBrowsingResourceThrottle if a
|
| + // DataReductionProxyNavigationThrottle will be created.
|
| + need_safe_browsing_throttle =
|
| + !data_reduction_proxy_throttling_utils::CanCreateThrottle(
|
| + io_data->IsOffTheRecord(), io_data->IsDataReductionProxyEnabled(),
|
| + request->url());
|
| + }
|
| #endif // defined(OS_ANDROID)
|
|
|
| #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE)
|
| - if (!first_throttle && io_data->safe_browsing_enabled()->GetValue()) {
|
| + if (need_safe_browsing_throttle &&
|
| + io_data->safe_browsing_enabled()->GetValue()) {
|
| + DCHECK(first_throttle == nullptr);
|
| first_throttle = SafeBrowsingResourceThrottle::MaybeCreate(
|
| request, resource_type, safe_browsing_.get());
|
| }
|
|
|