Chromium Code Reviews| 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..3d95bc4309d47c9d406a938447e88359a0edca78 100644 |
| --- a/content/browser/frame_host/navigator_impl.cc |
| +++ b/content/browser/frame_host/navigator_impl.cc |
| @@ -707,10 +707,20 @@ 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->browser_initiated() || |
| + ongoing_navigation_request->begin_params().has_user_gesture) && |
| + !begin_params.has_user_gesture) { |
| + // The renderer navigation request is canceled iff a) there is an ongoing |
| + // 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 |
| + // NavigationRequest is created and storeed in the map. |
|
clamy
2015/02/12 18:08:06
nit: s/storeed/stored
carlosk
2015/02/13 13:44:29
Done.
|
| scoped_ptr<NavigationRequest> navigation_request = |
| NavigationRequest::CreateRendererInitiated( |
| frame_tree_node, common_params, begin_params, body); |