Chromium Code Reviews| 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/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 15 #include "content/browser/frame_host/frame_tree_node.h" | 16 #include "content/browser/frame_host/frame_tree_node.h" |
| 16 #include "content/browser/frame_host/render_frame_host_impl.h" | 17 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 18 #include "content/public/browser/navigation_data.h" | 19 #include "content/public/browser/navigation_data.h" |
| 19 #include "content/public/browser/navigation_throttle.h" | 20 #include "content/public/browser/navigation_throttle.h" |
| 20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 21 | 22 |
| 22 struct FrameHostMsg_DidCommitProvisionalLoad_Params; | 23 struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 | 26 |
| 26 class NavigatorDelegate; | 27 class NavigatorDelegate; |
| 28 class ResourceRequestBody; | |
| 27 class ServiceWorkerContextWrapper; | 29 class ServiceWorkerContextWrapper; |
| 28 class ServiceWorkerNavigationHandle; | 30 class ServiceWorkerNavigationHandle; |
| 29 struct NavigationRequestInfo; | 31 struct NavigationRequestInfo; |
| 30 | 32 |
| 31 // This class keeps track of a single navigation. It is created upon receipt of | 33 // This class keeps track of a single navigation. It is created upon receipt of |
| 32 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns | 34 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns |
| 33 // the newly created NavigationHandleImpl as long as the navigation is ongoing. | 35 // the newly created NavigationHandleImpl as long as the navigation is ongoing. |
| 34 // The NavigationHandleImpl in the RenderFrameHost will be reset when the | 36 // The NavigationHandleImpl in the RenderFrameHost will be reset when the |
| 35 // navigation stops, that is if one of the following events happen: | 37 // navigation stops, that is if one of the following events happen: |
| 36 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new | 38 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 void set_is_transferring(bool is_transferring) { | 151 void set_is_transferring(bool is_transferring) { |
| 150 is_transferring_ = is_transferring; | 152 is_transferring_ = is_transferring; |
| 151 } | 153 } |
| 152 | 154 |
| 153 // Updates the RenderFrameHost that is about to commit the navigation. This | 155 // Updates the RenderFrameHost that is about to commit the navigation. This |
| 154 // is used during transfer navigations. | 156 // is used during transfer navigations. |
| 155 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) { | 157 void set_render_frame_host(RenderFrameHostImpl* render_frame_host) { |
| 156 render_frame_host_ = render_frame_host; | 158 render_frame_host_ = render_frame_host; |
| 157 } | 159 } |
| 158 | 160 |
| 161 // Gets post body associated with this navigation. | |
| 162 const scoped_refptr<ResourceRequestBody>& resource_request_body() const { | |
| 163 return resource_request_body_; | |
| 164 } | |
| 165 | |
| 166 // Gets HTTP method associated with this navigation. | |
| 167 const std::string& method() const { return method_; } | |
|
clamy
2016/05/23 15:32:28
Suggestion: should we change the public interface
Łukasz Anforowicz
2016/05/23 16:25:10
Yes - this seems like the right thing to do - only
| |
| 168 | |
| 159 // PlzNavigate | 169 // PlzNavigate |
| 160 void InitServiceWorkerHandle( | 170 void InitServiceWorkerHandle( |
| 161 ServiceWorkerContextWrapper* service_worker_context); | 171 ServiceWorkerContextWrapper* service_worker_context); |
| 162 ServiceWorkerNavigationHandle* service_worker_handle() const { | 172 ServiceWorkerNavigationHandle* service_worker_handle() const { |
| 163 return service_worker_handle_.get(); | 173 return service_worker_handle_.get(); |
| 164 } | 174 } |
| 165 | 175 |
| 166 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 176 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
| 167 ThrottleChecksFinishedCallback; | 177 ThrottleChecksFinishedCallback; |
| 168 | 178 |
| 169 // Called when the URLRequest will start in the network stack. |callback| | 179 // Called when the URLRequest will start in the network stack. |callback| |
| 170 // will be called when all throttle checks have completed. This will allow | 180 // will be called when all throttle checks have completed. This will allow |
| 171 // the caller to cancel the navigation or let it proceed. | 181 // the caller to cancel the navigation or let it proceed. |
| 172 void WillStartRequest(const std::string& method, | 182 void WillStartRequest( |
| 173 const Referrer& sanitized_referrer, | 183 const std::string& method, |
| 174 bool has_user_gesture, | 184 const scoped_refptr<content::ResourceRequestBody>& resource_request_body, |
| 175 ui::PageTransition transition, | 185 const Referrer& sanitized_referrer, |
| 176 bool is_external_protocol, | 186 bool has_user_gesture, |
| 177 const ThrottleChecksFinishedCallback& callback); | 187 ui::PageTransition transition, |
| 188 bool is_external_protocol, | |
| 189 const ThrottleChecksFinishedCallback& callback); | |
| 178 | 190 |
| 179 // Called when the URLRequest will be redirected in the network stack. | 191 // Called when the URLRequest will be redirected in the network stack. |
| 180 // |callback| will be called when all throttles check have completed. This | 192 // |callback| will be called when all throttles check have completed. This |
| 181 // will allow the caller to cancel the navigation or let it proceed. | 193 // will allow the caller to cancel the navigation or let it proceed. |
| 182 // This will also inform the delegate that the request was redirected. | 194 // This will also inform the delegate that the request was redirected. |
| 183 void WillRedirectRequest( | 195 void WillRedirectRequest( |
| 184 const GURL& new_url, | 196 const GURL& new_url, |
| 185 const std::string& new_method, | 197 const std::string& new_method, |
| 186 const GURL& new_referrer_url, | 198 const GURL& new_referrer_url, |
| 187 bool new_is_external_protocol, | 199 bool new_is_external_protocol, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 const bool is_renderer_initiated_; | 282 const bool is_renderer_initiated_; |
| 271 bool is_same_page_; | 283 bool is_same_page_; |
| 272 const bool is_synchronous_; | 284 const bool is_synchronous_; |
| 273 const bool is_srcdoc_; | 285 const bool is_srcdoc_; |
| 274 bool was_redirected_; | 286 bool was_redirected_; |
| 275 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 287 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 276 | 288 |
| 277 // The HTTP method used for the navigation. | 289 // The HTTP method used for the navigation. |
| 278 std::string method_; | 290 std::string method_; |
| 279 | 291 |
| 292 // The body of the request (i.e. body of a post request). | |
| 293 scoped_refptr<ResourceRequestBody> resource_request_body_; | |
| 294 | |
| 280 // The state the navigation is in. | 295 // The state the navigation is in. |
| 281 State state_; | 296 State state_; |
| 282 | 297 |
| 283 // Whether the navigation is in the middle of a transfer. Set to false when | 298 // Whether the navigation is in the middle of a transfer. Set to false when |
| 284 // the DidStartProvisionalLoad is received from the new renderer. | 299 // the DidStartProvisionalLoad is received from the new renderer. |
| 285 bool is_transferring_; | 300 bool is_transferring_; |
| 286 | 301 |
| 287 // The FrameTreeNode this navigation is happening in. | 302 // The FrameTreeNode this navigation is happening in. |
| 288 FrameTreeNode* frame_tree_node_; | 303 FrameTreeNode* frame_tree_node_; |
| 289 | 304 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 309 | 324 |
| 310 // Embedder data tied to this navigation. | 325 // Embedder data tied to this navigation. |
| 311 std::unique_ptr<NavigationData> navigation_data_; | 326 std::unique_ptr<NavigationData> navigation_data_; |
| 312 | 327 |
| 313 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 328 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 314 }; | 329 }; |
| 315 | 330 |
| 316 } // namespace content | 331 } // namespace content |
| 317 | 332 |
| 318 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 333 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |