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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 const GURL& GetURL() override; | 83 const GURL& GetURL() override; |
| 82 bool IsInMainFrame() override; | 84 bool IsInMainFrame() override; |
| 83 bool IsParentMainFrame() override; | 85 bool IsParentMainFrame() override; |
| 84 bool IsRendererInitiated() override; | 86 bool IsRendererInitiated() override; |
| 85 bool IsSynchronousNavigation() override; | 87 bool IsSynchronousNavigation() override; |
| 86 bool IsSrcdoc() override; | 88 bool IsSrcdoc() override; |
| 87 bool WasServerRedirect() override; | 89 bool WasServerRedirect() override; |
| 88 int GetFrameTreeNodeId() override; | 90 int GetFrameTreeNodeId() override; |
| 89 int GetParentFrameTreeNodeId() override; | 91 int GetParentFrameTreeNodeId() override; |
| 90 const base::TimeTicks& NavigationStart() override; | 92 const base::TimeTicks& NavigationStart() override; |
| 91 bool IsPost() override; | 93 const std::string& GetMethod() override; |
| 92 const Referrer& GetReferrer() override; | 94 const Referrer& GetReferrer() override; |
| 93 bool HasUserGesture() override; | 95 bool HasUserGesture() override; |
| 94 ui::PageTransition GetPageTransition() override; | 96 ui::PageTransition GetPageTransition() override; |
| 95 bool IsExternalProtocol() override; | 97 bool IsExternalProtocol() override; |
| 96 net::Error GetNetErrorCode() override; | 98 net::Error GetNetErrorCode() override; |
| 97 RenderFrameHostImpl* GetRenderFrameHost() override; | 99 RenderFrameHostImpl* GetRenderFrameHost() override; |
| 98 bool IsSamePage() override; | 100 bool IsSamePage() override; |
| 99 bool HasCommitted() override; | 101 bool HasCommitted() override; |
| 100 bool IsErrorPage() override; | 102 bool IsErrorPage() override; |
| 101 void Resume() override; | 103 void Resume() override; |
| (...skipping 47 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. | |
|
clamy
2016/05/26 15:35:23
nit: s/Gets/Returns the
Łukasz Anforowicz
2016/05/26 17:14:02
Done.
| |
| 162 const scoped_refptr<ResourceRequestBody>& resource_request_body() const { | |
| 163 return resource_request_body_; | |
| 164 } | |
| 165 | |
| 159 // PlzNavigate | 166 // PlzNavigate |
| 160 void InitServiceWorkerHandle( | 167 void InitServiceWorkerHandle( |
| 161 ServiceWorkerContextWrapper* service_worker_context); | 168 ServiceWorkerContextWrapper* service_worker_context); |
| 162 ServiceWorkerNavigationHandle* service_worker_handle() const { | 169 ServiceWorkerNavigationHandle* service_worker_handle() const { |
| 163 return service_worker_handle_.get(); | 170 return service_worker_handle_.get(); |
| 164 } | 171 } |
| 165 | 172 |
| 166 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 173 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
| 167 ThrottleChecksFinishedCallback; | 174 ThrottleChecksFinishedCallback; |
| 168 | 175 |
| 169 // Called when the URLRequest will start in the network stack. |callback| | 176 // Called when the URLRequest will start in the network stack. |callback| |
| 170 // will be called when all throttle checks have completed. This will allow | 177 // will be called when all throttle checks have completed. This will allow |
| 171 // the caller to cancel the navigation or let it proceed. | 178 // the caller to cancel the navigation or let it proceed. |
| 172 void WillStartRequest(const std::string& method, | 179 void WillStartRequest( |
| 173 const Referrer& sanitized_referrer, | 180 const std::string& method, |
| 174 bool has_user_gesture, | 181 const scoped_refptr<content::ResourceRequestBody>& resource_request_body, |
| 175 ui::PageTransition transition, | 182 const Referrer& sanitized_referrer, |
| 176 bool is_external_protocol, | 183 bool has_user_gesture, |
| 177 const ThrottleChecksFinishedCallback& callback); | 184 ui::PageTransition transition, |
| 185 bool is_external_protocol, | |
| 186 const ThrottleChecksFinishedCallback& callback); | |
| 178 | 187 |
| 179 // Called when the URLRequest will be redirected in the network stack. | 188 // Called when the URLRequest will be redirected in the network stack. |
| 180 // |callback| will be called when all throttles check have completed. This | 189 // |callback| will be called when all throttles check have completed. This |
| 181 // will allow the caller to cancel the navigation or let it proceed. | 190 // will allow the caller to cancel the navigation or let it proceed. |
| 182 // This will also inform the delegate that the request was redirected. | 191 // This will also inform the delegate that the request was redirected. |
| 183 void WillRedirectRequest( | 192 void WillRedirectRequest( |
| 184 const GURL& new_url, | 193 const GURL& new_url, |
| 185 const std::string& new_method, | 194 const std::string& new_method, |
| 186 const GURL& new_referrer_url, | 195 const GURL& new_referrer_url, |
| 187 bool new_is_external_protocol, | 196 bool new_is_external_protocol, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 const bool is_renderer_initiated_; | 279 const bool is_renderer_initiated_; |
| 271 bool is_same_page_; | 280 bool is_same_page_; |
| 272 const bool is_synchronous_; | 281 const bool is_synchronous_; |
| 273 const bool is_srcdoc_; | 282 const bool is_srcdoc_; |
| 274 bool was_redirected_; | 283 bool was_redirected_; |
| 275 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 284 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 276 | 285 |
| 277 // The HTTP method used for the navigation. | 286 // The HTTP method used for the navigation. |
| 278 std::string method_; | 287 std::string method_; |
| 279 | 288 |
| 289 // The body of the request (i.e. body of a post request). | |
|
clamy
2016/05/26 15:35:23
nit: Precise that this will be null outside of POS
Łukasz Anforowicz
2016/05/26 17:14:02
Done.
| |
| 290 scoped_refptr<ResourceRequestBody> resource_request_body_; | |
| 291 | |
| 280 // The state the navigation is in. | 292 // The state the navigation is in. |
| 281 State state_; | 293 State state_; |
| 282 | 294 |
| 283 // Whether the navigation is in the middle of a transfer. Set to false when | 295 // Whether the navigation is in the middle of a transfer. Set to false when |
| 284 // the DidStartProvisionalLoad is received from the new renderer. | 296 // the DidStartProvisionalLoad is received from the new renderer. |
| 285 bool is_transferring_; | 297 bool is_transferring_; |
| 286 | 298 |
| 287 // The FrameTreeNode this navigation is happening in. | 299 // The FrameTreeNode this navigation is happening in. |
| 288 FrameTreeNode* frame_tree_node_; | 300 FrameTreeNode* frame_tree_node_; |
| 289 | 301 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 309 | 321 |
| 310 // Embedder data tied to this navigation. | 322 // Embedder data tied to this navigation. |
| 311 std::unique_ptr<NavigationData> navigation_data_; | 323 std::unique_ptr<NavigationData> navigation_data_; |
| 312 | 324 |
| 313 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 325 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 314 }; | 326 }; |
| 315 | 327 |
| 316 } // namespace content | 328 } // namespace content |
| 317 | 329 |
| 318 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 330 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |