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

Unified Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 2900563002: Network service: Safe browsing check for sub-resources from renderer. (Closed)
Patch Set: . Created 3 years, 7 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: chrome/renderer/chrome_content_renderer_client.cc
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 51e8e616838f365f3447c388de5b5f6caa004056..b8639b9f06c627c6046f4dc2dd286a0b6eb40b48 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -57,6 +57,7 @@
#include "chrome/renderer/prerender/prerender_helper.h"
#include "chrome/renderer/prerender/prerenderer_client.h"
#include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
+#include "chrome/renderer/safe_browsing/safe_browsing_url_loader_throttle.h"
#include "chrome/renderer/searchbox/search_bouncer.h"
#include "chrome/renderer/searchbox/searchbox.h"
#include "chrome/renderer/searchbox/searchbox_extension.h"
@@ -106,6 +107,7 @@
#include "ppapi/shared_impl/ppapi_switches.h"
#include "printing/features/features.h"
#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/WebKit/public/platform/URLConversion.h"
#include "third_party/WebKit/public/platform/WebCache.h"
#include "third_party/WebKit/public/platform/WebCachePolicy.h"
@@ -1194,7 +1196,8 @@ bool ChromeContentRendererClient::WillSendRequest(
WebLocalFrame* frame,
ui::PageTransition transition_type,
const blink::WebURL& url,
- GURL* new_url) {
+ GURL* new_url,
+ std::vector<std::unique_ptr<content::URLLoaderThrottle>>* throttles) {
// Check whether the request should be allowed. If not allowed, we reset the
// URL to something invalid to prevent the request and cause an error.
#if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -1204,6 +1207,18 @@ bool ChromeContentRendererClient::WillSendRequest(
}
#endif
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNetworkService)) {
+ if (!safe_browsing_) {
+ RenderThread::Get()->GetConnector()->BindInterface(
+ content::mojom::kBrowserServiceName, &safe_browsing_);
+ }
+ RenderFrame* render_frame = content::RenderFrame::FromWebFrame(frame);
+ throttles->push_back(
+ base::MakeUnique<safe_browsing::SafeBrowsingURLLoaderThrottle>(
+ safe_browsing_.get(), render_frame->GetRoutingID()));
+ }
+
if (!url.ProtocolIs(chrome::kChromeSearchScheme))
return false;

Powered by Google App Engine
This is Rietveld 408576698