| 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 696 |
| 697 BrowserThread::PostTask( | 697 BrowserThread::PostTask( |
| 698 BrowserThread::UI, FROM_HERE, | 698 BrowserThread::UI, FROM_HERE, |
| 699 NewRunnableFunction(&download_util::NotifyDownloadInitiated, | 699 NewRunnableFunction(&download_util::NotifyDownloadInitiated, |
| 700 child_id, route_id)); | 700 child_id, route_id)); |
| 701 | 701 |
| 702 net::URLRequest* request = new net::URLRequest(url, this); | 702 net::URLRequest* request = new net::URLRequest(url, this); |
| 703 | 703 |
| 704 request_id_--; | 704 request_id_--; |
| 705 | 705 |
| 706 DownloadId dl_id; |
| 707 void* next_download_id_thunk = context.GetUserData(reinterpret_cast<void*>( |
| 708 BASE_HASH_NAMESPACE::hash<std::string>()("next_download_id_thunk"))); |
| 709 if (next_download_id_thunk != NULL) { |
| 710 dl_id = reinterpret_cast<DownloadManager::GetNextIdThunkType*>( |
| 711 next_download_id_thunk)->Run(); |
| 712 } |
| 713 |
| 706 scoped_refptr<ResourceHandler> handler( | 714 scoped_refptr<ResourceHandler> handler( |
| 707 new DownloadResourceHandler(this, | 715 new DownloadResourceHandler(this, |
| 708 child_id, | 716 child_id, |
| 709 route_id, | 717 route_id, |
| 710 request_id_, | 718 request_id_, |
| 711 url, | 719 url, |
| 720 dl_id, |
| 712 download_file_manager_.get(), | 721 download_file_manager_.get(), |
| 713 request, | 722 request, |
| 714 prompt_for_save_location, | 723 prompt_for_save_location, |
| 715 save_info)); | 724 save_info)); |
| 716 | 725 |
| 717 if (delegate_) { | 726 if (delegate_) { |
| 718 handler = delegate_->DownloadStarting(handler, context, child_id, | 727 handler = delegate_->DownloadStarting(handler, context, child_id, |
| 719 route_id); | 728 route_id); |
| 720 } | 729 } |
| 721 | 730 |
| 722 const net::URLRequestContext* request_context = context.request_context(); | 731 const net::URLRequestContext* request_context = context.request_context(); |
| 723 | 732 |
| 724 if (!request_context->job_factory()->IsHandledURL(url)) { | 733 if (!request_context->job_factory()->IsHandledURL(url)) { |
| 725 VLOG(1) << "Download request for unsupported protocol: " | 734 VLOG(1) << "Download request for unsupported protocol: " |
| 726 << url.possibly_invalid_spec(); | 735 << url.possibly_invalid_spec(); |
| 727 return; | 736 return; |
| 728 } | 737 } |
| 729 | 738 |
| 730 request->set_method("GET"); | 739 request->set_method("GET"); |
| 731 request->set_referrer(MaybeStripReferrer(referrer).spec()); | 740 request->set_referrer(MaybeStripReferrer(referrer).spec()); |
| 732 request->set_context(context.request_context()); | 741 request->set_context(request_context); |
| 733 request->set_load_flags(request->load_flags() | | 742 request->set_load_flags(request->load_flags() | |
| 734 net::LOAD_IS_DOWNLOAD); | 743 net::LOAD_IS_DOWNLOAD); |
| 735 | 744 |
| 736 ResourceDispatcherHostRequestInfo* extra_info = | 745 ResourceDispatcherHostRequestInfo* extra_info = |
| 737 CreateRequestInfoForBrowserRequest( | 746 CreateRequestInfoForBrowserRequest( |
| 738 handler, child_id, route_id, true, context); | 747 handler, child_id, route_id, true, context); |
| 739 SetRequestInfo(request, extra_info); // Request takes ownership. | 748 SetRequestInfo(request, extra_info); // Request takes ownership. |
| 740 | 749 |
| 741 BeginRequestInternal(request); | 750 BeginRequestInternal(request); |
| 742 } | 751 } |
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2085 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2094 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
| 2086 } | 2095 } |
| 2087 | 2096 |
| 2088 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2097 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
| 2089 return allow_cross_origin_auth_prompt_; | 2098 return allow_cross_origin_auth_prompt_; |
| 2090 } | 2099 } |
| 2091 | 2100 |
| 2092 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2101 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
| 2093 allow_cross_origin_auth_prompt_ = value; | 2102 allow_cross_origin_auth_prompt_ = value; |
| 2094 } | 2103 } |
| OLD | NEW |