Chromium Code Reviews| 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 0f8a31b584d86bd7990de5e7977ffe6e44236d9b..f45e77d5cc14a62e259b928a276de4dc5d80ba34 100644 |
| --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc |
| +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc |
| @@ -92,6 +92,8 @@ |
| #endif |
| #if BUILDFLAG(ANDROID_JAVA_UI) |
| +#include "base/command_line.h" |
| +#include "base/metrics/field_trial.h" |
| #include "chrome/browser/android/intercept_download_resource_throttle.h" |
| #endif |
| @@ -268,6 +270,15 @@ void AppendComponentUpdaterThrottles( |
| } |
| #endif // !defined(DISABLE_NACL) |
| +#if BUILDFLAG(ANDROID_JAVA_UI) |
| +const char kDownloadInterception[] = "EnableDownloadInterception"; |
| + |
| +bool IsDownloadInterceptionEnabled() { |
| + return base::StartsWith( |
| + base::FieldTrialList::FindFullName(kDownloadInterception), "Enabled", |
| + base::CompareCase::INSENSITIVE_ASCII); |
|
asanka
2016/02/11 22:49:20
Let's move these out to a separate file.
qinmin
2016/02/12 00:31:56
Done. Moved to InterceptDownloadResourceThrottle c
|
| +} |
| +#endif // BUILDFLAG(ANDROID_JAVA_UI) |
| } // namespace |
| ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate() |
| @@ -418,9 +429,12 @@ void ChromeResourceDispatcherHostDelegate::DownloadStarting( |
| download_request_limiter_, info->GetWebContentsGetterForRequest(), |
| request->url(), request->method())); |
| #if BUILDFLAG(ANDROID_JAVA_UI) |
| - throttles->push_back( |
| - new chrome::InterceptDownloadResourceThrottle( |
| - request, child_id, route_id, request_id)); |
| + if (IsDownloadInterceptionEnabled() || |
| + base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableDownloadInterception)) { |
|
asanka
2016/02/11 22:49:20
Why is disabling the default?
Also, if the featur
qinmin
2016/02/12 00:31:56
Done. Now the remote server will disable download
|
| + throttles->push_back(new chrome::InterceptDownloadResourceThrottle( |
| + request, child_id, route_id, request_id)); |
| + } |
| #endif |
| } |