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> |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
719 | 719 |
720 BrowserThread::PostTask( | 720 BrowserThread::PostTask( |
721 BrowserThread::UI, FROM_HERE, | 721 BrowserThread::UI, FROM_HERE, |
722 NewRunnableFunction(&download_util::NotifyDownloadInitiated, | 722 NewRunnableFunction(&download_util::NotifyDownloadInitiated, |
723 child_id, route_id)); | 723 child_id, route_id)); |
724 | 724 |
725 net::URLRequest* request = new net::URLRequest(url, this); | 725 net::URLRequest* request = new net::URLRequest(url, this); |
726 | 726 |
727 request_id_--; | 727 request_id_--; |
728 | 728 |
729 DownloadId dl_id; | |
730 void* next_download_id_thunk = context.GetUserData(reinterpret_cast<void*>( | |
Randy Smith (Not in Mondays)
2011/08/03 21:10:29
Same comment: TODO based on download_manager.h goi
benjhayden
2011/08/04 17:15:00
Done.
| |
731 BASE_HASH_NAMESPACE::hash<std::string>()("next_download_id_thunk"))); | |
732 DCHECK(next_download_id_thunk); | |
733 if (next_download_id_thunk != NULL) { | |
734 dl_id = reinterpret_cast<DownloadManager::GetNextIdThunkType*>( | |
735 next_download_id_thunk)->Run(); | |
736 } | |
737 | |
729 scoped_refptr<ResourceHandler> handler( | 738 scoped_refptr<ResourceHandler> handler( |
730 new DownloadResourceHandler(this, | 739 new DownloadResourceHandler(this, |
731 child_id, | 740 child_id, |
732 route_id, | 741 route_id, |
733 request_id_, | 742 request_id_, |
734 url, | 743 url, |
744 dl_id, | |
735 download_file_manager_.get(), | 745 download_file_manager_.get(), |
736 request, | 746 request, |
737 prompt_for_save_location, | 747 prompt_for_save_location, |
738 save_info)); | 748 save_info)); |
739 | 749 |
740 if (delegate_) { | 750 if (delegate_) { |
741 handler = delegate_->DownloadStarting(handler, context, child_id, | 751 handler = delegate_->DownloadStarting(handler, context, child_id, |
742 route_id); | 752 route_id); |
743 } | 753 } |
744 | 754 |
745 const net::URLRequestContext* request_context = context.request_context(); | 755 const net::URLRequestContext* request_context = context.request_context(); |
746 | 756 |
747 if (!request_context->job_factory()->IsHandledURL(url)) { | 757 if (!request_context->job_factory()->IsHandledURL(url)) { |
748 VLOG(1) << "Download request for unsupported protocol: " | 758 VLOG(1) << "Download request for unsupported protocol: " |
749 << url.possibly_invalid_spec(); | 759 << url.possibly_invalid_spec(); |
750 return; | 760 return; |
751 } | 761 } |
752 | 762 |
753 request->set_method("GET"); | 763 request->set_method("GET"); |
754 request->set_referrer(MaybeStripReferrer(referrer).spec()); | 764 request->set_referrer(MaybeStripReferrer(referrer).spec()); |
755 request->set_context(context.request_context()); | 765 request->set_context(request_context); |
756 request->set_load_flags(request->load_flags() | | 766 request->set_load_flags(request->load_flags() | |
757 net::LOAD_IS_DOWNLOAD); | 767 net::LOAD_IS_DOWNLOAD); |
758 | 768 |
759 ResourceDispatcherHostRequestInfo* extra_info = | 769 ResourceDispatcherHostRequestInfo* extra_info = |
760 CreateRequestInfoForBrowserRequest( | 770 CreateRequestInfoForBrowserRequest( |
761 handler, child_id, route_id, true, context); | 771 handler, child_id, route_id, true, context); |
762 SetRequestInfo(request, extra_info); // Request takes ownership. | 772 SetRequestInfo(request, extra_info); // Request takes ownership. |
763 | 773 |
764 BeginRequestInternal(request); | 774 BeginRequestInternal(request); |
765 } | 775 } |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2105 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2115 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2106 } | 2116 } |
2107 | 2117 |
2108 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2118 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2109 return allow_cross_origin_auth_prompt_; | 2119 return allow_cross_origin_auth_prompt_; |
2110 } | 2120 } |
2111 | 2121 |
2112 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2122 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2113 allow_cross_origin_auth_prompt_ = value; | 2123 allow_cross_origin_auth_prompt_ = value; |
2114 } | 2124 } |
OLD | NEW |