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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 new ResourceDispatcherHostRequestInfo( | 582 new ResourceDispatcherHostRequestInfo( |
583 handler, | 583 handler, |
584 process_type, | 584 process_type, |
585 child_id, | 585 child_id, |
586 route_id, | 586 route_id, |
587 request_data.origin_pid, | 587 request_data.origin_pid, |
588 request_id, | 588 request_id, |
589 request_data.is_main_frame, | 589 request_data.is_main_frame, |
590 request_data.frame_id, | 590 request_data.frame_id, |
591 request_data.resource_type, | 591 request_data.resource_type, |
| 592 request_data.transition_type, |
592 upload_size, | 593 upload_size, |
593 false, // is download | 594 false, // is download |
594 ResourceType::IsFrame(request_data.resource_type), // allow_download | 595 ResourceType::IsFrame(request_data.resource_type), // allow_download |
595 request_data.has_user_gesture, | 596 request_data.has_user_gesture, |
596 &resource_context); | 597 &resource_context); |
597 SetRequestInfo(request, extra_info); // Request takes ownership. | 598 SetRequestInfo(request, extra_info); // Request takes ownership. |
598 | 599 |
599 if (request->url().SchemeIs(chrome::kBlobScheme)) { | 600 if (request->url().SchemeIs(chrome::kBlobScheme)) { |
600 // Hang on to a reference to ensure the blob is not released prior | 601 // Hang on to a reference to ensure the blob is not released prior |
601 // to the job being started. | 602 // to the job being started. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 724 |
724 void ResourceDispatcherHost::OnFollowRedirect( | 725 void ResourceDispatcherHost::OnFollowRedirect( |
725 int request_id, | 726 int request_id, |
726 bool has_new_first_party_for_cookies, | 727 bool has_new_first_party_for_cookies, |
727 const GURL& new_first_party_for_cookies) { | 728 const GURL& new_first_party_for_cookies) { |
728 FollowDeferredRedirect(filter_->child_id(), request_id, | 729 FollowDeferredRedirect(filter_->child_id(), request_id, |
729 has_new_first_party_for_cookies, | 730 has_new_first_party_for_cookies, |
730 new_first_party_for_cookies); | 731 new_first_party_for_cookies); |
731 } | 732 } |
732 | 733 |
733 ResourceDispatcherHostRequestInfo* | 734 ResourceDispatcherHostRequestInfo* ResourceDispatcherHost::CreateRequestInfo( |
734 ResourceDispatcherHost::CreateRequestInfoForBrowserRequest( | |
735 ResourceHandler* handler, | 735 ResourceHandler* handler, |
736 int child_id, | 736 int child_id, |
737 int route_id, | 737 int route_id, |
738 bool download, | 738 bool download, |
739 const content::ResourceContext& context) { | 739 const content::ResourceContext& context) { |
740 return new ResourceDispatcherHostRequestInfo(handler, | 740 return new ResourceDispatcherHostRequestInfo(handler, |
741 ChildProcessInfo::RENDER_PROCESS, | 741 ChildProcessInfo::RENDER_PROCESS, |
742 child_id, | 742 child_id, |
743 route_id, | 743 route_id, |
744 0, | 744 0, |
745 request_id_, | 745 request_id_, |
746 false, // is_main_frame | 746 false, // is_main_frame |
747 -1, // frame_id | 747 -1, // frame_id |
748 ResourceType::SUB_RESOURCE, | 748 ResourceType::SUB_RESOURCE, |
| 749 PageTransition::LINK, |
749 0, // upload_size | 750 0, // upload_size |
750 download, // is_download | 751 download, // is_download |
751 download, // allow_download | 752 download, // allow_download |
752 false, // has_user_gesture | 753 false, // has_user_gesture |
753 &context); | 754 &context); |
754 } | 755 } |
755 | 756 |
756 void ResourceDispatcherHost::OnSwapOutACK( | 757 void ResourceDispatcherHost::OnSwapOutACK( |
757 const ViewMsg_SwapOut_Params& params) { | 758 const ViewMsg_SwapOut_Params& params) { |
758 // Closes for cross-site transitions are handled such that the cross-site | 759 // Closes for cross-site transitions are handled such that the cross-site |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 return; | 834 return; |
834 } | 835 } |
835 | 836 |
836 request->set_method("GET"); | 837 request->set_method("GET"); |
837 request->set_referrer(MaybeStripReferrer(referrer).spec()); | 838 request->set_referrer(MaybeStripReferrer(referrer).spec()); |
838 request->set_context(context.request_context()); | 839 request->set_context(context.request_context()); |
839 request->set_load_flags(request->load_flags() | | 840 request->set_load_flags(request->load_flags() | |
840 net::LOAD_IS_DOWNLOAD); | 841 net::LOAD_IS_DOWNLOAD); |
841 | 842 |
842 ResourceDispatcherHostRequestInfo* extra_info = | 843 ResourceDispatcherHostRequestInfo* extra_info = |
843 CreateRequestInfoForBrowserRequest( | 844 CreateRequestInfo(handler, child_id, route_id, true, context); |
844 handler, child_id, route_id, true, context); | |
845 SetRequestInfo(request, extra_info); // Request takes ownership. | 845 SetRequestInfo(request, extra_info); // Request takes ownership. |
846 | 846 |
847 BeginRequestInternal(request); | 847 BeginRequestInternal(request); |
848 } | 848 } |
849 | 849 |
850 // This function is only used for saving feature. | 850 // This function is only used for saving feature. |
851 void ResourceDispatcherHost::BeginSaveFile( | 851 void ResourceDispatcherHost::BeginSaveFile( |
852 const GURL& url, | 852 const GURL& url, |
853 const GURL& referrer, | 853 const GURL& referrer, |
854 int child_id, | 854 int child_id, |
(...skipping 23 matching lines...) Expand all Loading... |
878 net::URLRequest* request = new net::URLRequest(url, this); | 878 net::URLRequest* request = new net::URLRequest(url, this); |
879 request->set_method("GET"); | 879 request->set_method("GET"); |
880 request->set_referrer(MaybeStripReferrer(referrer).spec()); | 880 request->set_referrer(MaybeStripReferrer(referrer).spec()); |
881 // So far, for saving page, we need fetch content from cache, in the | 881 // So far, for saving page, we need fetch content from cache, in the |
882 // future, maybe we can use a configuration to configure this behavior. | 882 // future, maybe we can use a configuration to configure this behavior. |
883 request->set_load_flags(net::LOAD_PREFERRING_CACHE); | 883 request->set_load_flags(net::LOAD_PREFERRING_CACHE); |
884 request->set_context(context.request_context()); | 884 request->set_context(context.request_context()); |
885 | 885 |
886 // Since we're just saving some resources we need, disallow downloading. | 886 // Since we're just saving some resources we need, disallow downloading. |
887 ResourceDispatcherHostRequestInfo* extra_info = | 887 ResourceDispatcherHostRequestInfo* extra_info = |
888 CreateRequestInfoForBrowserRequest( | 888 CreateRequestInfo(handler, child_id, route_id, false, context); |
889 handler, child_id, route_id, false, context); | |
890 SetRequestInfo(request, extra_info); // Request takes ownership. | 889 SetRequestInfo(request, extra_info); // Request takes ownership. |
891 | 890 |
892 BeginRequestInternal(request); | 891 BeginRequestInternal(request); |
893 } | 892 } |
894 | 893 |
895 void ResourceDispatcherHost::FollowDeferredRedirect( | 894 void ResourceDispatcherHost::FollowDeferredRedirect( |
896 int child_id, | 895 int child_id, |
897 int request_id, | 896 int request_id, |
898 bool has_new_first_party_for_cookies, | 897 bool has_new_first_party_for_cookies, |
899 const GURL& new_first_party_for_cookies) { | 898 const GURL& new_first_party_for_cookies) { |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2132 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2134 } | 2133 } |
2135 | 2134 |
2136 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2135 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2137 return allow_cross_origin_auth_prompt_; | 2136 return allow_cross_origin_auth_prompt_; |
2138 } | 2137 } |
2139 | 2138 |
2140 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2139 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2141 allow_cross_origin_auth_prompt_ = value; | 2140 allow_cross_origin_auth_prompt_ = value; |
2142 } | 2141 } |
OLD | NEW |