| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // both renderer-initiated and browser-initiated navigation start. | 79 // both renderer-initiated and browser-initiated navigation start. |
| 80 // PlzNavigate: This value always comes from the CommonNavigationParams | 80 // PlzNavigate: This value always comes from the CommonNavigationParams |
| 81 // associated with this navigation. | 81 // associated with this navigation. |
| 82 static std::unique_ptr<NavigationHandleImpl> Create( | 82 static std::unique_ptr<NavigationHandleImpl> Create( |
| 83 const GURL& url, | 83 const GURL& url, |
| 84 FrameTreeNode* frame_tree_node, | 84 FrameTreeNode* frame_tree_node, |
| 85 bool is_renderer_initiated, | 85 bool is_renderer_initiated, |
| 86 bool is_same_page, | 86 bool is_same_page, |
| 87 const base::TimeTicks& navigation_start, | 87 const base::TimeTicks& navigation_start, |
| 88 int pending_nav_entry_id, | 88 int pending_nav_entry_id, |
| 89 NavigationGesture gesture, | |
| 90 bool started_from_context_menu); | 89 bool started_from_context_menu); |
| 91 ~NavigationHandleImpl() override; | 90 ~NavigationHandleImpl() override; |
| 92 | 91 |
| 93 // NavigationHandle implementation: | 92 // NavigationHandle implementation: |
| 94 const GURL& GetURL() override; | 93 const GURL& GetURL() override; |
| 95 SiteInstance* GetStartingSiteInstance() override; | 94 SiteInstance* GetStartingSiteInstance() override; |
| 96 bool IsInMainFrame() override; | 95 bool IsInMainFrame() override; |
| 97 bool IsParentMainFrame() override; | 96 bool IsParentMainFrame() override; |
| 98 bool IsRendererInitiated() override; | 97 bool IsRendererInitiated() override; |
| 99 bool WasServerRedirect() override; | 98 bool WasServerRedirect() override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 113 const net::HttpResponseHeaders* GetResponseHeaders() override; | 112 const net::HttpResponseHeaders* GetResponseHeaders() override; |
| 114 net::HttpResponseInfo::ConnectionInfo GetConnectionInfo() override; | 113 net::HttpResponseInfo::ConnectionInfo GetConnectionInfo() override; |
| 115 void Resume() override; | 114 void Resume() override; |
| 116 void CancelDeferredNavigation( | 115 void CancelDeferredNavigation( |
| 117 NavigationThrottle::ThrottleCheckResult result) override; | 116 NavigationThrottle::ThrottleCheckResult result) override; |
| 118 void RegisterThrottleForTesting( | 117 void RegisterThrottleForTesting( |
| 119 std::unique_ptr<NavigationThrottle> navigation_throttle) override; | 118 std::unique_ptr<NavigationThrottle> navigation_throttle) override; |
| 120 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( | 119 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( |
| 121 bool is_post, | 120 bool is_post, |
| 122 const Referrer& sanitized_referrer, | 121 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 207 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
| 208 ThrottleChecksFinishedCallback; | 208 ThrottleChecksFinishedCallback; |
| 209 | 209 |
| 210 // Called when the URLRequest will start in the network stack. |callback| | 210 // Called when the URLRequest will start in the network stack. |callback| |
| 211 // will be called when all throttle checks have completed. This will allow | 211 // will be called when all throttle checks have completed. This will allow |
| 212 // the caller to cancel the navigation or let it proceed. | 212 // the caller to cancel the navigation or let it proceed. |
| 213 void WillStartRequest( | 213 void WillStartRequest( |
| 214 const std::string& method, | 214 const std::string& method, |
| 215 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, | 215 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
| 216 const Referrer& sanitized_referrer, | 216 const Referrer& sanitized_referrer, |
| 217 bool has_user_gesture, |
| 217 ui::PageTransition transition, | 218 ui::PageTransition transition, |
| 218 bool is_external_protocol, | 219 bool is_external_protocol, |
| 219 RequestContextType request_context_type, | 220 RequestContextType request_context_type, |
| 220 const ThrottleChecksFinishedCallback& callback); | 221 const ThrottleChecksFinishedCallback& callback); |
| 221 | 222 |
| 222 // Called when the URLRequest will be redirected in the network stack. | 223 // Called when the URLRequest will be redirected in the network stack. |
| 223 // |callback| will be called when all throttles check have completed. This | 224 // |callback| will be called when all throttles check have completed. This |
| 224 // will allow the caller to cancel the navigation or let it proceed. | 225 // will allow the caller to cancel the navigation or let it proceed. |
| 225 // This will also inform the delegate that the request was redirected. | 226 // This will also inform the delegate that the request was redirected. |
| 226 void WillRedirectRequest( | 227 void WillRedirectRequest( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 DID_COMMIT, | 307 DID_COMMIT, |
| 307 DID_COMMIT_ERROR_PAGE, | 308 DID_COMMIT_ERROR_PAGE, |
| 308 }; | 309 }; |
| 309 | 310 |
| 310 NavigationHandleImpl(const GURL& url, | 311 NavigationHandleImpl(const GURL& url, |
| 311 FrameTreeNode* frame_tree_node, | 312 FrameTreeNode* frame_tree_node, |
| 312 bool is_renderer_initiated, | 313 bool is_renderer_initiated, |
| 313 bool is_same_page, | 314 bool is_same_page, |
| 314 const base::TimeTicks& navigation_start, | 315 const base::TimeTicks& navigation_start, |
| 315 int pending_nav_entry_id, | 316 int pending_nav_entry_id, |
| 316 NavigationGesture gesture, | |
| 317 bool started_from_context_menu); | 317 bool started_from_context_menu); |
| 318 | 318 |
| 319 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 319 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
| 320 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 320 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
| 321 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 321 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
| 322 | 322 |
| 323 // Called when WillProcessResponse checks are done, to find the final | 323 // Called when WillProcessResponse checks are done, to find the final |
| 324 // RenderFrameHost for the navigation. Checks whether the navigation should be | 324 // RenderFrameHost for the navigation. Checks whether the navigation should be |
| 325 // transferred. Returns false if the transfer attempt results in the | 325 // transferred. Returns false if the transfer attempt results in the |
| 326 // destruction of this NavigationHandle and the navigation should no longer | 326 // destruction of this NavigationHandle and the navigation should no longer |
| (...skipping 13 matching lines...) Expand all Loading... |
| 340 // Used in tests. | 340 // Used in tests. |
| 341 State state() const { return state_; } | 341 State state() const { return state_; } |
| 342 | 342 |
| 343 // Populates |throttles_| with the throttles for this navigation. | 343 // Populates |throttles_| with the throttles for this navigation. |
| 344 void RegisterNavigationThrottles(); | 344 void RegisterNavigationThrottles(); |
| 345 | 345 |
| 346 // See NavigationHandle for a description of those member variables. | 346 // See NavigationHandle for a description of those member variables. |
| 347 GURL url_; | 347 GURL url_; |
| 348 scoped_refptr<SiteInstance> starting_site_instance_; | 348 scoped_refptr<SiteInstance> starting_site_instance_; |
| 349 Referrer sanitized_referrer_; | 349 Referrer sanitized_referrer_; |
| 350 NavigationGesture gesture_; | 350 bool has_user_gesture_; |
| 351 ui::PageTransition transition_; | 351 ui::PageTransition transition_; |
| 352 bool is_external_protocol_; | 352 bool is_external_protocol_; |
| 353 net::Error net_error_code_; | 353 net::Error net_error_code_; |
| 354 RenderFrameHostImpl* render_frame_host_; | 354 RenderFrameHostImpl* render_frame_host_; |
| 355 const bool is_renderer_initiated_; | 355 const bool is_renderer_initiated_; |
| 356 const bool is_same_page_; | 356 const bool is_same_page_; |
| 357 bool was_redirected_; | 357 bool was_redirected_; |
| 358 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 358 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 359 net::HttpResponseInfo::ConnectionInfo connection_info_; | 359 net::HttpResponseInfo::ConnectionInfo connection_info_; |
| 360 | 360 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 std::string searchable_form_encoding_; | 441 std::string searchable_form_encoding_; |
| 442 | 442 |
| 443 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 443 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
| 444 | 444 |
| 445 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 445 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 446 }; | 446 }; |
| 447 | 447 |
| 448 } // namespace content | 448 } // namespace content |
| 449 | 449 |
| 450 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 450 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |