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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 2952583002: SafeBrowsing support for WebSocket (post-network-servicification) (Closed)
Patch Set: Remove useless DCHECKs Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h" 71 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h"
72 #include "components/dom_distiller/content/renderer/distillability_agent.h" 72 #include "components/dom_distiller/content/renderer/distillability_agent.h"
73 #include "components/dom_distiller/content/renderer/distiller_js_render_frame_ob server.h" 73 #include "components/dom_distiller/content/renderer/distiller_js_render_frame_ob server.h"
74 #include "components/dom_distiller/core/dom_distiller_switches.h" 74 #include "components/dom_distiller/core/dom_distiller_switches.h"
75 #include "components/dom_distiller/core/url_constants.h" 75 #include "components/dom_distiller/core/url_constants.h"
76 #include "components/error_page/common/localized_error.h" 76 #include "components/error_page/common/localized_error.h"
77 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" 77 #include "components/network_hints/renderer/prescient_networking_dispatcher.h"
78 #include "components/password_manager/content/renderer/credential_manager_client .h" 78 #include "components/password_manager/content/renderer/credential_manager_client .h"
79 #include "components/pdf/renderer/pepper_pdf_host.h" 79 #include "components/pdf/renderer/pepper_pdf_host.h"
80 #include "components/safe_browsing/renderer/threat_dom_details.h" 80 #include "components/safe_browsing/renderer/threat_dom_details.h"
81 #include "components/safe_browsing/renderer/websocket_sb_handshake_throttle.h"
81 #include "components/signin/core/common/profile_management_switches.h" 82 #include "components/signin/core/common/profile_management_switches.h"
82 #include "components/spellcheck/spellcheck_build_features.h" 83 #include "components/spellcheck/spellcheck_build_features.h"
83 #include "components/startup_metric_utils/common/startup_metric.mojom.h" 84 #include "components/startup_metric_utils/common/startup_metric.mojom.h"
84 #include "components/subresource_filter/content/renderer/subresource_filter_agen t.h" 85 #include "components/subresource_filter/content/renderer/subresource_filter_agen t.h"
85 #include "components/subresource_filter/content/renderer/unverified_ruleset_deal er.h" 86 #include "components/subresource_filter/content/renderer/unverified_ruleset_deal er.h"
86 #include "components/task_scheduler_util/renderer/initialization.h" 87 #include "components/task_scheduler_util/renderer/initialization.h"
87 #include "components/version_info/version_info.h" 88 #include "components/version_info/version_info.h"
88 #include "components/visitedlink/renderer/visitedlink_slave.h" 89 #include "components/visitedlink/renderer/visitedlink_slave.h"
89 #include "components/web_cache/renderer/web_cache_impl.h" 90 #include "components/web_cache/renderer/web_cache_impl.h"
90 #include "content/public/common/content_constants.h" 91 #include "content/public/common/content_constants.h"
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 1199
1199 return false; 1200 return false;
1200 } 1201 }
1201 1202
1202 bool ChromeContentRendererClient::WillSendRequest( 1203 bool ChromeContentRendererClient::WillSendRequest(
1203 WebLocalFrame* frame, 1204 WebLocalFrame* frame,
1204 ui::PageTransition transition_type, 1205 ui::PageTransition transition_type,
1205 const blink::WebURL& url, 1206 const blink::WebURL& url,
1206 std::vector<std::unique_ptr<content::URLLoaderThrottle>>* throttles, 1207 std::vector<std::unique_ptr<content::URLLoaderThrottle>>* throttles,
1207 GURL* new_url) { 1208 GURL* new_url) {
1208 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1209 if (UsingSafeBrowsingMojoService()) {
1209 switches::kEnableNetworkService)) {
1210 if (!safe_browsing_) {
1211 RenderThread::Get()->GetConnector()->BindInterface(
1212 content::mojom::kBrowserServiceName, &safe_browsing_);
1213 }
1214 RenderFrame* render_frame = content::RenderFrame::FromWebFrame(frame); 1210 RenderFrame* render_frame = content::RenderFrame::FromWebFrame(frame);
1215 throttles->push_back( 1211 throttles->push_back(
1216 base::MakeUnique<safe_browsing::RendererURLLoaderThrottle>( 1212 base::MakeUnique<safe_browsing::RendererURLLoaderThrottle>(
1217 safe_browsing_.get(), render_frame->GetRoutingID())); 1213 safe_browsing_.get(), render_frame->GetRoutingID()));
1218 } 1214 }
1219 1215
1220 // Check whether the request should be allowed. If not allowed, we reset the 1216 // Check whether the request should be allowed. If not allowed, we reset the
1221 // URL to something invalid to prevent the request and cause an error. 1217 // URL to something invalid to prevent the request and cause an error.
1222 #if BUILDFLAG(ENABLE_EXTENSIONS) 1218 #if BUILDFLAG(ENABLE_EXTENSIONS)
1223 if (ChromeExtensionsRendererClient::GetInstance()->WillSendRequest( 1219 if (ChromeExtensionsRendererClient::GetInstance()->WillSendRequest(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) 1299 #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS)
1304 bool ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted( 1300 bool ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted(
1305 const GURL& url, const std::set<std::string>& whitelist) { 1301 const GURL& url, const std::set<std::string>& whitelist) {
1306 const extensions::ExtensionSet* extension_set = 1302 const extensions::ExtensionSet* extension_set =
1307 extensions::RendererExtensionRegistry::Get()->GetMainThreadExtensionSet(); 1303 extensions::RendererExtensionRegistry::Get()->GetMainThreadExtensionSet();
1308 return chrome::IsExtensionOrSharedModuleWhitelisted(url, extension_set, 1304 return chrome::IsExtensionOrSharedModuleWhitelisted(url, extension_set,
1309 whitelist); 1305 whitelist);
1310 } 1306 }
1311 #endif 1307 #endif
1312 1308
1309 std::unique_ptr<blink::WebSocketHandshakeThrottle>
1310 ChromeContentRendererClient::CreateWebSocketHandshakeThrottle() {
1311 if (!UsingSafeBrowsingMojoService())
1312 return nullptr;
1313 return base::MakeUnique<safe_browsing::WebSocketSBHandshakeThrottle>(
1314 safe_browsing_.get());
1315 }
1316
1313 std::unique_ptr<blink::WebSpeechSynthesizer> 1317 std::unique_ptr<blink::WebSpeechSynthesizer>
1314 ChromeContentRendererClient::OverrideSpeechSynthesizer( 1318 ChromeContentRendererClient::OverrideSpeechSynthesizer(
1315 blink::WebSpeechSynthesizerClient* client) { 1319 blink::WebSpeechSynthesizerClient* client) {
1316 return base::MakeUnique<TtsDispatcher>(client); 1320 return base::MakeUnique<TtsDispatcher>(client);
1317 } 1321 }
1318 1322
1319 bool ChromeContentRendererClient::AllowPepperMediaStreamAPI( 1323 bool ChromeContentRendererClient::AllowPepperMediaStreamAPI(
1320 const GURL& url) { 1324 const GURL& url) {
1321 #if defined(OS_ANDROID) 1325 #if defined(OS_ANDROID)
1322 return false; 1326 return false;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 1597
1594 RecordYouTubeRewriteUMA(result); 1598 RecordYouTubeRewriteUMA(result);
1595 return corrected_url.ReplaceComponents(r); 1599 return corrected_url.ReplaceComponents(r);
1596 } 1600 }
1597 1601
1598 std::unique_ptr<base::TaskScheduler::InitParams> 1602 std::unique_ptr<base::TaskScheduler::InitParams>
1599 ChromeContentRendererClient::GetTaskSchedulerInitParams() { 1603 ChromeContentRendererClient::GetTaskSchedulerInitParams() {
1600 return task_scheduler_util:: 1604 return task_scheduler_util::
1601 GetRendererTaskSchedulerInitParamsFromCommandLine(); 1605 GetRendererTaskSchedulerInitParamsFromCommandLine();
1602 } 1606 }
1607
1608 bool ChromeContentRendererClient::UsingSafeBrowsingMojoService() {
1609 if (safe_browsing_)
1610 return true;
1611 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1612 switches::kEnableNetworkService)) {
1613 return false;
1614 }
1615 RenderThread::Get()->GetConnector()->BindInterface(
1616 content::mojom::kBrowserServiceName, &safe_browsing_);
1617 return true;
1618 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698