OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1004 // The renderer-initiated navigation request is ignored iff a) there is an | 1004 // The renderer-initiated navigation request is ignored iff a) there is an |
1005 // ongoing request b) which is browser or user-initiated and c) the renderer | 1005 // ongoing request b) which is browser or user-initiated and c) the renderer |
1006 // request is not user-initiated. | 1006 // request is not user-initiated. |
1007 if (ongoing_navigation_request && | 1007 if (ongoing_navigation_request && |
1008 (ongoing_navigation_request->browser_initiated() || | 1008 (ongoing_navigation_request->browser_initiated() || |
1009 ongoing_navigation_request->begin_params().has_user_gesture) && | 1009 ongoing_navigation_request->begin_params().has_user_gesture) && |
1010 !begin_params.has_user_gesture) { | 1010 !begin_params.has_user_gesture) { |
1011 RenderFrameHost* current_frame_host = | 1011 RenderFrameHost* current_frame_host = |
1012 frame_tree_node->render_manager()->current_frame_host(); | 1012 frame_tree_node->render_manager()->current_frame_host(); |
1013 current_frame_host->Send( | 1013 current_frame_host->Send( |
1014 new FrameMsg_Stop(current_frame_host->GetRoutingID())); | 1014 new FrameMsg_DroppedNavigation(current_frame_host->GetRoutingID(), |
1015 begin_params.renderer_navigation_id)); | |
1015 return; | 1016 return; |
1016 } | 1017 } |
1017 | 1018 |
1018 // In all other cases the current navigation, if any, is canceled and a new | 1019 // In all other cases the current navigation, if any, is canceled and a new |
1019 // NavigationRequest is created for the node. | 1020 // NavigationRequest is created for the node. |
1020 frame_tree_node->CreatedNavigationRequest( | 1021 frame_tree_node->CreatedNavigationRequest( |
1021 NavigationRequest::CreateRendererInitiated( | 1022 NavigationRequest::CreateRendererInitiated( |
1022 frame_tree_node, common_params, begin_params, | 1023 frame_tree_node, common_params, begin_params, |
1023 controller_->GetLastCommittedEntryIndex(), | 1024 controller_->GetLastCommittedEntryIndex(), |
1024 controller_->GetEntryCount())); | 1025 controller_->GetEntryCount())); |
(...skipping 14 matching lines...) Expand all Loading... | |
1039 | 1040 |
1040 // For main frames, NavigationHandle will be created after the call to | 1041 // For main frames, NavigationHandle will be created after the call to |
1041 // |DidStartMainFrameNavigation|, so it receives the most up to date pending | 1042 // |DidStartMainFrameNavigation|, so it receives the most up to date pending |
1042 // entry from the NavigationController. | 1043 // entry from the NavigationController. |
1043 NavigationEntry* pending_entry = controller_->GetPendingEntry(); | 1044 NavigationEntry* pending_entry = controller_->GetPendingEntry(); |
1044 navigation_request->CreateNavigationHandle( | 1045 navigation_request->CreateNavigationHandle( |
1045 pending_entry ? pending_entry->GetUniqueID() : 0); | 1046 pending_entry ? pending_entry->GetUniqueID() : 0); |
1046 navigation_request->BeginNavigation(); | 1047 navigation_request->BeginNavigation(); |
1047 } | 1048 } |
1048 | 1049 |
1050 void NavigatorImpl::OnAbortNavigation(FrameTreeNode* frame_tree_node) { | |
1051 DCHECK(frame_tree_node); | |
Charlie Reis
2017/03/20 06:34:44
nit: This seems unnecessary. It doesn't seem like
clamy
2017/03/20 14:56:22
Done.
| |
1052 | |
1053 NavigationRequest* ongoing_navigation_request = | |
1054 frame_tree_node->navigation_request(); | |
1055 if (!ongoing_navigation_request || | |
Charlie Reis
2017/03/20 06:34:44
What happens if we've already sent the CommitNavig
clamy
2017/03/20 14:56:22
The ongoing navigation request will no longer exis
Charlie Reis
2017/03/20 23:02:49
Great, that's a bit simpler.
| |
1056 ongoing_navigation_request->browser_initiated()) { | |
Charlie Reis
2017/03/20 06:34:44
The case we're looking at seems really similar to
clamy
2017/03/20 14:56:22
The existing behavior is that document.write will
Charlie Reis
2017/03/20 23:02:49
It only bothered me in the number of different pol
| |
1057 return; | |
1058 } | |
1059 | |
1060 // Abort the renderer-initiated navigation request. | |
1061 CancelNavigation(frame_tree_node); | |
1062 } | |
1063 | |
1049 // PlzNavigate | 1064 // PlzNavigate |
1050 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { | 1065 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { |
1051 CHECK(IsBrowserSideNavigationEnabled()); | 1066 CHECK(IsBrowserSideNavigationEnabled()); |
1052 frame_tree_node->ResetNavigationRequest(false); | 1067 frame_tree_node->ResetNavigationRequest(false); |
1053 if (frame_tree_node->IsMainFrame()) | 1068 if (frame_tree_node->IsMainFrame()) |
1054 navigation_data_.reset(); | 1069 navigation_data_.reset(); |
1055 } | 1070 } |
1056 | 1071 |
1057 void NavigatorImpl::LogResourceRequestTime( | 1072 void NavigatorImpl::LogResourceRequestTime( |
1058 base::TimeTicks timestamp, const GURL& url) { | 1073 base::TimeTicks timestamp, const GURL& url) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1294 if (navigation_handle) | 1309 if (navigation_handle) |
1295 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1310 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
1296 | 1311 |
1297 controller_->SetPendingEntry(std::move(entry)); | 1312 controller_->SetPendingEntry(std::move(entry)); |
1298 if (delegate_) | 1313 if (delegate_) |
1299 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1314 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1300 } | 1315 } |
1301 } | 1316 } |
1302 | 1317 |
1303 } // namespace content | 1318 } // namespace content |
OLD | NEW |