| 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/ref_counted.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "content/browser/frame_host/frame_tree_node.h" | 16 #include "content/browser/frame_host/frame_tree_node.h" |
| 17 #include "content/browser/frame_host/render_frame_host_impl.h" | 17 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/public/browser/navigation_data.h" | 19 #include "content/public/browser/navigation_data.h" |
| 20 #include "content/public/browser/navigation_throttle.h" | 20 #include "content/public/browser/navigation_throttle.h" |
| 21 #include "content/public/common/request_context_type.h" |
| 21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 22 | 23 |
| 23 struct FrameHostMsg_DidCommitProvisionalLoad_Params; | 24 struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 | 27 |
| 27 class NavigatorDelegate; | 28 class NavigatorDelegate; |
| 28 class ResourceRequestBodyImpl; | 29 class ResourceRequestBodyImpl; |
| 29 struct NavigationRequestInfo; | |
| 30 | 30 |
| 31 // This class keeps track of a single navigation. It is created upon receipt of | 31 // This class keeps track of a single navigation. It is created upon receipt of |
| 32 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns | 32 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns |
| 33 // the newly created NavigationHandleImpl as long as the navigation is ongoing. | 33 // the newly created NavigationHandleImpl as long as the navigation is ongoing. |
| 34 // The NavigationHandleImpl in the RenderFrameHost will be reset when the | 34 // The NavigationHandleImpl in the RenderFrameHost will be reset when the |
| 35 // navigation stops, that is if one of the following events happen: | 35 // navigation stops, that is if one of the following events happen: |
| 36 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new | 36 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new |
| 37 // navigation (see below for special cases where the DidStartProvisionalLoad | 37 // navigation (see below for special cases where the DidStartProvisionalLoad |
| 38 // message does not indicate the start of a new navigation). | 38 // message does not indicate the start of a new navigation). |
| 39 // - The RenderFrameHost stops loading. | 39 // - The RenderFrameHost stops loading. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 bool new_method_is_post, | 114 bool new_method_is_post, |
| 115 const GURL& new_referrer_url, | 115 const GURL& new_referrer_url, |
| 116 bool new_is_external_protocol) override; | 116 bool new_is_external_protocol) override; |
| 117 NavigationThrottle::ThrottleCheckResult CallWillProcessResponseForTesting( | 117 NavigationThrottle::ThrottleCheckResult CallWillProcessResponseForTesting( |
| 118 RenderFrameHost* render_frame_host) override; | 118 RenderFrameHost* render_frame_host) override; |
| 119 | 119 |
| 120 NavigationData* GetNavigationData() override; | 120 NavigationData* GetNavigationData() override; |
| 121 | 121 |
| 122 NavigatorDelegate* GetDelegate() const; | 122 NavigatorDelegate* GetDelegate() const; |
| 123 | 123 |
| 124 RequestContextType GetRequestContextType() const; |
| 125 |
| 124 // Returns the response headers for the request or nullptr if there are none. | 126 // Returns the response headers for the request or nullptr if there are none. |
| 125 // This should only be accessed after a redirect was encountered or after the | 127 // This should only be accessed after a redirect was encountered or after the |
| 126 // navigation is ready to commit. The headers returned should not be modified, | 128 // navigation is ready to commit. The headers returned should not be modified, |
| 127 // as modifications will not be reflected in the network stack. | 129 // as modifications will not be reflected in the network stack. |
| 128 const net::HttpResponseHeaders* GetResponseHeaders(); | 130 const net::HttpResponseHeaders* GetResponseHeaders(); |
| 129 | 131 |
| 130 // Get the unique id from the NavigationEntry associated with this | 132 // Get the unique id from the NavigationEntry associated with this |
| 131 // NavigationHandle. Note that a synchronous, renderer-initiated navigation | 133 // NavigationHandle. Note that a synchronous, renderer-initiated navigation |
| 132 // will not have a NavigationEntry associated with it, and this will return 0. | 134 // will not have a NavigationEntry associated with it, and this will return 0. |
| 133 int pending_nav_entry_id() const { return pending_nav_entry_id_; } | 135 int pending_nav_entry_id() const { return pending_nav_entry_id_; } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // Called when the URLRequest will start in the network stack. |callback| | 174 // Called when the URLRequest will start in the network stack. |callback| |
| 173 // will be called when all throttle checks have completed. This will allow | 175 // will be called when all throttle checks have completed. This will allow |
| 174 // the caller to cancel the navigation or let it proceed. | 176 // the caller to cancel the navigation or let it proceed. |
| 175 void WillStartRequest( | 177 void WillStartRequest( |
| 176 const std::string& method, | 178 const std::string& method, |
| 177 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, | 179 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
| 178 const Referrer& sanitized_referrer, | 180 const Referrer& sanitized_referrer, |
| 179 bool has_user_gesture, | 181 bool has_user_gesture, |
| 180 ui::PageTransition transition, | 182 ui::PageTransition transition, |
| 181 bool is_external_protocol, | 183 bool is_external_protocol, |
| 184 RequestContextType request_context_type, |
| 182 const ThrottleChecksFinishedCallback& callback); | 185 const ThrottleChecksFinishedCallback& callback); |
| 183 | 186 |
| 184 // Called when the URLRequest will be redirected in the network stack. | 187 // Called when the URLRequest will be redirected in the network stack. |
| 185 // |callback| will be called when all throttles check have completed. This | 188 // |callback| will be called when all throttles check have completed. This |
| 186 // will allow the caller to cancel the navigation or let it proceed. | 189 // will allow the caller to cancel the navigation or let it proceed. |
| 187 // This will also inform the delegate that the request was redirected. | 190 // This will also inform the delegate that the request was redirected. |
| 188 void WillRedirectRequest( | 191 void WillRedirectRequest( |
| 189 const GURL& new_url, | 192 const GURL& new_url, |
| 190 const std::string& new_method, | 193 const std::string& new_method, |
| 191 const GURL& new_referrer_url, | 194 const GURL& new_referrer_url, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 308 |
| 306 // The index of the next throttle to check. | 309 // The index of the next throttle to check. |
| 307 size_t next_index_; | 310 size_t next_index_; |
| 308 | 311 |
| 309 // The time this navigation started. | 312 // The time this navigation started. |
| 310 const base::TimeTicks navigation_start_; | 313 const base::TimeTicks navigation_start_; |
| 311 | 314 |
| 312 // The unique id of the corresponding NavigationEntry. | 315 // The unique id of the corresponding NavigationEntry. |
| 313 int pending_nav_entry_id_; | 316 int pending_nav_entry_id_; |
| 314 | 317 |
| 318 // The fetch request context type. |
| 319 RequestContextType request_context_type_; |
| 320 |
| 315 // This callback will be run when all throttle checks have been performed. | 321 // This callback will be run when all throttle checks have been performed. |
| 316 ThrottleChecksFinishedCallback complete_callback_; | 322 ThrottleChecksFinishedCallback complete_callback_; |
| 317 | 323 |
| 318 // Embedder data tied to this navigation. | 324 // Embedder data tied to this navigation. |
| 319 std::unique_ptr<NavigationData> navigation_data_; | 325 std::unique_ptr<NavigationData> navigation_data_; |
| 320 | 326 |
| 321 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 327 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 322 }; | 328 }; |
| 323 | 329 |
| 324 } // namespace content | 330 } // namespace content |
| 325 | 331 |
| 326 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 332 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |