 Chromium Code Reviews
 Chromium Code Reviews Issue 2900563002:
  Network service: Safe browsing check for sub-resources from renderer.  (Closed)
    
  
    Issue 2900563002:
  Network service: Safe browsing check for sub-resources from renderer.  (Closed) 
  | OLD | NEW | 
|---|---|
| 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 #ifndef CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 5 #ifndef CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 
| 6 #define CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 6 #define CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 
| 7 | 7 | 
| 8 #include <stddef.h> | 8 #include <stddef.h> | 
| 9 | 9 | 
| 10 #include <map> | 10 #include <map> | 
| 11 #include <memory> | 11 #include <memory> | 
| 12 #include <set> | 12 #include <set> | 
| 13 #include <string> | 13 #include <string> | 
| 14 #include <vector> | 14 #include <vector> | 
| 15 | 15 | 
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" | 
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" | 
| 18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" | 
| 19 #include "chrome/common/safe_browsing.mojom.h" | |
| 19 #include "chrome/renderer/media/chrome_key_systems_provider.h" | 20 #include "chrome/renderer/media/chrome_key_systems_provider.h" | 
| 20 #include "components/rappor/public/interfaces/rappor_recorder.mojom.h" | 21 #include "components/rappor/public/interfaces/rappor_recorder.mojom.h" | 
| 21 #include "components/spellcheck/spellcheck_build_features.h" | 22 #include "components/spellcheck/spellcheck_build_features.h" | 
| 22 #include "content/public/renderer/content_renderer_client.h" | 23 #include "content/public/renderer/content_renderer_client.h" | 
| 23 #include "extensions/features/features.h" | 24 #include "extensions/features/features.h" | 
| 24 #include "ipc/ipc_channel_proxy.h" | 25 #include "ipc/ipc_channel_proxy.h" | 
| 25 #include "media/media_features.h" | 26 #include "media/media_features.h" | 
| 26 #include "ppapi/features/features.h" | 27 #include "ppapi/features/features.h" | 
| 27 #include "printing/features/features.h" | 28 #include "printing/features/features.h" | 
| 28 #include "v8/include/v8.h" | 29 #include "v8/include/v8.h" | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 bool AllowPopup() override; | 133 bool AllowPopup() override; | 
| 133 bool ShouldFork(blink::WebLocalFrame* frame, | 134 bool ShouldFork(blink::WebLocalFrame* frame, | 
| 134 const GURL& url, | 135 const GURL& url, | 
| 135 const std::string& http_method, | 136 const std::string& http_method, | 
| 136 bool is_initial_navigation, | 137 bool is_initial_navigation, | 
| 137 bool is_server_redirect, | 138 bool is_server_redirect, | 
| 138 bool* send_referrer) override; | 139 bool* send_referrer) override; | 
| 139 bool WillSendRequest(blink::WebLocalFrame* frame, | 140 bool WillSendRequest(blink::WebLocalFrame* frame, | 
| 140 ui::PageTransition transition_type, | 141 ui::PageTransition transition_type, | 
| 141 const blink::WebURL& url, | 142 const blink::WebURL& url, | 
| 142 GURL* new_url) override; | 143 GURL* new_url, | 
| 144 std::vector<std::unique_ptr<content::URLLoaderThrottle>>* | |
| 145 throttles) override; | |
| 143 bool IsPrefetchOnly(content::RenderFrame* render_frame, | 146 bool IsPrefetchOnly(content::RenderFrame* render_frame, | 
| 144 const blink::WebURLRequest& request) override; | 147 const blink::WebURLRequest& request) override; | 
| 145 unsigned long long VisitedLinkHash(const char* canonical_url, | 148 unsigned long long VisitedLinkHash(const char* canonical_url, | 
| 146 size_t length) override; | 149 size_t length) override; | 
| 147 bool IsLinkVisited(unsigned long long link_hash) override; | 150 bool IsLinkVisited(unsigned long long link_hash) override; | 
| 148 blink::WebPrescientNetworking* GetPrescientNetworking() override; | 151 blink::WebPrescientNetworking* GetPrescientNetworking() override; | 
| 149 bool ShouldOverridePageVisibilityState( | 152 bool ShouldOverridePageVisibilityState( | 
| 150 const content::RenderFrame* render_frame, | 153 const content::RenderFrame* render_frame, | 
| 151 blink::WebPageVisibilityState* override_state) override; | 154 blink::WebPageVisibilityState* override_state) override; | 
| 152 bool IsExternalPepperPlugin(const std::string& module_name) override; | 155 bool IsExternalPepperPlugin(const std::string& module_name) override; | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 content::RenderFrame* render_frame, | 206 content::RenderFrame* render_frame, | 
| 204 const blink::WebPluginParams& params, | 207 const blink::WebPluginParams& params, | 
| 205 const ChromeViewHostMsg_GetPluginInfo_Output& output); | 208 const ChromeViewHostMsg_GetPluginInfo_Output& output); | 
| 206 #endif | 209 #endif | 
| 207 | 210 | 
| 208 #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) | 211 #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) | 
| 209 static bool IsExtensionOrSharedModuleWhitelisted( | 212 static bool IsExtensionOrSharedModuleWhitelisted( | 
| 210 const GURL& url, const std::set<std::string>& whitelist); | 213 const GURL& url, const std::set<std::string>& whitelist); | 
| 211 #endif | 214 #endif | 
| 212 | 215 | 
| 216 void OnRenderFrameDestruct(content::RenderFrame* frame); | |
| 217 | |
| 213 private: | 218 private: | 
| 214 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, NaClRestriction); | 219 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, NaClRestriction); | 
| 215 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, | 220 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, | 
| 216 ShouldSuppressErrorPage); | 221 ShouldSuppressErrorPage); | 
| 217 | 222 | 
| 218 static GURL GetNaClContentHandlerURL(const std::string& actual_mime_type, | 223 static GURL GetNaClContentHandlerURL(const std::string& actual_mime_type, | 
| 219 const content::WebPluginInfo& plugin); | 224 const content::WebPluginInfo& plugin); | 
| 220 | 225 | 
| 221 // Time at which this object was created. This is very close to the time at | 226 // Time at which this object was created. This is very close to the time at | 
| 222 // which the RendererMain function was entered. | 227 // which the RendererMain function was entered. | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 std::unique_ptr<LeakDetectorRemoteClient> leak_detector_remote_client_; | 269 std::unique_ptr<LeakDetectorRemoteClient> leak_detector_remote_client_; | 
| 265 #endif | 270 #endif | 
| 266 | 271 | 
| 267 #if defined(OS_WIN) | 272 #if defined(OS_WIN) | 
| 268 // Observes module load and unload events and notifies the ModuleDatabase in | 273 // Observes module load and unload events and notifies the ModuleDatabase in | 
| 269 // the browser process. | 274 // the browser process. | 
| 270 std::unique_ptr<ModuleWatcher> module_watcher_; | 275 std::unique_ptr<ModuleWatcher> module_watcher_; | 
| 271 mojom::ModuleEventSinkPtr module_event_sink_; | 276 mojom::ModuleEventSinkPtr module_event_sink_; | 
| 272 #endif | 277 #endif | 
| 273 | 278 | 
| 279 struct FrameData { | |
| 280 FrameData(); | |
| 281 ~FrameData(); | |
| 282 chrome::mojom::SafeBrowsingPtr safe_browsing; | |
| 283 }; | |
| 284 using FrameDataMap = std::map<content::RenderFrame*, FrameData>; | |
| 285 FrameDataMap frame_data_map_; | |
| 
Adam Rice
2017/05/25 11:33:24
Could content::RenderFrame be made to inherit from
 
yzshen1
2017/05/26 20:43:52
I have changed the SafeBrowsing interface to be pe
 | |
| 286 | |
| 274 DISALLOW_COPY_AND_ASSIGN(ChromeContentRendererClient); | 287 DISALLOW_COPY_AND_ASSIGN(ChromeContentRendererClient); | 
| 275 }; | 288 }; | 
| 276 | 289 | 
| 277 #endif // CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 290 #endif // CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 
| OLD | NEW |