| 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_throttle.h" | 19 #include "content/public/browser/navigation_throttle.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 struct FrameHostMsg_DidCommitProvisionalLoad_Params; | 22 struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 class NavigatorDelegate; | 26 class NavigatorDelegate; |
| 27 class ResourceRequestBody; |
| 26 class ServiceWorkerContextWrapper; | 28 class ServiceWorkerContextWrapper; |
| 27 class ServiceWorkerNavigationHandle; | 29 class ServiceWorkerNavigationHandle; |
| 28 struct NavigationRequestInfo; | 30 struct NavigationRequestInfo; |
| 29 | 31 |
| 30 // This class keeps track of a single navigation. It is created upon receipt of | 32 // This class keeps track of a single navigation. It is created upon receipt of |
| 31 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns | 33 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns |
| 32 // the newly created NavigationHandleImpl as long as the navigation is ongoing. | 34 // the newly created NavigationHandleImpl as long as the navigation is ongoing. |
| 33 // The NavigationHandleImpl in the RenderFrameHost will be reset when the | 35 // The NavigationHandleImpl in the RenderFrameHost will be reset when the |
| 34 // navigation stops, that is if one of the following events happen: | 36 // navigation stops, that is if one of the following events happen: |
| 35 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new | 37 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void set_is_transferring(bool is_transferring) { | 147 void set_is_transferring(bool is_transferring) { |
| 146 is_transferring_ = is_transferring; | 148 is_transferring_ = is_transferring; |
| 147 } | 149 } |
| 148 | 150 |
| 149 // Updates the RenderFrameHost that is about to commit the navigation. This | 151 // Updates the RenderFrameHost that is about to commit the navigation. This |
| 150 // is used during transfer navigations. | 152 // is used during transfer navigations. |
| 151 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) { | 153 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) { |
| 152 render_frame_host_ = render_frame_host; | 154 render_frame_host_ = render_frame_host; |
| 153 } | 155 } |
| 154 | 156 |
| 157 // Gets post body associated with this navigation. |
| 158 const scoped_refptr<ResourceRequestBody>& resource_request_body() const { |
| 159 return resource_request_body_; |
| 160 } |
| 161 |
| 155 // PlzNavigate | 162 // PlzNavigate |
| 156 void InitServiceWorkerHandle( | 163 void InitServiceWorkerHandle( |
| 157 ServiceWorkerContextWrapper* service_worker_context); | 164 ServiceWorkerContextWrapper* service_worker_context); |
| 158 ServiceWorkerNavigationHandle* service_worker_handle() const { | 165 ServiceWorkerNavigationHandle* service_worker_handle() const { |
| 159 return service_worker_handle_.get(); | 166 return service_worker_handle_.get(); |
| 160 } | 167 } |
| 161 | 168 |
| 162 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 169 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
| 163 ThrottleChecksFinishedCallback; | 170 ThrottleChecksFinishedCallback; |
| 164 | 171 |
| 165 // Called when the URLRequest will start in the network stack. |callback| | 172 // Called when the URLRequest will start in the network stack. |callback| |
| 166 // will be called when all throttle checks have completed. This will allow | 173 // will be called when all throttle checks have completed. This will allow |
| 167 // the caller to cancel the navigation or let it proceed. | 174 // the caller to cancel the navigation or let it proceed. |
| 168 void WillStartRequest(const std::string& method, | 175 void WillStartRequest( |
| 169 const Referrer& sanitized_referrer, | 176 const std::string& method, |
| 170 bool has_user_gesture, | 177 const scoped_refptr<content::ResourceRequestBody>& resource_request_body, |
| 171 ui::PageTransition transition, | 178 const Referrer& sanitized_referrer, |
| 172 bool is_external_protocol, | 179 bool has_user_gesture, |
| 173 const ThrottleChecksFinishedCallback& callback); | 180 ui::PageTransition transition, |
| 181 bool is_external_protocol, |
| 182 const ThrottleChecksFinishedCallback& callback); |
| 174 | 183 |
| 175 // Called when the URLRequest will be redirected in the network stack. | 184 // Called when the URLRequest will be redirected in the network stack. |
| 176 // |callback| will be called when all throttles check have completed. This | 185 // |callback| will be called when all throttles check have completed. This |
| 177 // will allow the caller to cancel the navigation or let it proceed. | 186 // will allow the caller to cancel the navigation or let it proceed. |
| 178 // This will also inform the delegate that the request was redirected. | 187 // This will also inform the delegate that the request was redirected. |
| 179 void WillRedirectRequest( | 188 void WillRedirectRequest( |
| 180 const GURL& new_url, | 189 const GURL& new_url, |
| 181 const std::string& new_method, | 190 const std::string& new_method, |
| 182 const GURL& new_referrer_url, | 191 const GURL& new_referrer_url, |
| 183 bool new_is_external_protocol, | 192 bool new_is_external_protocol, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 RenderFrameHostImpl* render_frame_host_; | 266 RenderFrameHostImpl* render_frame_host_; |
| 258 bool is_same_page_; | 267 bool is_same_page_; |
| 259 const bool is_synchronous_; | 268 const bool is_synchronous_; |
| 260 const bool is_srcdoc_; | 269 const bool is_srcdoc_; |
| 261 bool was_redirected_; | 270 bool was_redirected_; |
| 262 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 271 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 263 | 272 |
| 264 // The HTTP method used for the navigation. | 273 // The HTTP method used for the navigation. |
| 265 std::string method_; | 274 std::string method_; |
| 266 | 275 |
| 276 // The body of the request (i.e. body of a post request). |
| 277 scoped_refptr<ResourceRequestBody> resource_request_body_; |
| 278 |
| 267 // The state the navigation is in. | 279 // The state the navigation is in. |
| 268 State state_; | 280 State state_; |
| 269 | 281 |
| 270 // Whether the navigation is in the middle of a transfer. Set to false when | 282 // Whether the navigation is in the middle of a transfer. Set to false when |
| 271 // the DidStartProvisionalLoad is received from the new renderer. | 283 // the DidStartProvisionalLoad is received from the new renderer. |
| 272 bool is_transferring_; | 284 bool is_transferring_; |
| 273 | 285 |
| 274 // The FrameTreeNode this navigation is happening in. | 286 // The FrameTreeNode this navigation is happening in. |
| 275 FrameTreeNode* frame_tree_node_; | 287 FrameTreeNode* frame_tree_node_; |
| 276 | 288 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 293 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 305 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
| 294 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 306 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
| 295 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 307 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
| 296 | 308 |
| 297 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 309 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 298 }; | 310 }; |
| 299 | 311 |
| 300 } // namespace content | 312 } // namespace content |
| 301 | 313 |
| 302 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 314 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |