Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.h

Issue 1616943003: Teach navigation throttles how to cancel requests in WillProcessResponse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_handle_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // |callback| will be called when all throttles check have completed. This 155 // |callback| will be called when all throttles check have completed. This
156 // will allow the caller to cancel the navigation or let it proceed. 156 // will allow the caller to cancel the navigation or let it proceed.
157 void WillRedirectRequest( 157 void WillRedirectRequest(
158 const GURL& new_url, 158 const GURL& new_url,
159 bool new_method_is_post, 159 bool new_method_is_post,
160 const GURL& new_referrer_url, 160 const GURL& new_referrer_url,
161 bool new_is_external_protocol, 161 bool new_is_external_protocol,
162 scoped_refptr<net::HttpResponseHeaders> response_headers, 162 scoped_refptr<net::HttpResponseHeaders> response_headers,
163 const ThrottleChecksFinishedCallback& callback); 163 const ThrottleChecksFinishedCallback& callback);
164 164
165 // Called when the URLRequest has delivered response headers and metadata.
166 // |callback| will be called when all throttle checks have completed,
167 // allowing the caller to cancel the navigation or let it proceed.
168 // NavigationHandle will not call |callback| with a result of DEFER.
169 // If the result is PROCEED, then 'ReadyToCommitNavigation' will be called
170 // with |render_frame_host| and |response_headers| just before calling
171 // |callback|.
172 void WillProcessResponse(
173 RenderFrameHostImpl* render_frame_host,
174 scoped_refptr<net::HttpResponseHeaders> response_headers,
175 const ThrottleChecksFinishedCallback& callback);
176
165 // Returns the FrameTreeNode this navigation is happening in. 177 // Returns the FrameTreeNode this navigation is happening in.
166 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 178 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
167 179
168 // Called when the navigation was redirected. This will update the |url_| and 180 // Called when the navigation was redirected. This will update the |url_| and
169 // inform the delegate. 181 // inform the delegate.
170 void DidRedirectNavigation(const GURL& new_url); 182 void DidRedirectNavigation(const GURL& new_url);
171 183
172 // Called when the navigation is ready to be committed in 184 // Called when the navigation is ready to be committed in
173 // |render_frame_host|. This will update the |state_| and inform the 185 // |render_frame_host|. This will update the |state_| and inform the
174 // delegate. 186 // delegate.
(...skipping 12 matching lines...) Expand all
187 friend class NavigationHandleImplTest; 199 friend class NavigationHandleImplTest;
188 200
189 // Used to track the state the navigation is currently in. 201 // Used to track the state the navigation is currently in.
190 enum State { 202 enum State {
191 INITIAL = 0, 203 INITIAL = 0,
192 WILL_SEND_REQUEST, 204 WILL_SEND_REQUEST,
193 DEFERRING_START, 205 DEFERRING_START,
194 WILL_REDIRECT_REQUEST, 206 WILL_REDIRECT_REQUEST,
195 DEFERRING_REDIRECT, 207 DEFERRING_REDIRECT,
196 CANCELING, 208 CANCELING,
209 WILL_PROCESS_RESPONSE,
210 DEFERRING_RESPONSE,
197 READY_TO_COMMIT, 211 READY_TO_COMMIT,
198 DID_COMMIT, 212 DID_COMMIT,
199 DID_COMMIT_ERROR_PAGE, 213 DID_COMMIT_ERROR_PAGE,
200 }; 214 };
201 215
202 NavigationHandleImpl(const GURL& url, 216 NavigationHandleImpl(const GURL& url,
203 FrameTreeNode* frame_tree_node, 217 FrameTreeNode* frame_tree_node,
204 const base::TimeTicks& navigation_start); 218 const base::TimeTicks& navigation_start);
205 219
206 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 220 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
207 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 221 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
222 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
208 223
209 // Helper function to run and reset the |complete_callback_|. This marks the 224 // Helper function to run and reset the |complete_callback_|. This marks the
210 // end of a round of NavigationThrottleChecks. 225 // end of a round of NavigationThrottleChecks.
211 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); 226 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result);
212 227
213 // Used in tests. 228 // Used in tests.
214 State state() const { return state_; } 229 State state() const { return state_; }
215 230
216 // See NavigationHandle for a description of those member variables. 231 // See NavigationHandle for a description of those member variables.
217 GURL url_; 232 GURL url_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a 266 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a
252 // corresponding ServiceWorkerNetworkProvider is created in the renderer. 267 // corresponding ServiceWorkerNetworkProvider is created in the renderer.
253 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; 268 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_;
254 269
255 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 270 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
256 }; 271 };
257 272
258 } // namespace content 273 } // namespace content
259 274
260 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 275 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698