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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 7134017: Make safe browsing work in a multi-profile environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: addressed sky's nit Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/external_protocol/external_protocol_handler.h" 10 #include "chrome/browser/external_protocol/external_protocol_handler.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 prerender::FINAL_STATUS_INVALID_HTTP_METHOD); 105 prerender::FINAL_STATUS_INVALID_HTTP_METHOD);
106 return false; 106 return false;
107 } 107 }
108 108
109 return true; 109 return true;
110 } 110 }
111 111
112 ResourceHandler* ChromeResourceDispatcherHostDelegate::RequestBeginning( 112 ResourceHandler* ChromeResourceDispatcherHostDelegate::RequestBeginning(
113 ResourceHandler* handler, 113 ResourceHandler* handler,
114 net::URLRequest* request, 114 net::URLRequest* request,
115 const content::ResourceContext& resource_context,
115 bool is_subresource, 116 bool is_subresource,
116 int child_id, 117 int child_id,
117 int route_id) { 118 int route_id) {
118 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) 119 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id))
119 request->set_load_flags(request->load_flags() | net::LOAD_PRERENDERING); 120 request->set_load_flags(request->load_flags() | net::LOAD_PRERENDERING);
120 121
121 #if defined(ENABLE_SAFE_BROWSING) 122 #if defined(ENABLE_SAFE_BROWSING)
122 // Insert safe browsing at the front of the chain, so it gets to decide 123 // Insert safe browsing at the front of the chain, so it gets to decide
123 // on policies first. 124 // on policies first.
124 if (safe_browsing_->enabled()) { 125 ProfileIOData* io_data = reinterpret_cast<ProfileIOData*>(
126 resource_context.GetUserData(NULL));
127 if (io_data->safe_browsing_enabled()->GetValue()) {
125 handler = CreateSafeBrowsingResourceHandler( 128 handler = CreateSafeBrowsingResourceHandler(
126 handler, child_id, route_id, is_subresource); 129 handler, child_id, route_id, is_subresource);
127 } 130 }
128 #endif 131 #endif
129 132
130 #if defined(OS_CHROMEOS) 133 #if defined(OS_CHROMEOS)
131 // We check offline first, then check safe browsing so that we still can block 134 // We check offline first, then check safe browsing so that we still can block
132 // unsafe site after we remove offline page. 135 // unsafe site after we remove offline page.
133 handler = new OfflineResourceHandler( 136 handler = new OfflineResourceHandler(
134 handler, child_id, route_id, resource_dispatcher_host_, request); 137 handler, child_id, route_id, resource_dispatcher_host_, request);
135 #endif 138 #endif
136 return handler; 139 return handler;
137 } 140 }
138 141
139 ResourceHandler* ChromeResourceDispatcherHostDelegate::DownloadStarting( 142 ResourceHandler* ChromeResourceDispatcherHostDelegate::DownloadStarting(
140 ResourceHandler* handler, 143 ResourceHandler* handler,
144 const content::ResourceContext& resource_context,
141 int child_id, 145 int child_id,
142 int route_id) { 146 int route_id) {
143 #if defined(ENABLE_SAFE_BROWSING) 147 #if defined(ENABLE_SAFE_BROWSING)
144 if (!safe_browsing_->enabled()) 148 ProfileIOData* io_data = reinterpret_cast<ProfileIOData*>(
149 resource_context.GetUserData(NULL));
150 if (!io_data->safe_browsing_enabled()->GetValue())
145 return handler; 151 return handler;
146 152
147 return CreateSafeBrowsingResourceHandler(handler, child_id, route_id, false); 153 return CreateSafeBrowsingResourceHandler(handler, child_id, route_id, false);
148 #else 154 #else
149 return handler; 155 return handler;
150 #endif 156 #endif
151 } 157 }
152 158
153 bool ChromeResourceDispatcherHostDelegate::ShouldDeferStart( 159 bool ChromeResourceDispatcherHostDelegate::ShouldDeferStart(
154 net::URLRequest* request, 160 net::URLRequest* request,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 info->route_id(), request->url(), 257 info->route_id(), request->url(),
252 map->GetContentSettings(request->url(), request->url()))); 258 map->GetContentSettings(request->url(), request->url())));
253 } 259 }
254 260
255 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( 261 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected(
256 net::URLRequest* request, 262 net::URLRequest* request,
257 ResourceResponse* response, 263 ResourceResponse* response,
258 ResourceMessageFilter* filter) { 264 ResourceMessageFilter* filter) {
259 LoadTimingObserver::PopulateTimingInfo(request, response); 265 LoadTimingObserver::PopulateTimingInfo(request, response);
260 } 266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698