| 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 #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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/component_updater/component_updater_service.h" | 13 #include "chrome/browser/component_updater/component_updater_service.h" |
| 14 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" | 14 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" |
| 15 #include "chrome/browser/content_settings/host_content_settings_map.h" | 15 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 16 #include "chrome/browser/download/download_request_limiter.h" | 16 #include "chrome/browser/download/download_request_limiter.h" |
| 17 #include "chrome/browser/download/download_resource_throttle.h" | 17 #include "chrome/browser/download/download_resource_throttle.h" |
| 18 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" | 18 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" |
| 19 #include "chrome/browser/extensions/extension_renderer_state.h" | 19 #include "chrome/browser/extensions/extension_renderer_state.h" |
| 20 #include "chrome/browser/extensions/user_script_listener.h" | 20 #include "chrome/browser/extensions/user_script_listener.h" |
| 21 #include "chrome/browser/google/google_util.h" | 21 #include "chrome/browser/google/google_util.h" |
| 22 #include "chrome/browser/metrics/variations/variations_http_header_provider.h" | 22 #include "chrome/browser/metrics/variations/variations_http_header_provider.h" |
| 23 #include "chrome/browser/prefetch/prefetch_field_trial.h" | 23 #include "chrome/browser/prefetch/prefetch.h" |
| 24 #include "chrome/browser/prerender/prerender_manager.h" | 24 #include "chrome/browser/prerender/prerender_manager.h" |
| 25 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" | 25 #include "chrome/browser/prerender/prerender_pending_swap_throttle.h" |
| 26 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 26 #include "chrome/browser/prerender/prerender_resource_throttle.h" |
| 27 #include "chrome/browser/prerender/prerender_tracker.h" | 27 #include "chrome/browser/prerender/prerender_tracker.h" |
| 28 #include "chrome/browser/prerender/prerender_util.h" | 28 #include "chrome/browser/prerender/prerender_util.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/profiles/profile_io_data.h" | 30 #include "chrome/browser/profiles/profile_io_data.h" |
| 31 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" | 31 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h
" |
| 32 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 32 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 33 #include "chrome/browser/signin/signin_header_helper.h" | 33 #include "chrome/browser/signin/signin_header_helper.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 235 | 235 |
| 236 // Handle a PREFETCH resource type. If prefetch is disabled, squelch the | 236 // Handle a PREFETCH resource type. If prefetch is disabled, squelch the |
| 237 // request. Otherwise, do a normal request to warm the cache. | 237 // request. Otherwise, do a normal request to warm the cache. |
| 238 if (resource_type == ResourceType::PREFETCH) { | 238 if (resource_type == ResourceType::PREFETCH) { |
| 239 // All PREFETCH requests should be GETs, but be defensive about it. | 239 // All PREFETCH requests should be GETs, but be defensive about it. |
| 240 if (method != "GET") | 240 if (method != "GET") |
| 241 return false; | 241 return false; |
| 242 | 242 |
| 243 // If prefetch is disabled, kill the request. | 243 // If prefetch is disabled, kill the request. |
| 244 if (!prefetch::IsPrefetchEnabled()) | 244 if (!prefetch::IsPrefetchEnabled(resource_context)) |
| 245 return false; | 245 return false; |
| 246 } | 246 } |
| 247 | 247 |
| 248 return true; | 248 return true; |
| 249 } | 249 } |
| 250 | 250 |
| 251 void ChromeResourceDispatcherHostDelegate::RequestBeginning( | 251 void ChromeResourceDispatcherHostDelegate::RequestBeginning( |
| 252 net::URLRequest* request, | 252 net::URLRequest* request, |
| 253 content::ResourceContext* resource_context, | 253 content::ResourceContext* resource_context, |
| 254 appcache::AppCacheService* appcache_service, | 254 appcache::AppCacheService* appcache_service, |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, | 627 signin::AppendMirrorRequestHeaderIfPossible(request, redirect_url, io_data, |
| 628 info->GetChildID(), info->GetRouteID()); | 628 info->GetChildID(), info->GetRouteID()); |
| 629 } | 629 } |
| 630 | 630 |
| 631 // static | 631 // static |
| 632 void ChromeResourceDispatcherHostDelegate:: | 632 void ChromeResourceDispatcherHostDelegate:: |
| 633 SetExternalProtocolHandlerDelegateForTesting( | 633 SetExternalProtocolHandlerDelegateForTesting( |
| 634 ExternalProtocolHandler::Delegate* delegate) { | 634 ExternalProtocolHandler::Delegate* delegate) { |
| 635 g_external_protocol_handler_delegate = delegate; | 635 g_external_protocol_handler_delegate = delegate; |
| 636 } | 636 } |
| OLD | NEW |