| 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/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 Loading... |
| 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 |
| 157 // PlzNavigate | 164 // PlzNavigate |
| 158 void InitServiceWorkerHandle( | 165 void InitServiceWorkerHandle( |
| 159 ServiceWorkerContextWrapper* service_worker_context); | 166 ServiceWorkerContextWrapper* service_worker_context); |
| 160 ServiceWorkerNavigationHandle* service_worker_handle() const { | 167 ServiceWorkerNavigationHandle* service_worker_handle() const { |
| 161 return service_worker_handle_.get(); | 168 return service_worker_handle_.get(); |
| 162 } | 169 } |
| 163 | 170 |
| 164 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 171 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
| 165 ThrottleChecksFinishedCallback; | 172 ThrottleChecksFinishedCallback; |
| 166 | 173 |
| 167 // Called when the URLRequest will start in the network stack. |callback| | 174 // Called when the URLRequest will start in the network stack. |callback| |
| 168 // will be called when all throttle checks have completed. This will allow | 175 // will be called when all throttle checks have completed. This will allow |
| 169 // the caller to cancel the navigation or let it proceed. | 176 // the caller to cancel the navigation or let it proceed. |
| 170 void WillStartRequest(const std::string& method, | 177 void WillStartRequest( |
| 171 const Referrer& sanitized_referrer, | 178 const std::string& method, |
| 172 bool has_user_gesture, | 179 const scoped_refptr<content::ResourceRequestBody>& resource_request_body, |
| 173 ui::PageTransition transition, | 180 const Referrer& sanitized_referrer, |
| 174 bool is_external_protocol, | 181 bool has_user_gesture, |
| 175 const ThrottleChecksFinishedCallback& callback); | 182 ui::PageTransition transition, |
| 183 bool is_external_protocol, |
| 184 const ThrottleChecksFinishedCallback& callback); |
| 176 | 185 |
| 177 // Called when the URLRequest will be redirected in the network stack. | 186 // Called when the URLRequest will be redirected in the network stack. |
| 178 // |callback| will be called when all throttles check have completed. This | 187 // |callback| will be called when all throttles check have completed. This |
| 179 // will allow the caller to cancel the navigation or let it proceed. | 188 // will allow the caller to cancel the navigation or let it proceed. |
| 180 // This will also inform the delegate that the request was redirected. | 189 // This will also inform the delegate that the request was redirected. |
| 181 void WillRedirectRequest( | 190 void WillRedirectRequest( |
| 182 const GURL& new_url, | 191 const GURL& new_url, |
| 183 const std::string& new_method, | 192 const std::string& new_method, |
| 184 const GURL& new_referrer_url, | 193 const GURL& new_referrer_url, |
| 185 bool new_is_external_protocol, | 194 bool new_is_external_protocol, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 RenderFrameHostImpl* render_frame_host_; | 275 RenderFrameHostImpl* render_frame_host_; |
| 267 bool is_same_page_; | 276 bool is_same_page_; |
| 268 const bool is_synchronous_; | 277 const bool is_synchronous_; |
| 269 const bool is_srcdoc_; | 278 const bool is_srcdoc_; |
| 270 bool was_redirected_; | 279 bool was_redirected_; |
| 271 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 280 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 272 | 281 |
| 273 // The HTTP method used for the navigation. | 282 // The HTTP method used for the navigation. |
| 274 std::string method_; | 283 std::string method_; |
| 275 | 284 |
| 285 // The body of the request (i.e. body of a post request). |
| 286 scoped_refptr<ResourceRequestBody> resource_request_body_; |
| 287 |
| 276 // The state the navigation is in. | 288 // The state the navigation is in. |
| 277 State state_; | 289 State state_; |
| 278 | 290 |
| 279 // Whether the navigation is in the middle of a transfer. Set to false when | 291 // Whether the navigation is in the middle of a transfer. Set to false when |
| 280 // the DidStartProvisionalLoad is received from the new renderer. | 292 // the DidStartProvisionalLoad is received from the new renderer. |
| 281 bool is_transferring_; | 293 bool is_transferring_; |
| 282 | 294 |
| 283 // The FrameTreeNode this navigation is happening in. | 295 // The FrameTreeNode this navigation is happening in. |
| 284 FrameTreeNode* frame_tree_node_; | 296 FrameTreeNode* frame_tree_node_; |
| 285 | 297 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 305 | 317 |
| 306 // Embedder data tied to this navigation. | 318 // Embedder data tied to this navigation. |
| 307 std::unique_ptr<NavigationData> navigation_data_; | 319 std::unique_ptr<NavigationData> navigation_data_; |
| 308 | 320 |
| 309 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 321 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 310 }; | 322 }; |
| 311 | 323 |
| 312 } // namespace content | 324 } // namespace content |
| 313 | 325 |
| 314 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 326 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |