Chromium Code Reviews| 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/external_protocol/external_protocol_handler.h" | 9 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 10 #include "chrome/browser/net/load_timing_observer.h" | 10 #include "chrome/browser/net/load_timing_observer.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 prerender::FINAL_STATUS_INVALID_HTTP_METHOD); | 80 prerender::FINAL_STATUS_INVALID_HTTP_METHOD); |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 ResourceHandler* ChromeResourceDispatcherHostDelegate::RequestBeginning( | 87 ResourceHandler* ChromeResourceDispatcherHostDelegate::RequestBeginning( |
| 88 ResourceHandler* handler, | 88 ResourceHandler* handler, |
| 89 net::URLRequest* request, | 89 net::URLRequest* request, |
| 90 const content::ResourceContext& resource_context, | |
| 90 bool is_subresource, | 91 bool is_subresource, |
| 91 int child_id, | 92 int child_id, |
| 92 int route_id) { | 93 int route_id) { |
| 93 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) | 94 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) |
| 94 request->set_load_flags(request->load_flags() | net::LOAD_PRERENDERING); | 95 request->set_load_flags(request->load_flags() | net::LOAD_PRERENDERING); |
| 95 | 96 |
| 96 // Insert safe browsing at the front of the chain, so it gets to decide | 97 // Insert safe browsing at the front of the chain, so it gets to decide |
| 97 // on policies first. | 98 // on policies first. |
| 98 if (safe_browsing_->enabled()) { | 99 if (resource_context.safe_browsing_enabled()) { |
| 99 handler = CreateSafeBrowsingResourceHandler( | 100 handler = CreateSafeBrowsingResourceHandler( |
| 100 handler, child_id, route_id, is_subresource); | 101 handler, child_id, route_id, is_subresource); |
| 101 } | 102 } |
| 102 | 103 |
| 103 #if defined(OS_CHROMEOS) | 104 #if defined(OS_CHROMEOS) |
| 104 // We check offline first, then check safe browsing so that we still can block | 105 // We check offline first, then check safe browsing so that we still can block |
| 105 // unsafe site after we remove offline page. | 106 // unsafe site after we remove offline page. |
| 106 handler = new OfflineResourceHandler( | 107 handler = new OfflineResourceHandler( |
| 107 handler, child_id, route_id, resource_dispatcher_host_, request); | 108 handler, child_id, route_id, resource_dispatcher_host_, request); |
| 108 #endif | 109 #endif |
| 109 return handler; | 110 return handler; |
| 110 } | 111 } |
| 111 | 112 |
| 112 ResourceHandler* ChromeResourceDispatcherHostDelegate::DownloadStarting( | 113 ResourceHandler* ChromeResourceDispatcherHostDelegate::DownloadStarting( |
| 113 ResourceHandler* handler, | 114 ResourceHandler* handler, |
| 115 const content::ResourceContext& resource_context, | |
| 114 int child_id, | 116 int child_id, |
| 115 int route_id) { | 117 int route_id) { |
| 116 if (!safe_browsing_->enabled()) | 118 if (resource_context.safe_browsing_enabled()) |
|
Joao da Silva
2011/06/22 13:38:03
Probably missing a "not" here:
if (!resource_conte
Miranda Callahan
2011/06/22 16:25:18
Whoops, oh yes -- thanks!
| |
| 117 return handler; | 119 return handler; |
| 118 | 120 |
| 119 return CreateSafeBrowsingResourceHandler(handler, child_id, route_id, false); | 121 return CreateSafeBrowsingResourceHandler(handler, child_id, route_id, false); |
| 120 } | 122 } |
| 121 | 123 |
| 122 bool ChromeResourceDispatcherHostDelegate::ShouldDeferStart( | 124 bool ChromeResourceDispatcherHostDelegate::ShouldDeferStart( |
| 123 net::URLRequest* request, | 125 net::URLRequest* request, |
| 124 const content::ResourceContext& resource_context) { | 126 const content::ResourceContext& resource_context) { |
| 125 ResourceDispatcherHostRequestInfo* info = | 127 ResourceDispatcherHostRequestInfo* info = |
| 126 resource_dispatcher_host_->InfoForRequest(request); | 128 resource_dispatcher_host_->InfoForRequest(request); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 | 203 |
| 202 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( | 204 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( |
| 203 net::URLRequest* request, ResourceResponse* response) { | 205 net::URLRequest* request, ResourceResponse* response) { |
| 204 LoadTimingObserver::PopulateTimingInfo(request, response); | 206 LoadTimingObserver::PopulateTimingInfo(request, response); |
| 205 } | 207 } |
| 206 | 208 |
| 207 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( | 209 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( |
| 208 net::URLRequest* request, ResourceResponse* response) { | 210 net::URLRequest* request, ResourceResponse* response) { |
| 209 LoadTimingObserver::PopulateTimingInfo(request, response); | 211 LoadTimingObserver::PopulateTimingInfo(request, response); |
| 210 } | 212 } |
| OLD | NEW |