| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 prerender::FINAL_STATUS_INVALID_HTTP_METHOD); | 84 prerender::FINAL_STATUS_INVALID_HTTP_METHOD); |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 | 87 |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 ResourceHandler* ChromeResourceDispatcherHostDelegate::RequestBeginning( | 91 ResourceHandler* ChromeResourceDispatcherHostDelegate::RequestBeginning( |
| 92 ResourceHandler* handler, | 92 ResourceHandler* handler, |
| 93 net::URLRequest* request, | 93 net::URLRequest* request, |
| 94 bool safe_browsing_enabled, |
| 94 bool is_subresource, | 95 bool is_subresource, |
| 95 int child_id, | 96 int child_id, |
| 96 int route_id) { | 97 int route_id) { |
| 97 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) | 98 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) |
| 98 request->set_load_flags(request->load_flags() | net::LOAD_PRERENDERING); | 99 request->set_load_flags(request->load_flags() | net::LOAD_PRERENDERING); |
| 99 | 100 |
| 100 // Insert safe browsing at the front of the chain, so it gets to decide | 101 // Insert safe browsing at the front of the chain, so it gets to decide |
| 101 // on policies first. | 102 // on policies first. |
| 102 if (safe_browsing_->enabled()) { | 103 if (safe_browsing_enabled) { |
| 103 handler = CreateSafeBrowsingResourceHandler( | 104 handler = CreateSafeBrowsingResourceHandler( |
| 104 handler, child_id, route_id, is_subresource); | 105 handler, child_id, route_id, is_subresource); |
| 105 } | 106 } |
| 106 | 107 |
| 107 #if defined(OS_CHROMEOS) | 108 #if defined(OS_CHROMEOS) |
| 108 // We check offline first, then check safe browsing so that we still can block | 109 // We check offline first, then check safe browsing so that we still can block |
| 109 // unsafe site after we remove offline page. | 110 // unsafe site after we remove offline page. |
| 110 handler = new OfflineResourceHandler( | 111 handler = new OfflineResourceHandler( |
| 111 handler, child_id, route_id, resource_dispatcher_host_, request); | 112 handler, child_id, route_id, resource_dispatcher_host_, request); |
| 112 #endif | 113 #endif |
| 113 return handler; | 114 return handler; |
| 114 } | 115 } |
| 115 | 116 |
| 116 ResourceHandler* ChromeResourceDispatcherHostDelegate::DownloadStarting( | 117 ResourceHandler* ChromeResourceDispatcherHostDelegate::DownloadStarting( |
| 117 ResourceHandler* handler, | 118 ResourceHandler* handler, |
| 119 bool safe_browsing_enabled, |
| 118 int child_id, | 120 int child_id, |
| 119 int route_id) { | 121 int route_id) { |
| 120 if (!safe_browsing_->enabled()) | 122 if (!safe_browsing_enabled) |
| 121 return handler; | 123 return handler; |
| 122 | 124 |
| 123 return CreateSafeBrowsingResourceHandler(handler, child_id, route_id, false); | 125 return CreateSafeBrowsingResourceHandler(handler, child_id, route_id, false); |
| 124 } | 126 } |
| 125 | 127 |
| 126 bool ChromeResourceDispatcherHostDelegate::ShouldDeferStart( | 128 bool ChromeResourceDispatcherHostDelegate::ShouldDeferStart( |
| 127 net::URLRequest* request, | 129 net::URLRequest* request, |
| 128 const content::ResourceContext& resource_context) { | 130 const content::ResourceContext& resource_context) { |
| 129 ResourceDispatcherHostRequestInfo* info = | 131 ResourceDispatcherHostRequestInfo* info = |
| 130 resource_dispatcher_host_->InfoForRequest(request); | 132 resource_dispatcher_host_->InfoForRequest(request); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 info->route_id(), request->url(), | 224 info->route_id(), request->url(), |
| 223 map->GetContentSettings(request->url(), request->url()))); | 225 map->GetContentSettings(request->url(), request->url()))); |
| 224 } | 226 } |
| 225 | 227 |
| 226 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( | 228 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( |
| 227 net::URLRequest* request, | 229 net::URLRequest* request, |
| 228 ResourceResponse* response, | 230 ResourceResponse* response, |
| 229 ResourceMessageFilter* filter) { | 231 ResourceMessageFilter* filter) { |
| 230 LoadTimingObserver::PopulateTimingInfo(request, response); | 232 LoadTimingObserver::PopulateTimingInfo(request, response); |
| 231 } | 233 } |
| OLD | NEW |