Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(666)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1977623002: Updates to DownloadUrlParameters in preparation for OOPIF changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 CHECK_NE(info->GetContext(), context); 738 CHECK_NE(info->GetContext(), context);
739 } 739 }
740 } 740 }
741 } 741 }
742 742
743 DownloadInterruptReason ResourceDispatcherHostImpl::BeginDownload( 743 DownloadInterruptReason ResourceDispatcherHostImpl::BeginDownload(
744 std::unique_ptr<net::URLRequest> request, 744 std::unique_ptr<net::URLRequest> request,
745 const Referrer& referrer, 745 const Referrer& referrer,
746 bool is_content_initiated, 746 bool is_content_initiated,
747 ResourceContext* context, 747 ResourceContext* context,
748 int child_id, 748 int render_process_id,
749 int render_view_route_id, 749 int render_view_route_id,
750 int render_frame_route_id, 750 int render_frame_route_id,
751 bool do_not_prompt_for_login) { 751 bool do_not_prompt_for_login) {
752 if (is_shutdown_) 752 if (is_shutdown_)
753 return DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN; 753 return DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN;
754 754
755 const GURL& url = request->original_url(); 755 const GURL& url = request->original_url();
756 756
757 // http://crbug.com/90971 757 // http://crbug.com/90971
758 char url_buf[128]; 758 char url_buf[128];
759 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); 759 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
760 base::debug::Alias(url_buf); 760 base::debug::Alias(url_buf);
761 CHECK(ContainsKey(active_resource_contexts_, context)); 761 CHECK(ContainsKey(active_resource_contexts_, context));
762 762
763 SetReferrerForRequest(request.get(), referrer); 763 SetReferrerForRequest(request.get(), referrer);
764 764
765 // We treat a download as a main frame load, and thus update the policy URL on 765 // We treat a download as a main frame load, and thus update the policy URL on
766 // redirects. 766 // redirects.
767 // 767 //
768 // TODO(davidben): Is this correct? If this came from a 768 // TODO(davidben): Is this correct? If this came from a
769 // ViewHostMsg_DownloadUrl in a frame, should it have first-party URL set 769 // ViewHostMsg_DownloadUrl in a frame, should it have first-party URL set
770 // appropriately? 770 // appropriately?
771 request->set_first_party_url_policy( 771 request->set_first_party_url_policy(
772 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); 772 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
773 773
774 // Check if the renderer is permitted to request the requested URL. 774 // Check if the renderer is permitted to request the requested URL.
775 if (!ChildProcessSecurityPolicyImpl::GetInstance()-> 775 if (!ChildProcessSecurityPolicyImpl::GetInstance()->
776 CanRequestURL(child_id, url)) { 776 CanRequestURL(render_process_id, url)) {
777 DVLOG(1) << "Denied unauthorized download request for " 777 DVLOG(1) << "Denied unauthorized download request for "
778 << url.possibly_invalid_spec(); 778 << url.possibly_invalid_spec();
779 return DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST; 779 return DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST;
780 } 780 }
781 781
782 request_id_--; 782 request_id_--;
783 783
784 const net::URLRequestContext* request_context = request->context(); 784 const net::URLRequestContext* request_context = request->context();
785 if (!request_context->job_factory()->IsHandledURL(url)) { 785 if (!request_context->job_factory()->IsHandledURL(url)) {
786 DVLOG(1) << "Download request for unsupported protocol: " 786 DVLOG(1) << "Download request for unsupported protocol: "
787 << url.possibly_invalid_spec(); 787 << url.possibly_invalid_spec();
788 return DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST; 788 return DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST;
789 } 789 }
790 790
791 ResourceRequestInfoImpl* extra_info = 791 ResourceRequestInfoImpl* extra_info =
792 CreateRequestInfo(child_id, render_view_route_id, 792 CreateRequestInfo(render_process_id, render_view_route_id,
793 render_frame_route_id, true, context); 793 render_frame_route_id, true, context);
794 extra_info->set_do_not_prompt_for_login(do_not_prompt_for_login); 794 extra_info->set_do_not_prompt_for_login(do_not_prompt_for_login);
795 extra_info->AssociateWithRequest(request.get()); // Request takes ownership. 795 extra_info->AssociateWithRequest(request.get()); // Request takes ownership.
796 796
797 if (request->url().SchemeIs(url::kBlobScheme) && 797 if (request->url().SchemeIs(url::kBlobScheme) &&
798 !storage::BlobProtocolHandler::GetRequestBlobDataHandle(request.get())) { 798 !storage::BlobProtocolHandler::GetRequestBlobDataHandle(request.get())) {
799 ChromeBlobStorageContext* blob_context = 799 ChromeBlobStorageContext* blob_context =
800 GetChromeBlobStorageContextForResourceContext(context); 800 GetChromeBlobStorageContextForResourceContext(context);
801 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 801 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
802 request.get(), 802 request.get(),
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); 2688 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id);
2689 response->head.security_info = SerializeSecurityInfo(ssl); 2689 response->head.security_info = SerializeSecurityInfo(ssl);
2690 } 2690 }
2691 2691
2692 CertStore* ResourceDispatcherHostImpl::GetCertStore() { 2692 CertStore* ResourceDispatcherHostImpl::GetCertStore() {
2693 return cert_store_for_testing_ ? cert_store_for_testing_ 2693 return cert_store_for_testing_ ? cert_store_for_testing_
2694 : CertStore::GetInstance(); 2694 : CertStore::GetInstance();
2695 } 2695 }
2696 2696
2697 } // namespace content 2697 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698