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

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

Issue 2635693002: [WebView] initial webview-side implementation of safebrowsing (Closed)
Patch Set: rename lock, add crbug comment 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..48ab864ba45301feb3c2c92e0d842df5e81d698c 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,8 @@
#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/safe_browsing_db/safe_browsing_api_handler.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 +256,7 @@ void AwResourceDispatcherHostDelegate::ResourceDispatcherHostCreated() {
}
AwResourceDispatcherHostDelegate::AwResourceDispatcherHostDelegate()
- : content::ResourceDispatcherHostDelegate() {
-}
+ : content::ResourceDispatcherHostDelegate() {}
AwResourceDispatcherHostDelegate::~AwResourceDispatcherHostDelegate() {
}
@@ -271,6 +272,20 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
const content::ResourceRequestInfo* request_info =
content::ResourceRequestInfo::ForRequest(request);
+ if (safe_browsing::SafeBrowsingApiHandler::GetInstance()) {
+ content::ResourceThrottle* throttle =
+ safe_browsing::BaseResourceThrottle::MaybeCreate(
+ request, resource_type,
+ AwBrowserContext::GetDefault()->GetSafeBrowsingDBManager(),
+ AwBrowserContext::GetDefault()->GetSafeBrowsingUIManager());
+ if (throttle == nullptr) {
+ // Should not happen
+ DLOG(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