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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 // the RenderFrameHost still apply. | 63 // the RenderFrameHost still apply. |
64 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { | 64 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
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 const base::TimeTicks& navigation_start); | 73 const base::TimeTicks& navigation_start, |
74 const NavigationEntry* pending_nav_entry); | |
74 ~NavigationHandleImpl() override; | 75 ~NavigationHandleImpl() override; |
75 | 76 |
76 // NavigationHandle implementation: | 77 // NavigationHandle implementation: |
77 const GURL& GetURL() override; | 78 const GURL& GetURL() override; |
78 bool IsInMainFrame() override; | 79 bool IsInMainFrame() override; |
79 const base::TimeTicks& NavigationStart() override; | 80 const base::TimeTicks& NavigationStart() override; |
80 bool IsPost() override; | 81 bool IsPost() override; |
81 const Referrer& GetReferrer() override; | 82 const Referrer& GetReferrer() override; |
82 bool HasUserGesture() override; | 83 bool HasUserGesture() override; |
83 ui::PageTransition GetPageTransition() override; | 84 ui::PageTransition GetPageTransition() override; |
(...skipping 21 matching lines...) Expand all Loading... | |
105 bool new_is_external_protocol) override; | 106 bool new_is_external_protocol) override; |
106 | 107 |
107 NavigatorDelegate* GetDelegate() const; | 108 NavigatorDelegate* GetDelegate() const; |
108 | 109 |
109 // Returns the response headers for the request. This can only be accessed | 110 // Returns the response headers for the request. This can only be accessed |
110 // after a redirect was encountered or after the the navigation is ready to | 111 // after a redirect was encountered or after the the navigation is ready to |
111 // commit. It should not be modified, as modifications will not be reflected | 112 // commit. It should not be modified, as modifications will not be reflected |
112 // in the network stack. | 113 // in the network stack. |
113 const net::HttpResponseHeaders* GetResponseHeaders(); | 114 const net::HttpResponseHeaders* GetResponseHeaders(); |
114 | 115 |
116 // Get the corresponding id from the NavigationEntry associated with this | |
Charlie Reis
2016/02/06 00:54:58
nit: s/corresponding/unique/
Charlie Harrison
2016/02/08 15:06:41
Done.
| |
117 // NavigationHandle. Note that a synchronous, renderer-initiated navigation | |
118 // will not have a valid id. It will be 0. | |
Charlie Reis
2016/02/06 00:54:58
nit: will not have a NavigationEntry associated wi
Charlie Harrison
2016/02/08 15:06:41
Done.
| |
119 int pending_nav_entry_id() const { return pending_nav_entry_id_; } | |
120 | |
115 void set_net_error_code(net::Error net_error_code) { | 121 void set_net_error_code(net::Error net_error_code) { |
116 net_error_code_ = net_error_code; | 122 net_error_code_ = net_error_code; |
117 } | 123 } |
118 | 124 |
119 // Returns whether the navigation is currently being transferred from one | 125 // Returns whether the navigation is currently being transferred from one |
120 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC | 126 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC |
121 // for the navigation URL, received in the new RenderFrameHost, should not | 127 // for the navigation URL, received in the new RenderFrameHost, should not |
122 // indicate the start of a new navigation in that case. | 128 // indicate the start of a new navigation in that case. |
123 bool is_transferring() const { return is_transferring_; } | 129 bool is_transferring() const { return is_transferring_; } |
124 void set_is_transferring(bool is_transferring) { | 130 void set_is_transferring(bool is_transferring) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 CANCELING, | 214 CANCELING, |
209 WILL_PROCESS_RESPONSE, | 215 WILL_PROCESS_RESPONSE, |
210 DEFERRING_RESPONSE, | 216 DEFERRING_RESPONSE, |
211 READY_TO_COMMIT, | 217 READY_TO_COMMIT, |
212 DID_COMMIT, | 218 DID_COMMIT, |
213 DID_COMMIT_ERROR_PAGE, | 219 DID_COMMIT_ERROR_PAGE, |
214 }; | 220 }; |
215 | 221 |
216 NavigationHandleImpl(const GURL& url, | 222 NavigationHandleImpl(const GURL& url, |
217 FrameTreeNode* frame_tree_node, | 223 FrameTreeNode* frame_tree_node, |
218 const base::TimeTicks& navigation_start); | 224 const base::TimeTicks& navigation_start, |
225 const NavigationEntry* pending_nav_entry); | |
219 | 226 |
220 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 227 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
221 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 228 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
222 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 229 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
223 | 230 |
224 // Helper function to run and reset the |complete_callback_|. This marks the | 231 // Helper function to run and reset the |complete_callback_|. This marks the |
225 // end of a round of NavigationThrottleChecks. | 232 // end of a round of NavigationThrottleChecks. |
226 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); | 233 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); |
227 | 234 |
228 // Used in tests. | 235 // Used in tests. |
(...skipping 23 matching lines...) Expand all Loading... | |
252 | 259 |
253 // A list of Throttles registered for this navigation. | 260 // A list of Throttles registered for this navigation. |
254 ScopedVector<NavigationThrottle> throttles_; | 261 ScopedVector<NavigationThrottle> throttles_; |
255 | 262 |
256 // The index of the next throttle to check. | 263 // The index of the next throttle to check. |
257 size_t next_index_; | 264 size_t next_index_; |
258 | 265 |
259 // The time this navigation started. | 266 // The time this navigation started. |
260 const base::TimeTicks navigation_start_; | 267 const base::TimeTicks navigation_start_; |
261 | 268 |
269 // The unique id of the corresponding NavigationEntry. | |
270 const int pending_nav_entry_id_; | |
271 | |
262 // This callback will be run when all throttle checks have been performed. | 272 // This callback will be run when all throttle checks have been performed. |
263 ThrottleChecksFinishedCallback complete_callback_; | 273 ThrottleChecksFinishedCallback complete_callback_; |
264 | 274 |
265 // PlzNavigate | 275 // PlzNavigate |
266 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 276 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
267 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 277 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
268 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 278 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
269 | 279 |
270 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 280 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
271 }; | 281 }; |
272 | 282 |
273 } // namespace content | 283 } // namespace content |
274 | 284 |
275 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 285 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |