| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // PlzNavigate: This value always comes from the CommonNavigationParams | 78 // PlzNavigate: This value always comes from the CommonNavigationParams |
| 79 // associated with this navigation. | 79 // associated with this navigation. |
| 80 static std::unique_ptr<NavigationHandleImpl> Create( | 80 static std::unique_ptr<NavigationHandleImpl> Create( |
| 81 const GURL& url, | 81 const GURL& url, |
| 82 FrameTreeNode* frame_tree_node, | 82 FrameTreeNode* frame_tree_node, |
| 83 bool is_renderer_initiated, | 83 bool is_renderer_initiated, |
| 84 bool is_same_page, | 84 bool is_same_page, |
| 85 bool is_srcdoc, | 85 bool is_srcdoc, |
| 86 const base::TimeTicks& navigation_start, | 86 const base::TimeTicks& navigation_start, |
| 87 int pending_nav_entry_id, | 87 int pending_nav_entry_id, |
| 88 NavigationGesture gesture, |
| 88 bool started_from_context_menu); | 89 bool started_from_context_menu); |
| 89 ~NavigationHandleImpl() override; | 90 ~NavigationHandleImpl() override; |
| 90 | 91 |
| 91 // NavigationHandle implementation: | 92 // NavigationHandle implementation: |
| 92 const GURL& GetURL() override; | 93 const GURL& GetURL() override; |
| 93 SiteInstance* GetStartingSiteInstance() override; | 94 SiteInstance* GetStartingSiteInstance() override; |
| 94 bool IsInMainFrame() override; | 95 bool IsInMainFrame() override; |
| 95 bool IsParentMainFrame() override; | 96 bool IsParentMainFrame() override; |
| 96 bool IsRendererInitiated() override; | 97 bool IsRendererInitiated() override; |
| 97 bool IsSrcdoc() override; | 98 bool IsSrcdoc() override; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 112 const net::HttpResponseHeaders* GetResponseHeaders() override; | 113 const net::HttpResponseHeaders* GetResponseHeaders() override; |
| 113 net::HttpResponseInfo::ConnectionInfo GetConnectionInfo() override; | 114 net::HttpResponseInfo::ConnectionInfo GetConnectionInfo() override; |
| 114 void Resume() override; | 115 void Resume() override; |
| 115 void CancelDeferredNavigation( | 116 void CancelDeferredNavigation( |
| 116 NavigationThrottle::ThrottleCheckResult result) override; | 117 NavigationThrottle::ThrottleCheckResult result) override; |
| 117 void RegisterThrottleForTesting( | 118 void RegisterThrottleForTesting( |
| 118 std::unique_ptr<NavigationThrottle> navigation_throttle) override; | 119 std::unique_ptr<NavigationThrottle> navigation_throttle) override; |
| 119 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( | 120 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( |
| 120 bool is_post, | 121 bool is_post, |
| 121 const Referrer& sanitized_referrer, | 122 const Referrer& sanitized_referrer, |
| 122 bool has_user_gesture, | |
| 123 ui::PageTransition transition, | 123 ui::PageTransition transition, |
| 124 bool is_external_protocol) override; | 124 bool is_external_protocol) override; |
| 125 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( | 125 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( |
| 126 const GURL& new_url, | 126 const GURL& new_url, |
| 127 bool new_method_is_post, | 127 bool new_method_is_post, |
| 128 const GURL& new_referrer_url, | 128 const GURL& new_referrer_url, |
| 129 bool new_is_external_protocol) override; | 129 bool new_is_external_protocol) override; |
| 130 NavigationThrottle::ThrottleCheckResult CallWillProcessResponseForTesting( | 130 NavigationThrottle::ThrottleCheckResult CallWillProcessResponseForTesting( |
| 131 RenderFrameHost* render_frame_host, | 131 RenderFrameHost* render_frame_host, |
| 132 const std::string& raw_response_header) override; | 132 const std::string& raw_response_header) override; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 201 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
| 202 ThrottleChecksFinishedCallback; | 202 ThrottleChecksFinishedCallback; |
| 203 | 203 |
| 204 // Called when the URLRequest will start in the network stack. |callback| | 204 // Called when the URLRequest will start in the network stack. |callback| |
| 205 // will be called when all throttle checks have completed. This will allow | 205 // will be called when all throttle checks have completed. This will allow |
| 206 // the caller to cancel the navigation or let it proceed. | 206 // the caller to cancel the navigation or let it proceed. |
| 207 void WillStartRequest( | 207 void WillStartRequest( |
| 208 const std::string& method, | 208 const std::string& method, |
| 209 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, | 209 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
| 210 const Referrer& sanitized_referrer, | 210 const Referrer& sanitized_referrer, |
| 211 bool has_user_gesture, | |
| 212 ui::PageTransition transition, | 211 ui::PageTransition transition, |
| 213 bool is_external_protocol, | 212 bool is_external_protocol, |
| 214 RequestContextType request_context_type, | 213 RequestContextType request_context_type, |
| 215 const ThrottleChecksFinishedCallback& callback); | 214 const ThrottleChecksFinishedCallback& callback); |
| 216 | 215 |
| 217 // Called when the URLRequest will be redirected in the network stack. | 216 // Called when the URLRequest will be redirected in the network stack. |
| 218 // |callback| will be called when all throttles check have completed. This | 217 // |callback| will be called when all throttles check have completed. This |
| 219 // will allow the caller to cancel the navigation or let it proceed. | 218 // will allow the caller to cancel the navigation or let it proceed. |
| 220 // This will also inform the delegate that the request was redirected. | 219 // This will also inform the delegate that the request was redirected. |
| 221 void WillRedirectRequest( | 220 void WillRedirectRequest( |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 DID_COMMIT_ERROR_PAGE, | 301 DID_COMMIT_ERROR_PAGE, |
| 303 }; | 302 }; |
| 304 | 303 |
| 305 NavigationHandleImpl(const GURL& url, | 304 NavigationHandleImpl(const GURL& url, |
| 306 FrameTreeNode* frame_tree_node, | 305 FrameTreeNode* frame_tree_node, |
| 307 bool is_renderer_initiated, | 306 bool is_renderer_initiated, |
| 308 bool is_same_page, | 307 bool is_same_page, |
| 309 bool is_srcdoc, | 308 bool is_srcdoc, |
| 310 const base::TimeTicks& navigation_start, | 309 const base::TimeTicks& navigation_start, |
| 311 int pending_nav_entry_id, | 310 int pending_nav_entry_id, |
| 311 NavigationGesture gesture, |
| 312 bool started_from_context_menu); | 312 bool started_from_context_menu); |
| 313 | 313 |
| 314 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 314 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
| 315 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 315 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
| 316 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 316 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
| 317 | 317 |
| 318 // Called when WillProcessResponse checks are done, to find the final | 318 // Called when WillProcessResponse checks are done, to find the final |
| 319 // RenderFrameHost for the navigation. Checks whether the navigation should be | 319 // RenderFrameHost for the navigation. Checks whether the navigation should be |
| 320 // transferred. Returns false if the transfer attempt results in the | 320 // transferred. Returns false if the transfer attempt results in the |
| 321 // destruction of this NavigationHandle and the navigation should no longer | 321 // destruction of this NavigationHandle and the navigation should no longer |
| (...skipping 13 matching lines...) Expand all Loading... |
| 335 // Used in tests. | 335 // Used in tests. |
| 336 State state() const { return state_; } | 336 State state() const { return state_; } |
| 337 | 337 |
| 338 // Populates |throttles_| with the throttles for this navigation. | 338 // Populates |throttles_| with the throttles for this navigation. |
| 339 void RegisterNavigationThrottles(); | 339 void RegisterNavigationThrottles(); |
| 340 | 340 |
| 341 // See NavigationHandle for a description of those member variables. | 341 // See NavigationHandle for a description of those member variables. |
| 342 GURL url_; | 342 GURL url_; |
| 343 scoped_refptr<SiteInstance> starting_site_instance_; | 343 scoped_refptr<SiteInstance> starting_site_instance_; |
| 344 Referrer sanitized_referrer_; | 344 Referrer sanitized_referrer_; |
| 345 bool has_user_gesture_; | 345 NavigationGesture gesture_; |
| 346 ui::PageTransition transition_; | 346 ui::PageTransition transition_; |
| 347 bool is_external_protocol_; | 347 bool is_external_protocol_; |
| 348 net::Error net_error_code_; | 348 net::Error net_error_code_; |
| 349 RenderFrameHostImpl* render_frame_host_; | 349 RenderFrameHostImpl* render_frame_host_; |
| 350 const bool is_renderer_initiated_; | 350 const bool is_renderer_initiated_; |
| 351 const bool is_same_page_; | 351 const bool is_same_page_; |
| 352 const bool is_srcdoc_; | 352 const bool is_srcdoc_; |
| 353 bool was_redirected_; | 353 bool was_redirected_; |
| 354 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 354 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 355 net::HttpResponseInfo::ConnectionInfo connection_info_; | 355 net::HttpResponseInfo::ConnectionInfo connection_info_; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 std::string searchable_form_encoding_; | 431 std::string searchable_form_encoding_; |
| 432 | 432 |
| 433 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 433 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
| 434 | 434 |
| 435 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 435 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 436 }; | 436 }; |
| 437 | 437 |
| 438 } // namespace content | 438 } // namespace content |
| 439 | 439 |
| 440 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 440 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |