| 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 net::HttpResponseHeaders* GetResponseHeaders() override; | 119 const net::HttpResponseHeaders* GetResponseHeaders() override; |
| 115 net::HttpResponseInfo::ConnectionInfo GetConnectionInfo() override; | 120 net::HttpResponseInfo::ConnectionInfo GetConnectionInfo() override; |
| 116 void Resume() override; | 121 void Resume() override; |
| 117 void CancelDeferredNavigation( | 122 void CancelDeferredNavigation( |
| 118 NavigationThrottle::ThrottleCheckResult result) override; | 123 NavigationThrottle::ThrottleCheckResult result) override; |
| 119 void RegisterThrottleForTesting( | 124 void RegisterThrottleForTesting( |
| 120 std::unique_ptr<NavigationThrottle> navigation_throttle) override; | 125 std::unique_ptr<NavigationThrottle> navigation_throttle) override; |
| 121 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( | 126 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( |
| 122 bool is_post, | 127 bool is_post, |
| 123 const Referrer& sanitized_referrer, | 128 const Referrer& sanitized_referrer, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 // Returns the FrameTreeNode this navigation is happening in. | 274 // Returns the FrameTreeNode this navigation is happening in. |
| 270 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 275 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
| 271 | 276 |
| 272 // Called when the navigation is ready to be committed in | 277 // Called when the navigation is ready to be committed in |
| 273 // |render_frame_host|. This will update the |state_| and inform the | 278 // |render_frame_host|. This will update the |state_| and inform the |
| 274 // delegate. | 279 // delegate. |
| 275 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host); | 280 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host); |
| 276 | 281 |
| 277 // Called when the navigation was committed in |render_frame_host|. This will | 282 // Called when the navigation was committed in |render_frame_host|. This will |
| 278 // update the |state_|. | 283 // update the |state_|. |
| 284 // |did_replace_entry| is true if the committed entry has replaced the |
| 285 // existing one. A non-user initiated redirect causes such replacement. |
| 279 void DidCommitNavigation( | 286 void DidCommitNavigation( |
| 280 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 287 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 281 bool same_page, | 288 bool did_replace_entry, |
| 282 RenderFrameHostImpl* render_frame_host); | 289 RenderFrameHostImpl* render_frame_host); |
| 283 | 290 |
| 284 // Called during commit. Takes ownership of the embedder's NavigationData | 291 // Called during commit. Takes ownership of the embedder's NavigationData |
| 285 // instance. This NavigationData may have been cloned prior to being added | 292 // instance. This NavigationData may have been cloned prior to being added |
| 286 // here. | 293 // here. |
| 287 void set_navigation_data(std::unique_ptr<NavigationData> navigation_data) { | 294 void set_navigation_data(std::unique_ptr<NavigationData> navigation_data) { |
| 288 navigation_data_ = std::move(navigation_data); | 295 navigation_data_ = std::move(navigation_data); |
| 289 } | 296 } |
| 290 | 297 |
| 291 SSLStatus ssl_status() { return ssl_status_; } | 298 SSLStatus ssl_status() { return ssl_status_; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 314 DEFERRING_REDIRECT, | 321 DEFERRING_REDIRECT, |
| 315 CANCELING, | 322 CANCELING, |
| 316 WILL_PROCESS_RESPONSE, | 323 WILL_PROCESS_RESPONSE, |
| 317 DEFERRING_RESPONSE, | 324 DEFERRING_RESPONSE, |
| 318 READY_TO_COMMIT, | 325 READY_TO_COMMIT, |
| 319 DID_COMMIT, | 326 DID_COMMIT, |
| 320 DID_COMMIT_ERROR_PAGE, | 327 DID_COMMIT_ERROR_PAGE, |
| 321 }; | 328 }; |
| 322 | 329 |
| 323 NavigationHandleImpl(const GURL& url, | 330 NavigationHandleImpl(const GURL& url, |
| 331 const std::vector<GURL>& redirect_chain, |
| 324 FrameTreeNode* frame_tree_node, | 332 FrameTreeNode* frame_tree_node, |
| 325 bool is_renderer_initiated, | 333 bool is_renderer_initiated, |
| 326 bool is_same_page, | 334 bool is_same_page, |
| 327 const base::TimeTicks& navigation_start, | 335 const base::TimeTicks& navigation_start, |
| 328 int pending_nav_entry_id, | 336 int pending_nav_entry_id, |
| 329 bool started_from_context_menu); | 337 bool started_from_context_menu); |
| 330 | 338 |
| 331 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 339 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
| 332 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 340 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
| 333 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 341 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 360 scoped_refptr<SiteInstance> starting_site_instance_; | 368 scoped_refptr<SiteInstance> starting_site_instance_; |
| 361 Referrer sanitized_referrer_; | 369 Referrer sanitized_referrer_; |
| 362 bool has_user_gesture_; | 370 bool has_user_gesture_; |
| 363 ui::PageTransition transition_; | 371 ui::PageTransition transition_; |
| 364 bool is_external_protocol_; | 372 bool is_external_protocol_; |
| 365 net::Error net_error_code_; | 373 net::Error net_error_code_; |
| 366 RenderFrameHostImpl* render_frame_host_; | 374 RenderFrameHostImpl* render_frame_host_; |
| 367 const bool is_renderer_initiated_; | 375 const bool is_renderer_initiated_; |
| 368 const bool is_same_page_; | 376 const bool is_same_page_; |
| 369 bool was_redirected_; | 377 bool was_redirected_; |
| 378 bool did_replace_entry_; |
| 379 bool should_update_history_; |
| 370 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 380 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 371 net::HttpResponseInfo::ConnectionInfo connection_info_; | 381 net::HttpResponseInfo::ConnectionInfo connection_info_; |
| 372 | 382 |
| 373 // The original url of the navigation. This may differ from |url_| if the | 383 // The original url of the navigation. This may differ from |url_| if the |
| 374 // navigation encounters redirects. | 384 // navigation encounters redirects. |
| 375 const GURL original_url_; | 385 const GURL original_url_; |
| 376 | 386 |
| 377 // The HTTP method used for the navigation. | 387 // The HTTP method used for the navigation. |
| 378 std::string method_; | 388 std::string method_; |
| 379 | 389 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 std::string searchable_form_encoding_; | 469 std::string searchable_form_encoding_; |
| 460 | 470 |
| 461 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 471 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
| 462 | 472 |
| 463 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 473 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 464 }; | 474 }; |
| 465 | 475 |
| 466 } // namespace content | 476 } // namespace content |
| 467 | 477 |
| 468 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 478 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |