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

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

Issue 2710643003: PlzNavigate: remove NavigatorImpl::FailedNavigation (Closed)
Patch Set: Created 3 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 | « content/browser/frame_host/navigator_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 // For main frames, NavigationHandle will be created after the call to 1032 // For main frames, NavigationHandle will be created after the call to
1033 // |DidStartMainFrameNavigation|, so it receives the most up to date pending 1033 // |DidStartMainFrameNavigation|, so it receives the most up to date pending
1034 // entry from the NavigationController. 1034 // entry from the NavigationController.
1035 NavigationEntry* pending_entry = controller_->GetPendingEntry(); 1035 NavigationEntry* pending_entry = controller_->GetPendingEntry();
1036 navigation_request->CreateNavigationHandle( 1036 navigation_request->CreateNavigationHandle(
1037 pending_entry ? pending_entry->GetUniqueID() : 0); 1037 pending_entry ? pending_entry->GetUniqueID() : 0);
1038 navigation_request->BeginNavigation(); 1038 navigation_request->BeginNavigation();
1039 } 1039 }
1040 1040
1041 // PlzNavigate 1041 // PlzNavigate
1042 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node,
1043 bool has_stale_copy_in_cache,
1044 int error_code) {
1045 CHECK(IsBrowserSideNavigationEnabled());
1046
1047 NavigationRequest* navigation_request = frame_tree_node->navigation_request();
1048 DCHECK(navigation_request);
1049
1050 // With PlzNavigate, debug URLs will give a failed navigation because the
1051 // WebUI backend won't find a handler for them. They will be processed in the
1052 // renderer, however do not discard the pending entry so that the URL bar
1053 // shows them correctly.
1054 if (!IsRendererDebugURL(navigation_request->navigation_handle()->GetURL()))
1055 DiscardPendingEntryIfNeeded(navigation_request->navigation_handle());
1056
1057 // If the request was canceled by the user do not show an error page.
1058 if (error_code == net::ERR_ABORTED) {
1059 frame_tree_node->ResetNavigationRequest(false);
1060 return;
1061 }
1062
1063 // Select an appropriate renderer to show the error page.
1064 RenderFrameHostImpl* render_frame_host =
1065 frame_tree_node->render_manager()->GetFrameHostForNavigation(
1066 *navigation_request);
1067 CheckWebUIRendererDoesNotDisplayNormalURL(
1068 render_frame_host, navigation_request->common_params().url);
1069
1070 navigation_request->TransferNavigationHandleOwnership(render_frame_host);
1071 render_frame_host->navigation_handle()->ReadyToCommitNavigation(
1072 render_frame_host);
1073 render_frame_host->FailedNavigation(navigation_request->common_params(),
1074 navigation_request->request_params(),
1075 has_stale_copy_in_cache, error_code);
1076 }
1077
1078 // PlzNavigate
1079 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { 1042 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
1080 CHECK(IsBrowserSideNavigationEnabled()); 1043 CHECK(IsBrowserSideNavigationEnabled());
1081 frame_tree_node->ResetNavigationRequest(false); 1044 frame_tree_node->ResetNavigationRequest(false);
1082 if (frame_tree_node->IsMainFrame()) 1045 if (frame_tree_node->IsMainFrame())
1083 navigation_data_.reset(); 1046 navigation_data_.reset();
1084 } 1047 }
1085 1048
1086 void NavigatorImpl::LogResourceRequestTime( 1049 void NavigatorImpl::LogResourceRequestTime(
1087 base::TimeTicks timestamp, const GURL& url) { 1050 base::TimeTicks timestamp, const GURL& url) {
1088 if (navigation_data_ && navigation_data_->url_ == url) { 1051 if (navigation_data_ && navigation_data_->url_ == url) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 if (navigation_handle) 1283 if (navigation_handle)
1321 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1284 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1322 1285
1323 controller_->SetPendingEntry(std::move(entry)); 1286 controller_->SetPendingEntry(std::move(entry));
1324 if (delegate_) 1287 if (delegate_)
1325 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1288 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1326 } 1289 }
1327 } 1290 }
1328 1291
1329 } // namespace content 1292 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698