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.h" | 19 #include "base/stl_util.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/profiles/profile_io_data.h" | |
25 #include "chrome/browser/renderer_host/download_resource_handler.h" | 26 #include "chrome/browser/renderer_host/download_resource_handler.h" |
26 #include "content/browser/appcache/chrome_appcache_service.h" | 27 #include "content/browser/appcache/chrome_appcache_service.h" |
27 #include "content/browser/cert_store.h" | 28 #include "content/browser/cert_store.h" |
28 #include "content/browser/child_process_security_policy.h" | 29 #include "content/browser/child_process_security_policy.h" |
29 #include "content/browser/chrome_blob_storage_context.h" | 30 #include "content/browser/chrome_blob_storage_context.h" |
30 #include "content/browser/content_browser_client.h" | 31 #include "content/browser/content_browser_client.h" |
31 #include "content/browser/cross_site_request_manager.h" | 32 #include "content/browser/cross_site_request_manager.h" |
32 #include "content/browser/download/save_file_manager.h" | 33 #include "content/browser/download/save_file_manager.h" |
33 #include "content/browser/download/save_file_resource_handler.h" | 34 #include "content/browser/download/save_file_resource_handler.h" |
34 #include "content/browser/in_process_webkit/webkit_thread.h" | 35 #include "content/browser/in_process_webkit/webkit_thread.h" |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
696 | 697 |
697 BrowserThread::PostTask( | 698 BrowserThread::PostTask( |
698 BrowserThread::UI, FROM_HERE, | 699 BrowserThread::UI, FROM_HERE, |
699 NewRunnableFunction(&download_util::NotifyDownloadInitiated, | 700 NewRunnableFunction(&download_util::NotifyDownloadInitiated, |
700 child_id, route_id)); | 701 child_id, route_id)); |
701 | 702 |
702 net::URLRequest* request = new net::URLRequest(url, this); | 703 net::URLRequest* request = new net::URLRequest(url, this); |
703 | 704 |
704 request_id_--; | 705 request_id_--; |
705 | 706 |
707 ProfileIOData* profile_io_data = reinterpret_cast<ProfileIOData*>( | |
willchan no longer on Chromium
2011/07/23 09:41:07
content/ is not allowed to depend on chrome/, so y
Randy Smith (Not in Mondays)
2011/07/25 20:20:12
In the absence of commentary from jam, I'll go wit
benjhayden
2011/07/27 19:40:54
DownloadManager is moving to content/. Could a Get
benjhayden
2011/07/27 19:40:54
Even though DownloadManager is moving to content/?
willchan no longer on Chromium
2011/07/27 19:47:14
I don't see how DownloadManager moving to content/
benjhayden
2011/07/28 15:37:52
Done.
| |
708 context.GetUserData(NULL)); | |
709 const DownloadManager::GetNextIdThunkType& get_next_id = | |
710 profile_io_data->next_download_id_thunk(); | |
711 | |
706 scoped_refptr<ResourceHandler> handler( | 712 scoped_refptr<ResourceHandler> handler( |
707 new DownloadResourceHandler(this, | 713 new DownloadResourceHandler(this, |
708 child_id, | 714 child_id, |
709 route_id, | 715 route_id, |
710 request_id_, | 716 request_id_, |
711 url, | 717 url, |
718 get_next_id, | |
712 download_file_manager_.get(), | 719 download_file_manager_.get(), |
713 request, | 720 request, |
714 prompt_for_save_location, | 721 prompt_for_save_location, |
715 save_info)); | 722 save_info)); |
716 | 723 |
717 if (delegate_) { | 724 if (delegate_) { |
718 handler = delegate_->DownloadStarting(handler, context, child_id, | 725 handler = delegate_->DownloadStarting(handler, context, child_id, |
719 route_id); | 726 route_id); |
720 } | 727 } |
721 | 728 |
722 const net::URLRequestContext* request_context = context.request_context(); | 729 const net::URLRequestContext* request_context = context.request_context(); |
723 | 730 |
724 if (!request_context->job_factory()->IsHandledURL(url)) { | 731 if (!request_context->job_factory()->IsHandledURL(url)) { |
725 VLOG(1) << "Download request for unsupported protocol: " | 732 VLOG(1) << "Download request for unsupported protocol: " |
726 << url.possibly_invalid_spec(); | 733 << url.possibly_invalid_spec(); |
727 return; | 734 return; |
728 } | 735 } |
729 | 736 |
730 request->set_method("GET"); | 737 request->set_method("GET"); |
731 request->set_referrer(MaybeStripReferrer(referrer).spec()); | 738 request->set_referrer(MaybeStripReferrer(referrer).spec()); |
732 request->set_context(context.request_context()); | 739 request->set_context(request_context); |
733 request->set_load_flags(request->load_flags() | | 740 request->set_load_flags(request->load_flags() | |
734 net::LOAD_IS_DOWNLOAD); | 741 net::LOAD_IS_DOWNLOAD); |
735 | 742 |
736 ResourceDispatcherHostRequestInfo* extra_info = | 743 ResourceDispatcherHostRequestInfo* extra_info = |
737 CreateRequestInfoForBrowserRequest( | 744 CreateRequestInfoForBrowserRequest( |
738 handler, child_id, route_id, true, context); | 745 handler, child_id, route_id, true, context); |
739 SetRequestInfo(request, extra_info); // Request takes ownership. | 746 SetRequestInfo(request, extra_info); // Request takes ownership. |
740 | 747 |
741 BeginRequestInternal(request); | 748 BeginRequestInternal(request); |
742 } | 749 } |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2085 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2092 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2086 } | 2093 } |
2087 | 2094 |
2088 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2095 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2089 return allow_cross_origin_auth_prompt_; | 2096 return allow_cross_origin_auth_prompt_; |
2090 } | 2097 } |
2091 | 2098 |
2092 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2099 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2093 allow_cross_origin_auth_prompt_ = value; | 2100 allow_cross_origin_auth_prompt_ = value; |
2094 } | 2101 } |
OLD | NEW |