summaryrefslogtreecommitdiffstats
path: root/chrome/browser/android/intercept_download_resource_throttle.cc
diff options
context:
space:
mode:
authorqinmin <qinmin@chromium.org>2016-02-25 16:24:21 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-26 00:25:38 +0000
commitd888e48bbc95627822d5fc10913e245a33e2db77 (patch)
treed2d7e60c2b5c29361b0eddf08e11159f3fe89f0b /chrome/browser/android/intercept_download_resource_throttle.cc
parentd9950d124acec85375d5b2eb37ff9c86c8d13e63 (diff)
downloadchromium_src-d888e48bbc95627822d5fc10913e245a33e2db77.zip
chromium_src-d888e48bbc95627822d5fc10913e245a33e2db77.tar.gz
chromium_src-d888e48bbc95627822d5fc10913e245a33e2db77.tar.bz2
add a flag to enable/disable download interception on android
Currently some of the download are passed to Android DownloadManager. We might change that behavior in the future. This CL adds a flag to allow us to toggle that behavior. Chrome flag and finch flag "EnableDownloadInterception" are added to allow locally/remotely set/unset the flag BUG=545640 Review URL: https://codereview.chromium.org/1692693003 Cr-Commit-Position: refs/heads/master@{#377724}
Diffstat (limited to 'chrome/browser/android/intercept_download_resource_throttle.cc')
-rw-r--r--chrome/browser/android/intercept_download_resource_throttle.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/android/intercept_download_resource_throttle.cc b/chrome/browser/android/intercept_download_resource_throttle.cc
index 1592233..4f5662f 100644
--- a/chrome/browser/android/intercept_download_resource_throttle.cc
+++ b/chrome/browser/android/intercept_download_resource_throttle.cc
@@ -4,7 +4,9 @@
#include "chrome/browser/android/intercept_download_resource_throttle.h"
+#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
+#include "chrome/browser/android/chrome_feature_list.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"
@@ -41,6 +43,11 @@ void RecordInterceptFailureReasons(
namespace chrome {
+// static
+bool InterceptDownloadResourceThrottle::IsDownloadInterceptionEnabled() {
+ return base::FeatureList::IsEnabled(chrome::android::kSystemDownloadManager);
+}
+
InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle(
net::URLRequest* request,
int render_process_id,
@@ -64,6 +71,9 @@ const char* InterceptDownloadResourceThrottle::GetNameForLogging() const {
}
void InterceptDownloadResourceThrottle::ProcessDownloadRequest() {
+ if (!IsDownloadInterceptionEnabled())
+ return;
+
if (request_->url_chain().empty()) {
RecordInterceptFailureReasons(EMPTY_URL);
return;