Index: chrome/browser/android/intercept_download_resource_throttle.cc |
diff --git a/chrome/browser/android/intercept_download_resource_throttle.cc b/chrome/browser/android/intercept_download_resource_throttle.cc |
index 1592233f81895c4a8ad36a5e77f949d2378b0100..1cedf9e2c3b53a7a9440062f95cef26cedf166d7 100644 |
--- a/chrome/browser/android/intercept_download_resource_throttle.cc |
+++ b/chrome/browser/android/intercept_download_resource_throttle.cc |
@@ -4,7 +4,11 @@ |
#include "chrome/browser/android/intercept_download_resource_throttle.h" |
+#include "base/command_line.h" |
+#include "base/metrics/field_trial.h" |
#include "base/metrics/histogram_macros.h" |
+#include "base/strings/string_util.h" |
+#include "chrome/common/chrome_switches.h" |
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" |
#include "content/public/browser/android/download_controller_android.h" |
#include "content/public/browser/resource_controller.h" |
@@ -14,6 +18,9 @@ |
namespace { |
+// Finch flag to be passed in. |
+const char kDisableDownloadInterception[] = "DisableDownloadInterception"; |
+ |
// UMA histogram for tracking reasons that chrome fails to intercept the |
// download. Keep this in sync with MobileDownloadInterceptFailureReasons in |
// histograms.xml. |
@@ -41,6 +48,24 @@ void RecordInterceptFailureReasons( |
namespace chrome { |
+// static |
+bool InterceptDownloadResourceThrottle::IsDownloadInterceptionEnabled() { |
+ |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableDownloadInterception)) { |
+ return true; |
+ } |
+ |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableDownloadInterception)) { |
+ return false; |
+ } |
+ |
+ return !base::StartsWith( |
+ base::FieldTrialList::FindFullName(kDisableDownloadInterception), |
+ "Enabled", base::CompareCase::INSENSITIVE_ASCII); |
+} |
+ |
InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle( |
net::URLRequest* request, |
int render_process_id, |