OLD | NEW |
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 Loading... |
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 bool safe_browsing_enabled, |
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 // Insert safe browsing at the front of the chain, so it gets to decide | 122 // Insert safe browsing at the front of the chain, so it gets to decide |
122 // on policies first. | 123 // on policies first. |
123 if (safe_browsing_->enabled()) { | 124 if (safe_browsing_enabled) { |
124 handler = CreateSafeBrowsingResourceHandler( | 125 handler = CreateSafeBrowsingResourceHandler( |
125 handler, child_id, route_id, is_subresource); | 126 handler, child_id, route_id, is_subresource); |
126 } | 127 } |
127 | 128 |
128 #if defined(OS_CHROMEOS) | 129 #if defined(OS_CHROMEOS) |
129 // We check offline first, then check safe browsing so that we still can block | 130 // We check offline first, then check safe browsing so that we still can block |
130 // unsafe site after we remove offline page. | 131 // unsafe site after we remove offline page. |
131 handler = new OfflineResourceHandler( | 132 handler = new OfflineResourceHandler( |
132 handler, child_id, route_id, resource_dispatcher_host_, request); | 133 handler, child_id, route_id, resource_dispatcher_host_, request); |
133 #endif | 134 #endif |
134 return handler; | 135 return handler; |
135 } | 136 } |
136 | 137 |
137 ResourceHandler* ChromeResourceDispatcherHostDelegate::DownloadStarting( | 138 ResourceHandler* ChromeResourceDispatcherHostDelegate::DownloadStarting( |
138 ResourceHandler* handler, | 139 ResourceHandler* handler, |
| 140 bool safe_browsing_enabled, |
139 int child_id, | 141 int child_id, |
140 int route_id) { | 142 int route_id) { |
141 if (!safe_browsing_->enabled()) | 143 if (!safe_browsing_enabled) |
142 return handler; | 144 return handler; |
143 | 145 |
144 return CreateSafeBrowsingResourceHandler(handler, child_id, route_id, false); | 146 return CreateSafeBrowsingResourceHandler(handler, child_id, route_id, false); |
145 } | 147 } |
146 | 148 |
147 bool ChromeResourceDispatcherHostDelegate::ShouldDeferStart( | 149 bool ChromeResourceDispatcherHostDelegate::ShouldDeferStart( |
148 net::URLRequest* request, | 150 net::URLRequest* request, |
149 const content::ResourceContext& resource_context) { | 151 const content::ResourceContext& resource_context) { |
150 ResourceDispatcherHostRequestInfo* info = | 152 ResourceDispatcherHostRequestInfo* info = |
151 resource_dispatcher_host_->InfoForRequest(request); | 153 resource_dispatcher_host_->InfoForRequest(request); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 info->route_id(), request->url(), | 245 info->route_id(), request->url(), |
244 map->GetContentSettings(request->url(), request->url()))); | 246 map->GetContentSettings(request->url(), request->url()))); |
245 } | 247 } |
246 | 248 |
247 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( | 249 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( |
248 net::URLRequest* request, | 250 net::URLRequest* request, |
249 ResourceResponse* response, | 251 ResourceResponse* response, |
250 ResourceMessageFilter* filter) { | 252 ResourceMessageFilter* filter) { |
251 LoadTimingObserver::PopulateTimingInfo(request, response); | 253 LoadTimingObserver::PopulateTimingInfo(request, response); |
252 } | 254 } |
OLD | NEW |