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

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

Issue 1956383003: Forwarding POST body into renderer after a cross-site transfer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed DCHECK_IMPLIES(method == "POST", url.SchemeIs(http or https)). Created 4 years, 6 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 #include "content/browser/loader/resource_request_info_impl.h" 5 #include "content/browser/loader/resource_request_info_impl.h"
6 6
7 #include "content/browser/frame_host/frame_tree_node.h" 7 #include "content/browser/frame_host/frame_tree_node.h"
8 #include "content/browser/loader/global_routing_id.h" 8 #include "content/browser/loader/global_routing_id.h"
9 #include "content/browser/loader/resource_message_filter.h" 9 #include "content/browser/loader/resource_message_filter.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 bool is_async, 54 bool is_async,
55 bool is_using_lofi) { 55 bool is_using_lofi) {
56 // Make sure both |is_main_frame| and |parent_is_main_frame| aren't set at the 56 // Make sure both |is_main_frame| and |parent_is_main_frame| aren't set at the
57 // same time. 57 // same time.
58 DCHECK(!(is_main_frame && parent_is_main_frame)); 58 DCHECK(!(is_main_frame && parent_is_main_frame));
59 59
60 // Make sure RESOURCE_TYPE_MAIN_FRAME is declared as being fetched as part of 60 // Make sure RESOURCE_TYPE_MAIN_FRAME is declared as being fetched as part of
61 // the main frame. 61 // the main frame.
62 DCHECK(resource_type != RESOURCE_TYPE_MAIN_FRAME || is_main_frame); 62 DCHECK(resource_type != RESOURCE_TYPE_MAIN_FRAME || is_main_frame);
63 63
64 ResourceRequestInfoImpl* info = 64 ResourceRequestInfoImpl* info = new ResourceRequestInfoImpl(
65 new ResourceRequestInfoImpl( 65 PROCESS_TYPE_RENDERER, // process_type
66 PROCESS_TYPE_RENDERER, // process_type 66 render_process_id, // child_id
67 render_process_id, // child_id 67 render_view_id, // route_id
68 render_view_id, // route_id 68 -1, // frame_tree_node_id
69 -1, // frame_tree_node_id 69 0, // origin_pid
70 0, // origin_pid 70 0, // request_id
71 0, // request_id 71 render_frame_id, // render_frame_id
72 render_frame_id, // render_frame_id 72 is_main_frame, // is_main_frame
73 is_main_frame, // is_main_frame 73 parent_is_main_frame, // parent_is_main_frame
74 parent_is_main_frame, // parent_is_main_frame 74 resource_type, // resource_type
75 resource_type, // resource_type 75 ui::PAGE_TRANSITION_LINK, // transition_type
76 ui::PAGE_TRANSITION_LINK, // transition_type 76 false, // should_replace_current_entry
77 false, // should_replace_current_entry 77 false, // is_download
78 false, // is_download 78 false, // is_stream
79 false, // is_stream 79 allow_download, // allow_download
80 allow_download, // allow_download 80 false, // has_user_gesture
81 false, // has_user_gesture 81 false, // enable load timing
82 false, // enable load timing 82 request->has_upload(), // enable upload progress
83 request->has_upload(), // enable upload progress 83 false, // do_not_prompt_for_login
84 false, // do_not_prompt_for_login 84 blink::WebReferrerPolicyDefault, // referrer_policy
85 blink::WebReferrerPolicyDefault, // referrer_policy 85 blink::WebPageVisibilityStateVisible, // visibility_state
86 blink::WebPageVisibilityStateVisible, // visibility_state 86 context, // context
87 context, // context 87 base::WeakPtr<ResourceMessageFilter>(), // filter
88 base::WeakPtr<ResourceMessageFilter>(), // filter 88 false, // report_raw_headers
89 false, // report_raw_headers 89 is_async, // is_async
90 is_async, // is_async 90 is_using_lofi, // is_using_lofi
91 is_using_lofi, // is_using_lofi 91 std::string(), // original_headers
92 std::string()); // original_headers 92 nullptr); // body
93 info->AssociateWithRequest(request); 93 info->AssociateWithRequest(request);
94 } 94 }
95 95
96 // static 96 // static
97 bool ResourceRequestInfo::GetRenderFrameForRequest( 97 bool ResourceRequestInfo::GetRenderFrameForRequest(
98 const net::URLRequest* request, 98 const net::URLRequest* request,
99 int* render_process_id, 99 int* render_process_id,
100 int* render_frame_id) { 100 int* render_frame_id) {
101 URLRequestUserData* user_data = static_cast<URLRequestUserData*>( 101 URLRequestUserData* user_data = static_cast<URLRequestUserData*>(
102 request->GetUserData(URLRequestUserData::kUserDataKey)); 102 request->GetUserData(URLRequestUserData::kUserDataKey));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bool enable_load_timing, 149 bool enable_load_timing,
150 bool enable_upload_progress, 150 bool enable_upload_progress,
151 bool do_not_prompt_for_login, 151 bool do_not_prompt_for_login,
152 blink::WebReferrerPolicy referrer_policy, 152 blink::WebReferrerPolicy referrer_policy,
153 blink::WebPageVisibilityState visibility_state, 153 blink::WebPageVisibilityState visibility_state,
154 ResourceContext* context, 154 ResourceContext* context,
155 base::WeakPtr<ResourceMessageFilter> filter, 155 base::WeakPtr<ResourceMessageFilter> filter,
156 bool report_raw_headers, 156 bool report_raw_headers,
157 bool is_async, 157 bool is_async,
158 bool is_using_lofi, 158 bool is_using_lofi,
159 const std::string& original_headers) 159 const std::string& original_headers,
160 const scoped_refptr<ResourceRequestBody> body)
160 : cross_site_handler_(NULL), 161 : cross_site_handler_(NULL),
161 detachable_handler_(NULL), 162 detachable_handler_(NULL),
162 process_type_(process_type), 163 process_type_(process_type),
163 child_id_(child_id), 164 child_id_(child_id),
164 route_id_(route_id), 165 route_id_(route_id),
165 frame_tree_node_id_(frame_tree_node_id), 166 frame_tree_node_id_(frame_tree_node_id),
166 origin_pid_(origin_pid), 167 origin_pid_(origin_pid),
167 request_id_(request_id), 168 request_id_(request_id),
168 render_frame_id_(render_frame_id), 169 render_frame_id_(render_frame_id),
169 is_main_frame_(is_main_frame), 170 is_main_frame_(is_main_frame),
(...skipping 11 matching lines...) Expand all
181 resource_type_(resource_type), 182 resource_type_(resource_type),
182 transition_type_(transition_type), 183 transition_type_(transition_type),
183 memory_cost_(0), 184 memory_cost_(0),
184 referrer_policy_(referrer_policy), 185 referrer_policy_(referrer_policy),
185 visibility_state_(visibility_state), 186 visibility_state_(visibility_state),
186 context_(context), 187 context_(context),
187 filter_(filter), 188 filter_(filter),
188 report_raw_headers_(report_raw_headers), 189 report_raw_headers_(report_raw_headers),
189 is_async_(is_async), 190 is_async_(is_async),
190 is_using_lofi_(is_using_lofi), 191 is_using_lofi_(is_using_lofi),
191 original_headers_(original_headers) { 192 original_headers_(original_headers),
192 } 193 body_(body) {}
193 194
194 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() { 195 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() {
195 } 196 }
196 197
197 ResourceRequestInfo::WebContentsGetter 198 ResourceRequestInfo::WebContentsGetter
198 ResourceRequestInfoImpl::GetWebContentsGetterForRequest() const { 199 ResourceRequestInfoImpl::GetWebContentsGetterForRequest() const {
199 // PlzNavigate: navigation requests are created with a valid FrameTreeNode ID 200 // PlzNavigate: navigation requests are created with a valid FrameTreeNode ID
200 // and invalid RenderProcessHost and RenderFrameHost IDs. The FrameTreeNode 201 // and invalid RenderProcessHost and RenderFrameHost IDs. The FrameTreeNode
201 // ID should be used to access the WebContents. 202 // ID should be used to access the WebContents.
202 if (frame_tree_node_id_ != -1) { 203 if (frame_tree_node_id_ != -1) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 int request_id, 330 int request_id,
330 base::WeakPtr<ResourceMessageFilter> filter) { 331 base::WeakPtr<ResourceMessageFilter> filter) {
331 child_id_ = child_id; 332 child_id_ = child_id;
332 route_id_ = route_id; 333 route_id_ = route_id;
333 render_frame_id_ = render_frame_id; 334 render_frame_id_ = render_frame_id;
334 origin_pid_ = origin_pid; 335 origin_pid_ = origin_pid;
335 request_id_ = request_id; 336 request_id_ = request_id;
336 filter_ = filter; 337 filter_ = filter;
337 } 338 }
338 339
340 void ResourceRequestInfoImpl::ResetBody() {
341 body_ = nullptr;
342 }
343
339 } // namespace content 344 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698