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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // |callback| will be called when all throttles check have completed. This | 153 // |callback| will be called when all throttles check have completed. This |
154 // will allow the caller to cancel the navigation or let it proceed. | 154 // will allow the caller to cancel the navigation or let it proceed. |
155 void WillRedirectRequest( | 155 void WillRedirectRequest( |
156 const GURL& new_url, | 156 const GURL& new_url, |
157 bool new_method_is_post, | 157 bool new_method_is_post, |
158 const GURL& new_referrer_url, | 158 const GURL& new_referrer_url, |
159 bool new_is_external_protocol, | 159 bool new_is_external_protocol, |
160 scoped_refptr<net::HttpResponseHeaders> response_headers, | 160 scoped_refptr<net::HttpResponseHeaders> response_headers, |
161 const ThrottleChecksFinishedCallback& callback); | 161 const ThrottleChecksFinishedCallback& callback); |
162 | 162 |
163 // Called when the URLRequest has delivered response headers and metadata. | |
164 // |callback| will be called when all throttle checks have completed, | |
165 // allowing the caller to cancel the navigation or let it proceed. | |
166 // NavigationHandle will not call |callback| with a result of DEFER. | |
167 // If the result is PROCEED, then 'ReadyToCommitNavigation' will be called | |
168 // with |render_frame_host| and |response_headers| just before calling | |
169 // |callback|. | |
170 void WillProcessResponse( | |
171 RenderFrameHostImpl* render_frame_host, | |
172 scoped_refptr<net::HttpResponseHeaders> response_headers, | |
173 const ThrottleChecksFinishedCallback& callback); | |
174 | |
175 // Returns the FrameTreeNode this navigation is happening in. | 163 // Returns the FrameTreeNode this navigation is happening in. |
176 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 164 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
177 | 165 |
178 // Called when the navigation was redirected. This will update the |url_| and | 166 // Called when the navigation was redirected. This will update the |url_| and |
179 // inform the delegate. | 167 // inform the delegate. |
180 void DidRedirectNavigation(const GURL& new_url); | 168 void DidRedirectNavigation(const GURL& new_url); |
181 | 169 |
182 // Called when the navigation is ready to be committed in | 170 // Called when the navigation is ready to be committed in |
183 // |render_frame_host|. This will update the |state_| and inform the | 171 // |render_frame_host|. This will update the |state_| and inform the |
184 // delegate. | 172 // delegate. |
(...skipping 10 matching lines...) Expand all Loading... |
195 friend class NavigationHandleImplTest; | 183 friend class NavigationHandleImplTest; |
196 | 184 |
197 // Used to track the state the navigation is currently in. | 185 // Used to track the state the navigation is currently in. |
198 enum State { | 186 enum State { |
199 INITIAL = 0, | 187 INITIAL = 0, |
200 WILL_SEND_REQUEST, | 188 WILL_SEND_REQUEST, |
201 DEFERRING_START, | 189 DEFERRING_START, |
202 WILL_REDIRECT_REQUEST, | 190 WILL_REDIRECT_REQUEST, |
203 DEFERRING_REDIRECT, | 191 DEFERRING_REDIRECT, |
204 CANCELING, | 192 CANCELING, |
205 WILL_PROCESS_RESPONSE, | |
206 DEFERRING_RESPONSE, | |
207 READY_TO_COMMIT, | 193 READY_TO_COMMIT, |
208 DID_COMMIT, | 194 DID_COMMIT, |
209 DID_COMMIT_ERROR_PAGE, | 195 DID_COMMIT_ERROR_PAGE, |
210 }; | 196 }; |
211 | 197 |
212 NavigationHandleImpl(const GURL& url, | 198 NavigationHandleImpl(const GURL& url, |
213 FrameTreeNode* frame_tree_node, | 199 FrameTreeNode* frame_tree_node, |
214 const base::TimeTicks& navigation_start); | 200 const base::TimeTicks& navigation_start); |
215 | 201 |
216 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 202 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
217 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 203 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
218 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | |
219 | 204 |
220 // Helper function to run and reset the |complete_callback_|. This marks the | 205 // Helper function to run and reset the |complete_callback_|. This marks the |
221 // end of a round of NavigationThrottleChecks. | 206 // end of a round of NavigationThrottleChecks. |
222 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); | 207 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); |
223 | 208 |
224 // Used in tests. | 209 // Used in tests. |
225 State state() const { return state_; } | 210 State state() const { return state_; } |
226 | 211 |
227 // See NavigationHandle for a description of those member variables. | 212 // See NavigationHandle for a description of those member variables. |
228 GURL url_; | 213 GURL url_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 247 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
263 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 248 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
264 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 249 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
265 | 250 |
266 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 251 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
267 }; | 252 }; |
268 | 253 |
269 } // namespace content | 254 } // namespace content |
270 | 255 |
271 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 256 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |