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

Unified Diff: chrome/browser/android/intercept_download_resource_throttle.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 side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698