| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 public: | 65 public: |
| 66 // |navigation_start| comes from the DidStartProvisionalLoad IPC, which tracks | 66 // |navigation_start| comes from the DidStartProvisionalLoad IPC, which tracks |
| 67 // both renderer-initiated and browser-initiated navigation start. | 67 // both renderer-initiated and browser-initiated navigation start. |
| 68 // PlzNavigate: This value always comes from the CommonNavigationParams | 68 // PlzNavigate: This value always comes from the CommonNavigationParams |
| 69 // associated with this navigation. | 69 // associated with this navigation. |
| 70 static scoped_ptr<NavigationHandleImpl> Create( | 70 static scoped_ptr<NavigationHandleImpl> Create( |
| 71 const GURL& url, | 71 const GURL& url, |
| 72 FrameTreeNode* frame_tree_node, | 72 FrameTreeNode* frame_tree_node, |
| 73 bool is_synchronous, | 73 bool is_synchronous, |
| 74 bool is_srcdoc, | 74 bool is_srcdoc, |
| 75 const base::TimeTicks& navigation_start); | 75 const base::TimeTicks& navigation_start, |
| 76 int pending_nav_entry_id); |
| 76 ~NavigationHandleImpl() override; | 77 ~NavigationHandleImpl() override; |
| 77 | 78 |
| 78 // NavigationHandle implementation: | 79 // NavigationHandle implementation: |
| 79 const GURL& GetURL() override; | 80 const GURL& GetURL() override; |
| 80 bool IsInMainFrame() override; | 81 bool IsInMainFrame() override; |
| 81 bool IsParentMainFrame() override; | 82 bool IsParentMainFrame() override; |
| 82 bool IsSynchronousNavigation() override; | 83 bool IsSynchronousNavigation() override; |
| 83 bool IsSrcdoc() override; | 84 bool IsSrcdoc() override; |
| 84 bool WasServerRedirect() override; | 85 bool WasServerRedirect() override; |
| 85 int GetFrameTreeNodeId() override; | 86 int GetFrameTreeNodeId() override; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 113 bool new_is_external_protocol) override; | 114 bool new_is_external_protocol) override; |
| 114 | 115 |
| 115 NavigatorDelegate* GetDelegate() const; | 116 NavigatorDelegate* GetDelegate() const; |
| 116 | 117 |
| 117 // Returns the response headers for the request or nullptr if there are none. | 118 // Returns the response headers for the request or nullptr if there are none. |
| 118 // This should only be accessed after a redirect was encountered or after the | 119 // This should only be accessed after a redirect was encountered or after the |
| 119 // navigation is ready to commit. The headers returned should not be modified, | 120 // navigation is ready to commit. The headers returned should not be modified, |
| 120 // as modifications will not be reflected in the network stack. | 121 // as modifications will not be reflected in the network stack. |
| 121 const net::HttpResponseHeaders* GetResponseHeaders(); | 122 const net::HttpResponseHeaders* GetResponseHeaders(); |
| 122 | 123 |
| 124 // Get the unique id from the NavigationEntry associated with this |
| 125 // NavigationHandle. Note that a synchronous, renderer-initiated navigation |
| 126 // will not have a NavigationEntry associated with it, and this will return 0. |
| 127 int pending_nav_entry_id() const { return pending_nav_entry_id_; } |
| 128 |
| 123 void set_net_error_code(net::Error net_error_code) { | 129 void set_net_error_code(net::Error net_error_code) { |
| 124 net_error_code_ = net_error_code; | 130 net_error_code_ = net_error_code; |
| 125 } | 131 } |
| 126 | 132 |
| 127 // Returns whether the navigation is currently being transferred from one | 133 // Returns whether the navigation is currently being transferred from one |
| 128 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC | 134 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC |
| 129 // for the navigation URL, received in the new RenderFrameHost, should not | 135 // for the navigation URL, received in the new RenderFrameHost, should not |
| 130 // indicate the start of a new navigation in that case. | 136 // indicate the start of a new navigation in that case. |
| 131 bool is_transferring() const { return is_transferring_; } | 137 bool is_transferring() const { return is_transferring_; } |
| 132 void set_is_transferring(bool is_transferring) { | 138 void set_is_transferring(bool is_transferring) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 DEFERRING_RESPONSE, | 221 DEFERRING_RESPONSE, |
| 216 READY_TO_COMMIT, | 222 READY_TO_COMMIT, |
| 217 DID_COMMIT, | 223 DID_COMMIT, |
| 218 DID_COMMIT_ERROR_PAGE, | 224 DID_COMMIT_ERROR_PAGE, |
| 219 }; | 225 }; |
| 220 | 226 |
| 221 NavigationHandleImpl(const GURL& url, | 227 NavigationHandleImpl(const GURL& url, |
| 222 FrameTreeNode* frame_tree_node, | 228 FrameTreeNode* frame_tree_node, |
| 223 bool is_synchronous, | 229 bool is_synchronous, |
| 224 bool is_srcdoc, | 230 bool is_srcdoc, |
| 225 const base::TimeTicks& navigation_start); | 231 const base::TimeTicks& navigation_start, |
| 232 int pending_nav_entry_id); |
| 226 | 233 |
| 227 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 234 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
| 228 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 235 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
| 229 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 236 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
| 230 | 237 |
| 231 // Helper function to run and reset the |complete_callback_|. This marks the | 238 // Helper function to run and reset the |complete_callback_|. This marks the |
| 232 // end of a round of NavigationThrottleChecks. | 239 // end of a round of NavigationThrottleChecks. |
| 233 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); | 240 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); |
| 234 | 241 |
| 235 // Used in tests. | 242 // Used in tests. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 262 | 269 |
| 263 // A list of Throttles registered for this navigation. | 270 // A list of Throttles registered for this navigation. |
| 264 ScopedVector<NavigationThrottle> throttles_; | 271 ScopedVector<NavigationThrottle> throttles_; |
| 265 | 272 |
| 266 // The index of the next throttle to check. | 273 // The index of the next throttle to check. |
| 267 size_t next_index_; | 274 size_t next_index_; |
| 268 | 275 |
| 269 // The time this navigation started. | 276 // The time this navigation started. |
| 270 const base::TimeTicks navigation_start_; | 277 const base::TimeTicks navigation_start_; |
| 271 | 278 |
| 279 // The unique id of the corresponding NavigationEntry. |
| 280 const int pending_nav_entry_id_; |
| 281 |
| 272 // This callback will be run when all throttle checks have been performed. | 282 // This callback will be run when all throttle checks have been performed. |
| 273 ThrottleChecksFinishedCallback complete_callback_; | 283 ThrottleChecksFinishedCallback complete_callback_; |
| 274 | 284 |
| 275 // PlzNavigate | 285 // PlzNavigate |
| 276 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 286 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
| 277 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 287 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
| 278 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 288 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
| 279 | 289 |
| 280 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 290 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 281 }; | 291 }; |
| 282 | 292 |
| 283 } // namespace content | 293 } // namespace content |
| 284 | 294 |
| 285 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 295 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |