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

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 1414723008: Add a way to cancel deferred navigations in NavigationHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Nasko's comments Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include "content/browser/frame_host/frame_tree.h" 7 #include "content/browser/frame_host/frame_tree.h"
8 #include "content/browser/frame_host/frame_tree_node.h" 8 #include "content/browser/frame_host/frame_tree_node.h"
9 #include "content/browser/frame_host/navigation_controller_impl.h" 9 #include "content/browser/frame_host/navigation_controller_impl.h"
10 #include "content/browser/frame_host/navigation_handle_impl.h" 10 #include "content/browser/frame_host/navigation_handle_impl.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { 281 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) {
282 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp, 282 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp,
283 common_params_.url); 283 common_params_.url);
284 } 284 }
285 285
286 void NavigationRequest::OnStartChecksComplete( 286 void NavigationRequest::OnStartChecksComplete(
287 NavigationThrottle::ThrottleCheckResult result) { 287 NavigationThrottle::ThrottleCheckResult result) {
288 CHECK(result != NavigationThrottle::DEFER); 288 CHECK(result != NavigationThrottle::DEFER);
289 289
290 // Abort the request if needed. This will destroy the NavigationRequest. 290 // Abort the request if needed. This will destroy the NavigationRequest.
291 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { 291 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
292 result == NavigationThrottle::CANCEL) {
293 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
292 frame_tree_node_->ResetNavigationRequest(false); 294 frame_tree_node_->ResetNavigationRequest(false);
293 return; 295 return;
294 } 296 }
295 297
296 loader_ = NavigationURLLoader::Create( 298 loader_ = NavigationURLLoader::Create(
297 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), 299 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
298 info_.Pass(), navigation_handle_->service_worker_handle(), this); 300 info_.Pass(), navigation_handle_->service_worker_handle(), this);
299 } 301 }
300 302
301 void NavigationRequest::OnRedirectChecksComplete( 303 void NavigationRequest::OnRedirectChecksComplete(
302 NavigationThrottle::ThrottleCheckResult result) { 304 NavigationThrottle::ThrottleCheckResult result) {
303 CHECK(result != NavigationThrottle::DEFER); 305 CHECK(result != NavigationThrottle::DEFER);
304 306
305 // Abort the request if needed. This will destroy the NavigationRequest. 307 // Abort the request if needed. This will destroy the NavigationRequest.
306 if (result == NavigationThrottle::CANCEL_AND_IGNORE) { 308 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
309 result == NavigationThrottle::CANCEL) {
310 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
307 frame_tree_node_->ResetNavigationRequest(false); 311 frame_tree_node_->ResetNavigationRequest(false);
308 return; 312 return;
309 } 313 }
310 314
311 loader_->FollowRedirect(); 315 loader_->FollowRedirect();
312 navigation_handle_->DidRedirectNavigation(common_params_.url); 316 navigation_handle_->DidRedirectNavigation(common_params_.url);
313 } 317 }
314 318
315 } // namespace content 319 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698