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

Unified Diff: content/browser/frame_host/navigator_impl.cc

Issue 914223002: PlzNavigate: Updated navigation cancel policy for renderer-initiated requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Two comment changes Created 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index e4afbe62a6628ddf93e7e7c52ef6c120d1189dc8..4fe168ee33b779941a45223a7f097c0d2c94dac4 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -707,10 +707,18 @@ void NavigatorImpl::OnBeginNavigation(
switches::kEnableBrowserSideNavigation));
DCHECK(frame_tree_node);
- // This is a renderer-initiated navigation, so generate a new
- // NavigationRequest and store it in the map.
- // TODO(clamy): Renderer-initiated navigations should not always cancel the
- // current one.
+ NavigationRequest* ongoing_navigation_request =
+ navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
+ if (ongoing_navigation_request &&
+ ongoing_navigation_request->begin_params().has_user_gesture &&
clamy 2015/02/11 17:22:29 I don't think this currently works. In browser ini
carlosk 2015/02/12 12:21:06 And I even knew about it... So I need one more tes
+ !begin_params.has_user_gesture) {
+ // The renderer navigation request is canceled iff a) there is an ongoing
clamy 2015/02/11 17:22:30 This does not cancel the renderer-initiated naviga
carlosk 2015/02/12 12:21:05 I did this instead: s/canceled/ignored
clamy 2015/02/12 18:08:06 The change did not appear in the diff :)
carlosk 2015/02/13 13:44:28 Done now. Sorry about that.
+ // request b) which is user-initiated and c) the renderer request is not
+ // user-initiated.
+ return;
+ }
+ // In all other cases the current navigation, if any, is canceled and a new
clamy 2015/02/11 17:22:29 nit: add an empty line before the comment.
carlosk 2015/02/12 12:21:06 Done.
+ // NavigationRequest is created and store it in the map.
clamy 2015/02/11 17:22:30 s/store it/stored
carlosk 2015/02/12 12:21:06 Done.
scoped_ptr<NavigationRequest> navigation_request =
NavigationRequest::CreateRendererInitiated(
frame_tree_node, common_params, begin_params, body);

Powered by Google App Engine
This is Rietveld 408576698