| 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/shared_memory.h" | 18 #include "base/shared_memory.h" |
| 19 #include "base/stl_util-inl.h" | 19 #include "base/stl_util-inl.h" |
| 20 #include "base/time.h" | 20 #include "base/time.h" |
| 21 #include "chrome/browser/download/download_file_manager.h" | 21 #include "chrome/browser/download/download_file_manager.h" |
| 22 #include "chrome/browser/download/download_manager.h" | 22 #include "chrome/browser/download/download_manager.h" |
| 23 #include "chrome/browser/download/download_request_limiter.h" | 23 #include "chrome/browser/download/download_request_limiter.h" |
| 24 #include "chrome/browser/download/download_util.h" | 24 #include "chrome/browser/download/download_util.h" |
| 25 #include "chrome/browser/download/save_file_manager.h" | 25 #include "chrome/browser/download/save_file_manager.h" |
| 26 #include "chrome/browser/profiles/profile_io_data.h" |
| 26 #include "chrome/browser/renderer_host/download_resource_handler.h" | 27 #include "chrome/browser/renderer_host/download_resource_handler.h" |
| 27 #include "chrome/browser/renderer_host/save_file_resource_handler.h" | 28 #include "chrome/browser/renderer_host/save_file_resource_handler.h" |
| 28 #include "content/browser/appcache/chrome_appcache_service.h" | 29 #include "content/browser/appcache/chrome_appcache_service.h" |
| 29 #include "content/browser/cert_store.h" | 30 #include "content/browser/cert_store.h" |
| 30 #include "content/browser/child_process_security_policy.h" | 31 #include "content/browser/child_process_security_policy.h" |
| 31 #include "content/browser/chrome_blob_storage_context.h" | 32 #include "content/browser/chrome_blob_storage_context.h" |
| 32 #include "content/browser/content_browser_client.h" | 33 #include "content/browser/content_browser_client.h" |
| 33 #include "content/browser/cross_site_request_manager.h" | 34 #include "content/browser/cross_site_request_manager.h" |
| 34 #include "content/browser/in_process_webkit/webkit_thread.h" | 35 #include "content/browser/in_process_webkit/webkit_thread.h" |
| 35 #include "content/browser/plugin_service.h" | 36 #include "content/browser/plugin_service.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 child_id, | 487 child_id, |
| 487 route_id, | 488 route_id, |
| 488 this); | 489 this); |
| 489 } | 490 } |
| 490 | 491 |
| 491 // Insert a buffered event handler before the actual one. | 492 // Insert a buffered event handler before the actual one. |
| 492 handler = new BufferedResourceHandler(handler, this, request); | 493 handler = new BufferedResourceHandler(handler, this, request); |
| 493 | 494 |
| 494 if (delegate_) { | 495 if (delegate_) { |
| 495 bool sub = request_data.resource_type != ResourceType::MAIN_FRAME; | 496 bool sub = request_data.resource_type != ResourceType::MAIN_FRAME; |
| 497 |
| 498 ProfileIOData* io_data = reinterpret_cast<ProfileIOData*>( |
| 499 resource_context.GetUserData(NULL)); |
| 496 handler = delegate_->RequestBeginning( | 500 handler = delegate_->RequestBeginning( |
| 497 handler, request, sub, child_id, route_id); | 501 handler, request, io_data->safe_browsing_enabled()->GetValue(), |
| 502 sub, child_id, route_id); |
| 498 } | 503 } |
| 499 | 504 |
| 500 // Make extra info and read footer (contains request ID). | 505 // Make extra info and read footer (contains request ID). |
| 501 ResourceDispatcherHostRequestInfo* extra_info = | 506 ResourceDispatcherHostRequestInfo* extra_info = |
| 502 new ResourceDispatcherHostRequestInfo( | 507 new ResourceDispatcherHostRequestInfo( |
| 503 handler, | 508 handler, |
| 504 process_type, | 509 process_type, |
| 505 child_id, | 510 child_id, |
| 506 route_id, | 511 route_id, |
| 507 request_data.origin_pid, | 512 request_data.origin_pid, |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 new DownloadResourceHandler(this, | 708 new DownloadResourceHandler(this, |
| 704 child_id, | 709 child_id, |
| 705 route_id, | 710 route_id, |
| 706 request_id_, | 711 request_id_, |
| 707 url, | 712 url, |
| 708 download_file_manager_.get(), | 713 download_file_manager_.get(), |
| 709 request, | 714 request, |
| 710 prompt_for_save_location, | 715 prompt_for_save_location, |
| 711 save_info)); | 716 save_info)); |
| 712 | 717 |
| 713 if (delegate_) | 718 if (delegate_) { |
| 714 handler = delegate_->DownloadStarting(handler, child_id, route_id); | 719 ProfileIOData* io_data = reinterpret_cast<ProfileIOData*>( |
| 720 context.GetUserData(NULL)); |
| 721 handler = delegate_->DownloadStarting( |
| 722 handler, |
| 723 io_data->safe_browsing_enabled()->GetValue(), |
| 724 child_id, route_id); |
| 725 } |
| 715 | 726 |
| 716 const net::URLRequestContext* request_context = context.request_context(); | 727 const net::URLRequestContext* request_context = context.request_context(); |
| 717 | 728 |
| 718 if (!request_context->job_factory()->IsHandledURL(url)) { | 729 if (!request_context->job_factory()->IsHandledURL(url)) { |
| 719 VLOG(1) << "Download request for unsupported protocol: " | 730 VLOG(1) << "Download request for unsupported protocol: " |
| 720 << url.possibly_invalid_spec(); | 731 << url.possibly_invalid_spec(); |
| 721 return; | 732 return; |
| 722 } | 733 } |
| 723 | 734 |
| 724 request->set_method("GET"); | 735 request->set_method("GET"); |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2004 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2015 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
| 2005 } | 2016 } |
| 2006 | 2017 |
| 2007 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2018 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
| 2008 return allow_cross_origin_auth_prompt_; | 2019 return allow_cross_origin_auth_prompt_; |
| 2009 } | 2020 } |
| 2010 | 2021 |
| 2011 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2022 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
| 2012 allow_cross_origin_auth_prompt_ = value; | 2023 allow_cross_origin_auth_prompt_ = value; |
| 2013 } | 2024 } |
| OLD | NEW |