Chromium Code Reviews| Index: android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc |
| diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc |
| index 6f63c9df9a9d520d1e2fb826f6b8b2ecb065c719..c14a0b3e0fe04cc16d844fe30a1ba359df198177 100644 |
| --- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc |
| +++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc |
| @@ -14,9 +14,12 @@ |
| #include "android_webview/browser/aw_resource_context.h" |
| #include "android_webview/browser/net/aw_web_resource_request.h" |
| #include "android_webview/browser/renderer_host/auto_login_parser.h" |
| +#include "android_webview/common/aw_switches.h" |
| #include "android_webview/common/url_constants.h" |
| +#include "base/command_line.h" |
|
sgurun-gerrit only
2017/01/16 15:11:19
see the note below, remove.
|
| #include "base/memory/scoped_vector.h" |
| #include "components/navigation_interception/intercept_navigation_delegate.h" |
| +#include "components/safe_browsing/base_resource_throttle.h" |
| #include "components/web_restrictions/browser/web_restrictions_resource_throttle.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/resource_dispatcher_host.h" |
| @@ -254,8 +257,10 @@ void AwResourceDispatcherHostDelegate::ResourceDispatcherHostCreated() { |
| } |
| AwResourceDispatcherHostDelegate::AwResourceDispatcherHostDelegate() |
| - : content::ResourceDispatcherHostDelegate() { |
| -} |
| + : content::ResourceDispatcherHostDelegate(), |
| + safebrowsing_support_enabled( |
|
sgurun-gerrit only
2017/01/16 15:11:19
see the note below, remove.
|
| + base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + ::switches::kWebViewEnableSafeBrowsingSupport)) {} |
| AwResourceDispatcherHostDelegate::~AwResourceDispatcherHostDelegate() { |
| } |
| @@ -271,6 +276,20 @@ void AwResourceDispatcherHostDelegate::RequestBeginning( |
| const content::ResourceRequestInfo* request_info = |
| content::ResourceRequestInfo::ForRequest(request); |
| + if (safebrowsing_support_enabled) { |
|
sgurun-gerrit only
2017/01/16 15:11:19
you are already checking for this in AwBrowserCont
timvolodine
2017/01/16 18:58:57
Without this guard we'll add a safebrowsing thrott
timvolodine
2017/01/16 19:01:56
Oh hold on, you probably meant throttle should be
|
| + content::ResourceThrottle* throttle = |
| + safe_browsing::BaseResourceThrottle::MaybeCreate( |
| + request, resource_type, |
| + AwBrowserContext::GetDefault()->GetSafeBrowsingDBManager(), |
| + AwBrowserContext::GetDefault()->GetSafeBrowsingUIManager()); |
| + if (throttle == nullptr) { |
| + // TODO(timvolodine) perhaps just DLOG |
| + LOG(WARNING) << "Failed creating safebrowsing throttle"; |
|
sgurun-gerrit only
2017/01/16 15:11:19
do a DLOG as this is expected fail mode for AOSP
timvolodine
2017/01/16 18:58:57
Done.
timvolodine
2017/01/16 22:42:00
Actually don't think this will be the fail mode on
|
| + } else { |
| + throttles->push_back(base::WrapUnique(throttle)); |
| + } |
| + } |
| + |
| // We always push the throttles here. Checking the existence of io_client |
| // is racy when a popup window is created. That is because RequestBeginning |
| // is called whether or not requests are blocked via BlockRequestForRoute() |