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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.h

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: Extracted a shared NavigationEntryImpl::ConstructResourceRequestBody. 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
7 7
8 #include "content/public/browser/navigation_handle.h" 8 #include "content/public/browser/navigation_handle.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
15 #include "content/browser/frame_host/frame_tree_node.h" 16 #include "content/browser/frame_host/frame_tree_node.h"
16 #include "content/browser/frame_host/render_frame_host_impl.h" 17 #include "content/browser/frame_host/render_frame_host_impl.h"
17 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
18 #include "content/public/browser/navigation_data.h" 19 #include "content/public/browser/navigation_data.h"
19 #include "content/public/browser/navigation_throttle.h" 20 #include "content/public/browser/navigation_throttle.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 struct FrameHostMsg_DidCommitProvisionalLoad_Params; 23 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
23 24
24 namespace content { 25 namespace content {
25 26
26 class NavigatorDelegate; 27 class NavigatorDelegate;
28 class ResourceRequestBody;
27 class ServiceWorkerContextWrapper; 29 class ServiceWorkerContextWrapper;
28 class ServiceWorkerNavigationHandle; 30 class ServiceWorkerNavigationHandle;
29 struct NavigationRequestInfo; 31 struct NavigationRequestInfo;
30 32
31 // This class keeps track of a single navigation. It is created upon receipt of 33 // This class keeps track of a single navigation. It is created upon receipt of
32 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns 34 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns
33 // the newly created NavigationHandleImpl as long as the navigation is ongoing. 35 // the newly created NavigationHandleImpl as long as the navigation is ongoing.
34 // The NavigationHandleImpl in the RenderFrameHost will be reset when the 36 // The NavigationHandleImpl in the RenderFrameHost will be reset when the
35 // navigation stops, that is if one of the following events happen: 37 // navigation stops, that is if one of the following events happen:
36 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new 38 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void set_is_transferring(bool is_transferring) { 149 void set_is_transferring(bool is_transferring) {
148 is_transferring_ = is_transferring; 150 is_transferring_ = is_transferring;
149 } 151 }
150 152
151 // Updates the RenderFrameHost that is about to commit the navigation. This 153 // Updates the RenderFrameHost that is about to commit the navigation. This
152 // is used during transfer navigations. 154 // is used during transfer navigations.
153 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) { 155 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) {
154 render_frame_host_ = render_frame_host; 156 render_frame_host_ = render_frame_host;
155 } 157 }
156 158
159 // Gets post body associated with this navigation.
160 const scoped_refptr<ResourceRequestBody>& resource_request_body() const {
161 return resource_request_body_;
162 }
163
164 // Gets HTTP method associated with this navigation.
165 const std::string& method() const { return method_; }
166
157 // PlzNavigate 167 // PlzNavigate
158 void InitServiceWorkerHandle( 168 void InitServiceWorkerHandle(
159 ServiceWorkerContextWrapper* service_worker_context); 169 ServiceWorkerContextWrapper* service_worker_context);
160 ServiceWorkerNavigationHandle* service_worker_handle() const { 170 ServiceWorkerNavigationHandle* service_worker_handle() const {
161 return service_worker_handle_.get(); 171 return service_worker_handle_.get();
162 } 172 }
163 173
164 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> 174 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)>
165 ThrottleChecksFinishedCallback; 175 ThrottleChecksFinishedCallback;
166 176
167 // Called when the URLRequest will start in the network stack. |callback| 177 // Called when the URLRequest will start in the network stack. |callback|
168 // will be called when all throttle checks have completed. This will allow 178 // will be called when all throttle checks have completed. This will allow
169 // the caller to cancel the navigation or let it proceed. 179 // the caller to cancel the navigation or let it proceed.
170 void WillStartRequest(const std::string& method, 180 void WillStartRequest(
171 const Referrer& sanitized_referrer, 181 const std::string& method,
172 bool has_user_gesture, 182 const scoped_refptr<content::ResourceRequestBody>& resource_request_body,
173 ui::PageTransition transition, 183 const Referrer& sanitized_referrer,
174 bool is_external_protocol, 184 bool has_user_gesture,
175 const ThrottleChecksFinishedCallback& callback); 185 ui::PageTransition transition,
186 bool is_external_protocol,
187 const ThrottleChecksFinishedCallback& callback);
176 188
177 // Called when the URLRequest will be redirected in the network stack. 189 // Called when the URLRequest will be redirected in the network stack.
178 // |callback| will be called when all throttles check have completed. This 190 // |callback| will be called when all throttles check have completed. This
179 // will allow the caller to cancel the navigation or let it proceed. 191 // will allow the caller to cancel the navigation or let it proceed.
180 // This will also inform the delegate that the request was redirected. 192 // This will also inform the delegate that the request was redirected.
181 void WillRedirectRequest( 193 void WillRedirectRequest(
182 const GURL& new_url, 194 const GURL& new_url,
183 const std::string& new_method, 195 const std::string& new_method,
184 const GURL& new_referrer_url, 196 const GURL& new_referrer_url,
185 bool new_is_external_protocol, 197 bool new_is_external_protocol,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 RenderFrameHostImpl* render_frame_host_; 278 RenderFrameHostImpl* render_frame_host_;
267 bool is_same_page_; 279 bool is_same_page_;
268 const bool is_synchronous_; 280 const bool is_synchronous_;
269 const bool is_srcdoc_; 281 const bool is_srcdoc_;
270 bool was_redirected_; 282 bool was_redirected_;
271 scoped_refptr<net::HttpResponseHeaders> response_headers_; 283 scoped_refptr<net::HttpResponseHeaders> response_headers_;
272 284
273 // The HTTP method used for the navigation. 285 // The HTTP method used for the navigation.
274 std::string method_; 286 std::string method_;
275 287
288 // The body of the request (i.e. body of a post request).
289 scoped_refptr<ResourceRequestBody> resource_request_body_;
290
276 // The state the navigation is in. 291 // The state the navigation is in.
277 State state_; 292 State state_;
278 293
279 // Whether the navigation is in the middle of a transfer. Set to false when 294 // Whether the navigation is in the middle of a transfer. Set to false when
280 // the DidStartProvisionalLoad is received from the new renderer. 295 // the DidStartProvisionalLoad is received from the new renderer.
281 bool is_transferring_; 296 bool is_transferring_;
282 297
283 // The FrameTreeNode this navigation is happening in. 298 // The FrameTreeNode this navigation is happening in.
284 FrameTreeNode* frame_tree_node_; 299 FrameTreeNode* frame_tree_node_;
285 300
(...skipping 19 matching lines...) Expand all
305 320
306 // Embedder data tied to this navigation. 321 // Embedder data tied to this navigation.
307 std::unique_ptr<NavigationData> navigation_data_; 322 std::unique_ptr<NavigationData> navigation_data_;
308 323
309 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 324 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
310 }; 325 };
311 326
312 } // namespace content 327 } // namespace content
313 328
314 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 329 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698