| 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 4fbac3522c2a4df86c526b8f62de0120da812191..56398e388f5fdf08935851abb679db0b0227890f 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
|
| @@ -129,6 +129,7 @@ class IoThreadClientThrottle : public content::ResourceThrottle {
|
| int new_render_frame_id);
|
| bool MaybeBlockRequest();
|
| bool ShouldBlockRequest();
|
| + bool GetSafeBrowsingEnabled();
|
| int render_process_id() const { return render_process_id_; }
|
| int render_frame_id() const { return render_frame_id_; }
|
|
|
| @@ -216,6 +217,13 @@ bool IoThreadClientThrottle::MaybeBlockRequest() {
|
| return false;
|
| }
|
|
|
| +bool IoThreadClientThrottle::GetSafeBrowsingEnabled() {
|
| + std::unique_ptr<AwContentsIoThreadClient> io_client = GetIoThreadClient();
|
| + if (!io_client)
|
| + return false;
|
| + return io_client->GetSafeBrowsingEnabled();
|
| +}
|
| +
|
| bool IoThreadClientThrottle::ShouldBlockRequest() {
|
| std::unique_ptr<AwContentsIoThreadClient> io_client = GetIoThreadClient();
|
| if (!io_client)
|
| @@ -283,7 +291,12 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
|
| const content::ResourceRequestInfo* request_info =
|
| content::ResourceRequestInfo::ForRequest(request);
|
|
|
| - if (AwSafeBrowsingConfigHelper::GetSafeBrowsingEnabled()) {
|
| + std::unique_ptr<IoThreadClientThrottle> ioThreadThrottle =
|
| + base::MakeUnique<IoThreadClientThrottle>(request_info->GetChildID(),
|
| + request_info->GetRenderFrameID(),
|
| + request);
|
| +
|
| + if (ioThreadThrottle->GetSafeBrowsingEnabled()) {
|
| content::ResourceThrottle* throttle =
|
| AwSafeBrowsingResourceThrottle::MaybeCreate(
|
| request, resource_type,
|
| @@ -302,8 +315,7 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
|
| // is called whether or not requests are blocked via BlockRequestForRoute()
|
| // however io_client may or may not be ready at the time depending on whether
|
| // webcontents is created.
|
| - throttles->push_back(base::MakeUnique<IoThreadClientThrottle>(
|
| - request_info->GetChildID(), request_info->GetRenderFrameID(), request));
|
| + throttles->push_back(std::move(ioThreadThrottle));
|
|
|
| bool is_main_frame = resource_type == content::RESOURCE_TYPE_MAIN_FRAME;
|
| if (!is_main_frame)
|
|
|