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

Side by Side 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, 6 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "chrome/renderer/net_benchmarking_extension.h" 50 #include "chrome/renderer/net_benchmarking_extension.h"
51 #include "chrome/renderer/page_load_metrics/metrics_render_frame_observer.h" 51 #include "chrome/renderer/page_load_metrics/metrics_render_frame_observer.h"
52 #include "chrome/renderer/pepper/pepper_helper.h" 52 #include "chrome/renderer/pepper/pepper_helper.h"
53 #include "chrome/renderer/plugins/non_loadable_plugin_placeholder.h" 53 #include "chrome/renderer/plugins/non_loadable_plugin_placeholder.h"
54 #include "chrome/renderer/plugins/plugin_preroller.h" 54 #include "chrome/renderer/plugins/plugin_preroller.h"
55 #include "chrome/renderer/plugins/plugin_uma.h" 55 #include "chrome/renderer/plugins/plugin_uma.h"
56 #include "chrome/renderer/prerender/prerender_dispatcher.h" 56 #include "chrome/renderer/prerender/prerender_dispatcher.h"
57 #include "chrome/renderer/prerender/prerender_helper.h" 57 #include "chrome/renderer/prerender/prerender_helper.h"
58 #include "chrome/renderer/prerender/prerenderer_client.h" 58 #include "chrome/renderer/prerender/prerenderer_client.h"
59 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" 59 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
60 #include "chrome/renderer/safe_browsing/safe_browsing_url_loader_throttle.h"
60 #include "chrome/renderer/searchbox/search_bouncer.h" 61 #include "chrome/renderer/searchbox/search_bouncer.h"
61 #include "chrome/renderer/searchbox/searchbox.h" 62 #include "chrome/renderer/searchbox/searchbox.h"
62 #include "chrome/renderer/searchbox/searchbox_extension.h" 63 #include "chrome/renderer/searchbox/searchbox_extension.h"
63 #include "chrome/renderer/tts_dispatcher.h" 64 #include "chrome/renderer/tts_dispatcher.h"
64 #include "chrome/renderer/worker_content_settings_client_proxy.h" 65 #include "chrome/renderer/worker_content_settings_client_proxy.h"
65 #include "components/autofill/content/renderer/autofill_agent.h" 66 #include "components/autofill/content/renderer/autofill_agent.h"
66 #include "components/autofill/content/renderer/password_autofill_agent.h" 67 #include "components/autofill/content/renderer/password_autofill_agent.h"
67 #include "components/autofill/content/renderer/password_generation_agent.h" 68 #include "components/autofill/content/renderer/password_generation_agent.h"
68 #include "components/content_settings/core/common/content_settings_pattern.h" 69 #include "components/content_settings/core/common/content_settings_pattern.h"
69 #include "components/contextual_search/renderer/overlay_js_render_frame_observer .h" 70 #include "components/contextual_search/renderer/overlay_js_render_frame_observer .h"
(...skipping 29 matching lines...) Expand all
99 #include "extensions/features/features.h" 100 #include "extensions/features/features.h"
100 #include "ipc/ipc_sync_channel.h" 101 #include "ipc/ipc_sync_channel.h"
101 #include "media/base/media_switches.h" 102 #include "media/base/media_switches.h"
102 #include "media/media_features.h" 103 #include "media/media_features.h"
103 #include "net/base/net_errors.h" 104 #include "net/base/net_errors.h"
104 #include "ppapi/c/private/ppb_pdf.h" 105 #include "ppapi/c/private/ppb_pdf.h"
105 #include "ppapi/features/features.h" 106 #include "ppapi/features/features.h"
106 #include "ppapi/shared_impl/ppapi_switches.h" 107 #include "ppapi/shared_impl/ppapi_switches.h"
107 #include "printing/features/features.h" 108 #include "printing/features/features.h"
108 #include "services/service_manager/public/cpp/connector.h" 109 #include "services/service_manager/public/cpp/connector.h"
110 #include "services/service_manager/public/cpp/interface_provider.h"
109 #include "third_party/WebKit/public/platform/URLConversion.h" 111 #include "third_party/WebKit/public/platform/URLConversion.h"
110 #include "third_party/WebKit/public/platform/WebCache.h" 112 #include "third_party/WebKit/public/platform/WebCache.h"
111 #include "third_party/WebKit/public/platform/WebCachePolicy.h" 113 #include "third_party/WebKit/public/platform/WebCachePolicy.h"
112 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 114 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
113 #include "third_party/WebKit/public/platform/WebURL.h" 115 #include "third_party/WebKit/public/platform/WebURL.h"
114 #include "third_party/WebKit/public/platform/WebURLError.h" 116 #include "third_party/WebKit/public/platform/WebURLError.h"
115 #include "third_party/WebKit/public/platform/WebURLRequest.h" 117 #include "third_party/WebKit/public/platform/WebURLRequest.h"
116 #include "third_party/WebKit/public/platform/WebURLResponse.h" 118 #include "third_party/WebKit/public/platform/WebURLResponse.h"
117 #include "third_party/WebKit/public/web/WebDataSource.h" 119 #include "third_party/WebKit/public/web/WebDataSource.h"
118 #include "third_party/WebKit/public/web/WebDocument.h" 120 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 return true; 1189 return true;
1188 #endif // BUILDFLAG(ENABLE_EXTENSIONS) 1190 #endif // BUILDFLAG(ENABLE_EXTENSIONS)
1189 1191
1190 return false; 1192 return false;
1191 } 1193 }
1192 1194
1193 bool ChromeContentRendererClient::WillSendRequest( 1195 bool ChromeContentRendererClient::WillSendRequest(
1194 WebLocalFrame* frame, 1196 WebLocalFrame* frame,
1195 ui::PageTransition transition_type, 1197 ui::PageTransition transition_type,
1196 const blink::WebURL& url, 1198 const blink::WebURL& url,
1199 std::vector<std::unique_ptr<content::URLLoaderThrottle>>* throttles,
1197 GURL* new_url) { 1200 GURL* new_url) {
1201 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1202 switches::kEnableNetworkService)) {
1203 if (!safe_browsing_) {
1204 RenderThread::Get()->GetConnector()->BindInterface(
1205 content::mojom::kBrowserServiceName, &safe_browsing_);
1206 }
1207 RenderFrame* render_frame = content::RenderFrame::FromWebFrame(frame);
1208 throttles->push_back(
1209 base::MakeUnique<safe_browsing::SafeBrowsingURLLoaderThrottle>(
1210 safe_browsing_.get(), render_frame->GetRoutingID()));
1211 }
1212
1198 // Check whether the request should be allowed. If not allowed, we reset the 1213 // Check whether the request should be allowed. If not allowed, we reset the
1199 // URL to something invalid to prevent the request and cause an error. 1214 // URL to something invalid to prevent the request and cause an error.
1200 #if BUILDFLAG(ENABLE_EXTENSIONS) 1215 #if BUILDFLAG(ENABLE_EXTENSIONS)
1201 if (ChromeExtensionsRendererClient::GetInstance()->WillSendRequest( 1216 if (ChromeExtensionsRendererClient::GetInstance()->WillSendRequest(
1202 frame, transition_type, url, new_url)) { 1217 frame, transition_type, url, new_url)) {
1203 return true; 1218 return true;
1204 } 1219 }
1205 #endif 1220 #endif
1206 1221
1207 if (!url.ProtocolIs(chrome::kChromeSearchScheme)) 1222 if (!url.ProtocolIs(chrome::kChromeSearchScheme))
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 1586
1572 RecordYouTubeRewriteUMA(result); 1587 RecordYouTubeRewriteUMA(result);
1573 return corrected_url.ReplaceComponents(r); 1588 return corrected_url.ReplaceComponents(r);
1574 } 1589 }
1575 1590
1576 std::unique_ptr<base::TaskScheduler::InitParams> 1591 std::unique_ptr<base::TaskScheduler::InitParams>
1577 ChromeContentRendererClient::GetTaskSchedulerInitParams() { 1592 ChromeContentRendererClient::GetTaskSchedulerInitParams() {
1578 return task_scheduler_util:: 1593 return task_scheduler_util::
1579 GetRendererTaskSchedulerInitParamsFromCommandLine(); 1594 GetRendererTaskSchedulerInitParamsFromCommandLine();
1580 } 1595 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | chrome/renderer/chrome_content_renderer_client_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698