OLD | NEW |
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/ref_counted.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "content/browser/frame_host/frame_tree_node.h" | 16 #include "content/browser/frame_host/frame_tree_node.h" |
17 #include "content/browser/frame_host/render_frame_host_impl.h" | 17 #include "content/browser/frame_host/render_frame_host_impl.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/public/browser/navigation_data.h" | 19 #include "content/public/browser/navigation_data.h" |
20 #include "content/public/browser/navigation_throttle.h" | 20 #include "content/public/browser/navigation_throttle.h" |
21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
22 | 22 |
23 struct FrameHostMsg_DidCommitProvisionalLoad_Params; | 23 struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 class NavigatorDelegate; | 27 class NavigatorDelegate; |
28 class ResourceRequestBody; | 28 class ResourceRequestBodyImpl; |
29 class ServiceWorkerContextWrapper; | 29 class ServiceWorkerContextWrapper; |
30 class ServiceWorkerNavigationHandle; | 30 class ServiceWorkerNavigationHandle; |
31 struct NavigationRequestInfo; | 31 struct NavigationRequestInfo; |
32 | 32 |
33 // 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 |
34 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns | 34 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns |
35 // the newly created NavigationHandleImpl as long as the navigation is ongoing. | 35 // the newly created NavigationHandleImpl as long as the navigation is ongoing. |
36 // The NavigationHandleImpl in the RenderFrameHost will be reset when the | 36 // The NavigationHandleImpl in the RenderFrameHost will be reset when the |
37 // navigation stops, that is if one of the following events happen: | 37 // navigation stops, that is if one of the following events happen: |
38 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new | 38 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 // Updates the RenderFrameHost that is about to commit the navigation. This | 155 // Updates the RenderFrameHost that is about to commit the navigation. This |
156 // is used during transfer navigations. | 156 // is used during transfer navigations. |
157 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) { | 157 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) { |
158 render_frame_host_ = render_frame_host; | 158 render_frame_host_ = render_frame_host; |
159 } | 159 } |
160 | 160 |
161 // Returns the POST body associated with this navigation. This will be | 161 // Returns the POST body associated with this navigation. This will be |
162 // null for GET and/or other non-POST requests (or if a response to a POST | 162 // null for GET and/or other non-POST requests (or if a response to a POST |
163 // request was a redirect that changed the method to GET - for example 302). | 163 // request was a redirect that changed the method to GET - for example 302). |
164 const scoped_refptr<ResourceRequestBody>& resource_request_body() const { | 164 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body() const { |
165 return resource_request_body_; | 165 return resource_request_body_; |
166 } | 166 } |
167 | 167 |
168 // PlzNavigate | 168 // PlzNavigate |
169 void InitServiceWorkerHandle( | 169 void InitServiceWorkerHandle( |
170 ServiceWorkerContextWrapper* service_worker_context); | 170 ServiceWorkerContextWrapper* service_worker_context); |
171 ServiceWorkerNavigationHandle* service_worker_handle() const { | 171 ServiceWorkerNavigationHandle* service_worker_handle() const { |
172 return service_worker_handle_.get(); | 172 return service_worker_handle_.get(); |
173 } | 173 } |
174 | 174 |
175 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 175 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
176 ThrottleChecksFinishedCallback; | 176 ThrottleChecksFinishedCallback; |
177 | 177 |
178 // Called when the URLRequest will start in the network stack. |callback| | 178 // Called when the URLRequest will start in the network stack. |callback| |
179 // will be called when all throttle checks have completed. This will allow | 179 // will be called when all throttle checks have completed. This will allow |
180 // the caller to cancel the navigation or let it proceed. | 180 // the caller to cancel the navigation or let it proceed. |
181 void WillStartRequest( | 181 void WillStartRequest( |
182 const std::string& method, | 182 const std::string& method, |
183 scoped_refptr<content::ResourceRequestBody> resource_request_body, | 183 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
184 const Referrer& sanitized_referrer, | 184 const Referrer& sanitized_referrer, |
185 bool has_user_gesture, | 185 bool has_user_gesture, |
186 ui::PageTransition transition, | 186 ui::PageTransition transition, |
187 bool is_external_protocol, | 187 bool is_external_protocol, |
188 const ThrottleChecksFinishedCallback& callback); | 188 const ThrottleChecksFinishedCallback& callback); |
189 | 189 |
190 // Called when the URLRequest will be redirected in the network stack. | 190 // Called when the URLRequest will be redirected in the network stack. |
191 // |callback| will be called when all throttles check have completed. This | 191 // |callback| will be called when all throttles check have completed. This |
192 // will allow the caller to cancel the navigation or let it proceed. | 192 // will allow the caller to cancel the navigation or let it proceed. |
193 // This will also inform the delegate that the request was redirected. | 193 // This will also inform the delegate that the request was redirected. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 const bool is_srcdoc_; | 284 const bool is_srcdoc_; |
285 bool was_redirected_; | 285 bool was_redirected_; |
286 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 286 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
287 | 287 |
288 // The HTTP method used for the navigation. | 288 // The HTTP method used for the navigation. |
289 std::string method_; | 289 std::string method_; |
290 | 290 |
291 // The POST body associated with this navigation. This will be null for GET | 291 // The POST body associated with this navigation. This will be null for GET |
292 // and/or other non-POST requests (or if a response to a POST request was a | 292 // and/or other non-POST requests (or if a response to a POST request was a |
293 // redirect that changed the method to GET - for example 302). | 293 // redirect that changed the method to GET - for example 302). |
294 scoped_refptr<ResourceRequestBody> resource_request_body_; | 294 scoped_refptr<ResourceRequestBodyImpl> resource_request_body_; |
295 | 295 |
296 // The state the navigation is in. | 296 // The state the navigation is in. |
297 State state_; | 297 State state_; |
298 | 298 |
299 // Whether the navigation is in the middle of a transfer. Set to false when | 299 // Whether the navigation is in the middle of a transfer. Set to false when |
300 // the DidStartProvisionalLoad is received from the new renderer. | 300 // the DidStartProvisionalLoad is received from the new renderer. |
301 bool is_transferring_; | 301 bool is_transferring_; |
302 | 302 |
303 // The FrameTreeNode this navigation is happening in. | 303 // The FrameTreeNode this navigation is happening in. |
304 FrameTreeNode* frame_tree_node_; | 304 FrameTreeNode* frame_tree_node_; |
(...skipping 20 matching lines...) Expand all Loading... |
325 | 325 |
326 // Embedder data tied to this navigation. | 326 // Embedder data tied to this navigation. |
327 std::unique_ptr<NavigationData> navigation_data_; | 327 std::unique_ptr<NavigationData> navigation_data_; |
328 | 328 |
329 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 329 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
330 }; | 330 }; |
331 | 331 |
332 } // namespace content | 332 } // namespace content |
333 | 333 |
334 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 334 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |