| 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> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // NavigationRequest. It is then owned by the NavigationRequest until the | 69 // NavigationRequest. It is then owned by the NavigationRequest until the |
| 70 // navigation is ready to commit. The NavigationHandleImpl ownership is then | 70 // navigation is ready to commit. The NavigationHandleImpl ownership is then |
| 71 // transferred to the RenderFrameHost in which the navigation will commit. | 71 // transferred to the RenderFrameHost in which the navigation will commit. |
| 72 // | 72 // |
| 73 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset | 73 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset |
| 74 // following the receipt of a DidStartProvisionalLoad IPC. There are also no | 74 // following the receipt of a DidStartProvisionalLoad IPC. There are also no |
| 75 // transferring navigations. The other causes of NavigationHandleImpl reset in | 75 // transferring navigations. The other causes of NavigationHandleImpl reset in |
| 76 // the RenderFrameHost still apply. | 76 // the RenderFrameHost still apply. |
| 77 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { | 77 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
| 78 public: | 78 public: |
| 79 // If |redirect_chain| is empty, then the redirect chain will be created to |
| 80 // start with |url|. Otherwise |redirect_chain| is used as the starting point. |
| 79 // |navigation_start| comes from the DidStartProvisionalLoad IPC, which tracks | 81 // |navigation_start| comes from the DidStartProvisionalLoad IPC, which tracks |
| 80 // both renderer-initiated and browser-initiated navigation start. | 82 // both renderer-initiated and browser-initiated navigation start. |
| 81 // PlzNavigate: This value always comes from the CommonNavigationParams | 83 // PlzNavigate: This value always comes from the CommonNavigationParams |
| 82 // associated with this navigation. | 84 // associated with this navigation. |
| 83 static std::unique_ptr<NavigationHandleImpl> Create( | 85 static std::unique_ptr<NavigationHandleImpl> Create( |
| 84 const GURL& url, | 86 const GURL& url, |
| 87 const std::vector<GURL>& redirect_chain, |
| 85 FrameTreeNode* frame_tree_node, | 88 FrameTreeNode* frame_tree_node, |
| 86 bool is_renderer_initiated, | 89 bool is_renderer_initiated, |
| 87 bool is_same_page, | 90 bool is_same_page, |
| 88 const base::TimeTicks& navigation_start, | 91 const base::TimeTicks& navigation_start, |
| 89 int pending_nav_entry_id, | 92 int pending_nav_entry_id, |
| 90 bool started_from_context_menu); | 93 bool started_from_context_menu); |
| 91 ~NavigationHandleImpl() override; | 94 ~NavigationHandleImpl() override; |
| 92 | 95 |
| 93 // NavigationHandle implementation: | 96 // NavigationHandle implementation: |
| 94 const GURL& GetURL() override; | 97 const GURL& GetURL() override; |
| 95 SiteInstance* GetStartingSiteInstance() override; | 98 SiteInstance* GetStartingSiteInstance() override; |
| 96 bool IsInMainFrame() override; | 99 bool IsInMainFrame() override; |
| 97 bool IsParentMainFrame() override; | 100 bool IsParentMainFrame() override; |
| 98 bool IsRendererInitiated() override; | 101 bool IsRendererInitiated() override; |
| 99 bool WasServerRedirect() override; | 102 bool WasServerRedirect() override; |
| 100 const std::vector<GURL>& GetRedirectChain() override; | 103 const std::vector<GURL>& GetRedirectChain() override; |
| 101 int GetFrameTreeNodeId() override; | 104 int GetFrameTreeNodeId() override; |
| 102 int GetParentFrameTreeNodeId() override; | 105 int GetParentFrameTreeNodeId() override; |
| 103 const base::TimeTicks& NavigationStart() override; | 106 const base::TimeTicks& NavigationStart() override; |
| 104 bool IsPost() override; | 107 bool IsPost() override; |
| 105 const Referrer& GetReferrer() override; | 108 const Referrer& GetReferrer() override; |
| 106 bool HasUserGesture() override; | 109 bool HasUserGesture() override; |
| 107 ui::PageTransition GetPageTransition() override; | 110 ui::PageTransition GetPageTransition() override; |
| 108 bool IsExternalProtocol() override; | 111 bool IsExternalProtocol() override; |
| 109 net::Error GetNetErrorCode() override; | 112 net::Error GetNetErrorCode() override; |
| 110 RenderFrameHostImpl* GetRenderFrameHost() override; | 113 RenderFrameHostImpl* GetRenderFrameHost() override; |
| 111 bool IsSamePage() override; | 114 bool IsSamePage() override; |
| 112 bool HasCommitted() override; | 115 bool HasCommitted() override; |
| 113 bool IsErrorPage() override; | 116 bool IsErrorPage() override; |
| 117 bool DidReplaceEntry() override; |
| 118 bool ShouldUpdateHistory() override; |
| 114 const GURL& GetPreviousURL() override; | 119 const GURL& GetPreviousURL() override; |
| 115 net::HostPortPair GetSocketAddress() override; | 120 net::HostPortPair GetSocketAddress() override; |
| 116 const net::HttpResponseHeaders* GetResponseHeaders() override; | 121 const net::HttpResponseHeaders* GetResponseHeaders() override; |
| 117 net::HttpResponseInfo::ConnectionInfo GetConnectionInfo() override; | 122 net::HttpResponseInfo::ConnectionInfo GetConnectionInfo() override; |
| 118 void Resume() override; | 123 void Resume() override; |
| 119 void CancelDeferredNavigation( | 124 void CancelDeferredNavigation( |
| 120 NavigationThrottle::ThrottleCheckResult result) override; | 125 NavigationThrottle::ThrottleCheckResult result) override; |
| 121 void RegisterThrottleForTesting( | 126 void RegisterThrottleForTesting( |
| 122 std::unique_ptr<NavigationThrottle> navigation_throttle) override; | 127 std::unique_ptr<NavigationThrottle> navigation_throttle) override; |
| 123 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( | 128 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // Returns the FrameTreeNode this navigation is happening in. | 276 // Returns the FrameTreeNode this navigation is happening in. |
| 272 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 277 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
| 273 | 278 |
| 274 // Called when the navigation is ready to be committed in | 279 // Called when the navigation is ready to be committed in |
| 275 // |render_frame_host|. This will update the |state_| and inform the | 280 // |render_frame_host|. This will update the |state_| and inform the |
| 276 // delegate. | 281 // delegate. |
| 277 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host); | 282 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host); |
| 278 | 283 |
| 279 // Called when the navigation was committed in |render_frame_host|. This will | 284 // Called when the navigation was committed in |render_frame_host|. This will |
| 280 // update the |state_|. | 285 // update the |state_|. |
| 286 // |did_replace_entry| is true if the committed entry has replaced the |
| 287 // existing one. A non-user initiated redirect causes such replacement. |
| 281 void DidCommitNavigation( | 288 void DidCommitNavigation( |
| 282 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 289 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 283 bool same_page, | 290 bool did_replace_entry, |
| 284 const GURL& previous_url, | 291 const GURL& previous_url, |
| 285 RenderFrameHostImpl* render_frame_host); | 292 RenderFrameHostImpl* render_frame_host); |
| 286 | 293 |
| 287 // Called during commit. Takes ownership of the embedder's NavigationData | 294 // Called during commit. Takes ownership of the embedder's NavigationData |
| 288 // instance. This NavigationData may have been cloned prior to being added | 295 // instance. This NavigationData may have been cloned prior to being added |
| 289 // here. | 296 // here. |
| 290 void set_navigation_data(std::unique_ptr<NavigationData> navigation_data) { | 297 void set_navigation_data(std::unique_ptr<NavigationData> navigation_data) { |
| 291 navigation_data_ = std::move(navigation_data); | 298 navigation_data_ = std::move(navigation_data); |
| 292 } | 299 } |
| 293 | 300 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 319 DEFERRING_REDIRECT, | 326 DEFERRING_REDIRECT, |
| 320 CANCELING, | 327 CANCELING, |
| 321 WILL_PROCESS_RESPONSE, | 328 WILL_PROCESS_RESPONSE, |
| 322 DEFERRING_RESPONSE, | 329 DEFERRING_RESPONSE, |
| 323 READY_TO_COMMIT, | 330 READY_TO_COMMIT, |
| 324 DID_COMMIT, | 331 DID_COMMIT, |
| 325 DID_COMMIT_ERROR_PAGE, | 332 DID_COMMIT_ERROR_PAGE, |
| 326 }; | 333 }; |
| 327 | 334 |
| 328 NavigationHandleImpl(const GURL& url, | 335 NavigationHandleImpl(const GURL& url, |
| 336 const std::vector<GURL>& redirect_chain, |
| 329 FrameTreeNode* frame_tree_node, | 337 FrameTreeNode* frame_tree_node, |
| 330 bool is_renderer_initiated, | 338 bool is_renderer_initiated, |
| 331 bool is_same_page, | 339 bool is_same_page, |
| 332 const base::TimeTicks& navigation_start, | 340 const base::TimeTicks& navigation_start, |
| 333 int pending_nav_entry_id, | 341 int pending_nav_entry_id, |
| 334 bool started_from_context_menu); | 342 bool started_from_context_menu); |
| 335 | 343 |
| 336 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 344 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
| 337 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 345 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
| 338 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 346 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 365 scoped_refptr<SiteInstance> starting_site_instance_; | 373 scoped_refptr<SiteInstance> starting_site_instance_; |
| 366 Referrer sanitized_referrer_; | 374 Referrer sanitized_referrer_; |
| 367 bool has_user_gesture_; | 375 bool has_user_gesture_; |
| 368 ui::PageTransition transition_; | 376 ui::PageTransition transition_; |
| 369 bool is_external_protocol_; | 377 bool is_external_protocol_; |
| 370 net::Error net_error_code_; | 378 net::Error net_error_code_; |
| 371 RenderFrameHostImpl* render_frame_host_; | 379 RenderFrameHostImpl* render_frame_host_; |
| 372 const bool is_renderer_initiated_; | 380 const bool is_renderer_initiated_; |
| 373 const bool is_same_page_; | 381 const bool is_same_page_; |
| 374 bool was_redirected_; | 382 bool was_redirected_; |
| 383 bool did_replace_entry_; |
| 384 bool should_update_history_; |
| 375 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 385 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 376 net::HttpResponseInfo::ConnectionInfo connection_info_; | 386 net::HttpResponseInfo::ConnectionInfo connection_info_; |
| 377 | 387 |
| 378 // The original url of the navigation. This may differ from |url_| if the | 388 // The original url of the navigation. This may differ from |url_| if the |
| 379 // navigation encounters redirects. | 389 // navigation encounters redirects. |
| 380 const GURL original_url_; | 390 const GURL original_url_; |
| 381 | 391 |
| 382 // The HTTP method used for the navigation. | 392 // The HTTP method used for the navigation. |
| 383 std::string method_; | 393 std::string method_; |
| 384 | 394 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 net::HostPortPair socket_address_; | 478 net::HostPortPair socket_address_; |
| 469 | 479 |
| 470 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 480 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
| 471 | 481 |
| 472 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 482 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 473 }; | 483 }; |
| 474 | 484 |
| 475 } // namespace content | 485 } // namespace content |
| 476 | 486 |
| 477 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 487 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |