| 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/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 19 #include "base/shared_memory.h" | 19 #include "base/shared_memory.h" |
| 20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 21 #include "chrome/browser/download/download_util.h" | |
| 22 #include "content/browser/appcache/chrome_appcache_service.h" | 21 #include "content/browser/appcache/chrome_appcache_service.h" |
| 23 #include "content/browser/cert_store.h" | 22 #include "content/browser/cert_store.h" |
| 24 #include "content/browser/child_process_security_policy.h" | 23 #include "content/browser/child_process_security_policy.h" |
| 25 #include "content/browser/chrome_blob_storage_context.h" | 24 #include "content/browser/chrome_blob_storage_context.h" |
| 26 #include "content/browser/content_browser_client.h" | 25 #include "content/browser/content_browser_client.h" |
| 27 #include "content/browser/cross_site_request_manager.h" | 26 #include "content/browser/cross_site_request_manager.h" |
| 28 #include "content/browser/download/download_file_manager.h" | 27 #include "content/browser/download/download_file_manager.h" |
| 29 #include "content/browser/download/download_manager.h" | 28 #include "content/browser/download/download_manager.h" |
| 30 #include "content/browser/download/download_resource_handler.h" | 29 #include "content/browser/download/download_resource_handler.h" |
| 31 #include "content/browser/download/save_file_manager.h" | 30 #include "content/browser/download/save_file_manager.h" |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 return; | 714 return; |
| 716 | 715 |
| 717 // Check if the renderer is permitted to request the requested URL. | 716 // Check if the renderer is permitted to request the requested URL. |
| 718 if (!ChildProcessSecurityPolicy::GetInstance()-> | 717 if (!ChildProcessSecurityPolicy::GetInstance()-> |
| 719 CanRequestURL(child_id, url)) { | 718 CanRequestURL(child_id, url)) { |
| 720 VLOG(1) << "Denied unauthorized download request for " | 719 VLOG(1) << "Denied unauthorized download request for " |
| 721 << url.possibly_invalid_spec(); | 720 << url.possibly_invalid_spec(); |
| 722 return; | 721 return; |
| 723 } | 722 } |
| 724 | 723 |
| 725 BrowserThread::PostTask( | |
| 726 BrowserThread::UI, FROM_HERE, | |
| 727 NewRunnableFunction(&download_util::NotifyDownloadInitiated, | |
| 728 child_id, route_id)); | |
| 729 | |
| 730 net::URLRequest* request = new net::URLRequest(url, this); | 724 net::URLRequest* request = new net::URLRequest(url, this); |
| 731 | 725 |
| 732 request_id_--; | 726 request_id_--; |
| 733 | 727 |
| 734 scoped_refptr<ResourceHandler> handler( | 728 scoped_refptr<ResourceHandler> handler( |
| 735 new DownloadResourceHandler(this, | 729 new DownloadResourceHandler(this, |
| 736 child_id, | 730 child_id, |
| 737 route_id, | 731 route_id, |
| 738 request_id_, | 732 request_id_, |
| 739 url, | 733 url, |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2113 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2107 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
| 2114 } | 2108 } |
| 2115 | 2109 |
| 2116 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2110 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
| 2117 return allow_cross_origin_auth_prompt_; | 2111 return allow_cross_origin_auth_prompt_; |
| 2118 } | 2112 } |
| 2119 | 2113 |
| 2120 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2114 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
| 2121 allow_cross_origin_auth_prompt_ = value; | 2115 allow_cross_origin_auth_prompt_ = value; |
| 2122 } | 2116 } |
| OLD | NEW |