Commit d456dd0b authored by Tim Volodine's avatar Tim Volodine Committed by Commit Bot

[AW NS] Avoid redundant onDownloadStart callbacks when network service is disabled.

When the network service is disabled the Android WebView's
DownloadListener.onDownloadStart() callback gets executed twice
for the same url.

This is due to the new code path (via AwDownloadManagerDelegate)
which is intended to be executed when the network service is
enabled is also run when it is disabled. This patch ensures that
the new code path only runs when the network service is enabled.

BUG=961264,841556

Change-Id: Ieec4a330d9d04173cf12ba23c90d9c37df08af47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1638526Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Commit-Queue: Tim Volodine <timvolodine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665529}
parent 118d38df
......@@ -13,6 +13,7 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "services/network/public/cpp/features.h"
namespace android_webview {
......@@ -71,6 +72,9 @@ bool AwDownloadManagerDelegate::InterceptDownloadIfApplicable(
const std::string& request_origin,
int64_t content_length,
content::WebContents* web_contents) {
if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
return false;
if (!web_contents)
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment