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

Unified Diff: android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc

Issue 2615393002: Implement the basics for Safebrowsing for WebView (Closed)
Patch Set: more cleanup Created 3 years, 11 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: 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..983f3c0d4404eed2ae4f7430961833074b85e935 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
@@ -17,6 +17,7 @@
#include "android_webview/common/url_constants.h"
#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"
@@ -271,6 +272,17 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
const content::ResourceRequestInfo* request_info =
content::ResourceRequestInfo::ForRequest(request);
+ content::ResourceThrottle* throttle =
+ safe_browsing::BaseResourceThrottle::MaybeCreate(
+ request, resource_type,
+ AwBrowserContext::GetDefault()->GetSafeBrowsingDBManager(),
+ AwBrowserContext::GetDefault()->GetSafeBrowsingUIManager());
+ if (throttle == nullptr) {
+ LOG(WARNING) << "Failed creating safebrowsing throttle";
+ } 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()

Powered by Google App Engine
This is Rietveld 408576698