| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 const GURL& GetURL() override; | 83 const GURL& GetURL() override; |
| 82 bool IsInMainFrame() override; | 84 bool IsInMainFrame() override; |
| 83 bool IsParentMainFrame() override; | 85 bool IsParentMainFrame() override; |
| 84 bool IsRendererInitiated() override; | 86 bool IsRendererInitiated() override; |
| 85 bool IsSynchronousNavigation() override; | 87 bool IsSynchronousNavigation() override; |
| 86 bool IsSrcdoc() override; | 88 bool IsSrcdoc() override; |
| 87 bool WasServerRedirect() override; | 89 bool WasServerRedirect() override; |
| 88 int GetFrameTreeNodeId() override; | 90 int GetFrameTreeNodeId() override; |
| 89 int GetParentFrameTreeNodeId() override; | 91 int GetParentFrameTreeNodeId() override; |
| 90 const base::TimeTicks& NavigationStart() override; | 92 const base::TimeTicks& NavigationStart() override; |
| 91 bool IsPost() override; | 93 const std::string& GetMethod() override; |
| 92 const Referrer& GetReferrer() override; | 94 const Referrer& GetReferrer() override; |
| 93 bool HasUserGesture() override; | 95 bool HasUserGesture() override; |
| 94 ui::PageTransition GetPageTransition() override; | 96 ui::PageTransition GetPageTransition() override; |
| 95 bool IsExternalProtocol() override; | 97 bool IsExternalProtocol() override; |
| 96 net::Error GetNetErrorCode() override; | 98 net::Error GetNetErrorCode() override; |
| 97 RenderFrameHostImpl* GetRenderFrameHost() override; | 99 RenderFrameHostImpl* GetRenderFrameHost() override; |
| 98 bool IsSamePage() override; | 100 bool IsSamePage() override; |
| 99 bool HasCommitted() override; | 101 bool HasCommitted() override; |
| 100 bool IsErrorPage() override; | 102 bool IsErrorPage() override; |
| 101 void Resume() override; | 103 void Resume() override; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 void set_is_transferring(bool is_transferring) { | 151 void set_is_transferring(bool is_transferring) { |
| 150 is_transferring_ = is_transferring; | 152 is_transferring_ = is_transferring; |
| 151 } | 153 } |
| 152 | 154 |
| 153 // Updates the RenderFrameHost that is about to commit the navigation. This | 155 // Updates the RenderFrameHost that is about to commit the navigation. This |
| 154 // is used during transfer navigations. | 156 // is used during transfer navigations. |
| 155 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) { | 157 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) { |
| 156 render_frame_host_ = render_frame_host; | 158 render_frame_host_ = render_frame_host; |
| 157 } | 159 } |
| 158 | 160 |
| 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 |
| 163 // request was a redirect that changed the method to GET - for example 302). |
| 164 const scoped_refptr<ResourceRequestBody>& resource_request_body() const { |
| 165 return resource_request_body_; |
| 166 } |
| 167 |
| 159 // PlzNavigate | 168 // PlzNavigate |
| 160 void InitServiceWorkerHandle( | 169 void InitServiceWorkerHandle( |
| 161 ServiceWorkerContextWrapper* service_worker_context); | 170 ServiceWorkerContextWrapper* service_worker_context); |
| 162 ServiceWorkerNavigationHandle* service_worker_handle() const { | 171 ServiceWorkerNavigationHandle* service_worker_handle() const { |
| 163 return service_worker_handle_.get(); | 172 return service_worker_handle_.get(); |
| 164 } | 173 } |
| 165 | 174 |
| 166 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 175 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
| 167 ThrottleChecksFinishedCallback; | 176 ThrottleChecksFinishedCallback; |
| 168 | 177 |
| 169 // Called when the URLRequest will start in the network stack. |callback| | 178 // Called when the URLRequest will start in the network stack. |callback| |
| 170 // 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 |
| 171 // the caller to cancel the navigation or let it proceed. | 180 // the caller to cancel the navigation or let it proceed. |
| 172 void WillStartRequest(const std::string& method, | 181 void WillStartRequest( |
| 173 const Referrer& sanitized_referrer, | 182 const std::string& method, |
| 174 bool has_user_gesture, | 183 const scoped_refptr<content::ResourceRequestBody>& resource_request_body, |
| 175 ui::PageTransition transition, | 184 const Referrer& sanitized_referrer, |
| 176 bool is_external_protocol, | 185 bool has_user_gesture, |
| 177 const ThrottleChecksFinishedCallback& callback); | 186 ui::PageTransition transition, |
| 187 bool is_external_protocol, |
| 188 const ThrottleChecksFinishedCallback& callback); |
| 178 | 189 |
| 179 // Called when the URLRequest will be redirected in the network stack. | 190 // Called when the URLRequest will be redirected in the network stack. |
| 180 // |callback| will be called when all throttles check have completed. This | 191 // |callback| will be called when all throttles check have completed. This |
| 181 // 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. |
| 182 // This will also inform the delegate that the request was redirected. | 193 // This will also inform the delegate that the request was redirected. |
| 183 void WillRedirectRequest( | 194 void WillRedirectRequest( |
| 184 const GURL& new_url, | 195 const GURL& new_url, |
| 185 const std::string& new_method, | 196 const std::string& new_method, |
| 186 const GURL& new_referrer_url, | 197 const GURL& new_referrer_url, |
| 187 bool new_is_external_protocol, | 198 bool new_is_external_protocol, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 const bool is_renderer_initiated_; | 281 const bool is_renderer_initiated_; |
| 271 bool is_same_page_; | 282 bool is_same_page_; |
| 272 const bool is_synchronous_; | 283 const bool is_synchronous_; |
| 273 const bool is_srcdoc_; | 284 const bool is_srcdoc_; |
| 274 bool was_redirected_; | 285 bool was_redirected_; |
| 275 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 286 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 276 | 287 |
| 277 // The HTTP method used for the navigation. | 288 // The HTTP method used for the navigation. |
| 278 std::string method_; | 289 std::string method_; |
| 279 | 290 |
| 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 |
| 293 // redirect that changed the method to GET - for example 302). |
| 294 scoped_refptr<ResourceRequestBody> resource_request_body_; |
| 295 |
| 280 // The state the navigation is in. | 296 // The state the navigation is in. |
| 281 State state_; | 297 State state_; |
| 282 | 298 |
| 283 // 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 |
| 284 // the DidStartProvisionalLoad is received from the new renderer. | 300 // the DidStartProvisionalLoad is received from the new renderer. |
| 285 bool is_transferring_; | 301 bool is_transferring_; |
| 286 | 302 |
| 287 // The FrameTreeNode this navigation is happening in. | 303 // The FrameTreeNode this navigation is happening in. |
| 288 FrameTreeNode* frame_tree_node_; | 304 FrameTreeNode* frame_tree_node_; |
| 289 | 305 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 309 | 325 |
| 310 // Embedder data tied to this navigation. | 326 // Embedder data tied to this navigation. |
| 311 std::unique_ptr<NavigationData> navigation_data_; | 327 std::unique_ptr<NavigationData> navigation_data_; |
| 312 | 328 |
| 313 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 329 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 314 }; | 330 }; |
| 315 | 331 |
| 316 } // namespace content | 332 } // namespace content |
| 317 | 333 |
| 318 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 334 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |