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

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

Issue 958083002: PlzNavigate: Show error pages when the navigation failed before commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@support-data-urls
Patch Set: Updated test Created 5 years, 8 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
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 716
717 CheckWebUIRendererDoesNotDisplayNormalURL( 717 CheckWebUIRendererDoesNotDisplayNormalURL(
718 render_frame_host, navigation_request->common_params().url); 718 render_frame_host, navigation_request->common_params().url);
719 719
720 render_frame_host->CommitNavigation(response, body.Pass(), 720 render_frame_host->CommitNavigation(response, body.Pass(),
721 navigation_request->common_params(), 721 navigation_request->common_params(),
722 navigation_request->request_params()); 722 navigation_request->request_params());
723 } 723 }
724 724
725 // PlzNavigate 725 // PlzNavigate
726 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node,
727 bool has_stale_copy_in_cache,
728 int error_code) {
729 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
730 switches::kEnableBrowserSideNavigation));
731
732 NavigationRequest* navigation_request =
733 navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
734 DCHECK(navigation_request);
735
736 // Select an appropriate renderer to show the error page.
737 RenderFrameHostImpl* render_frame_host =
738 frame_tree_node->render_manager()->GetFrameHostForNavigation(
739 *navigation_request);
740 CheckWebUIRendererDoesNotDisplayNormalURL(
741 render_frame_host, navigation_request->common_params().url);
742
743 render_frame_host->FailedNavigation(navigation_request->common_params(),
744 navigation_request->request_params(),
745 has_stale_copy_in_cache, error_code);
746 }
747
748 // PlzNavigate
726 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { 749 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
727 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 750 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
728 switches::kEnableBrowserSideNavigation)); 751 switches::kEnableBrowserSideNavigation));
729 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); 752 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id());
730 if (frame_tree_node->IsMainFrame()) 753 if (frame_tree_node->IsMainFrame())
731 navigation_data_.reset(); 754 navigation_data_.reset();
732 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once 755 // TODO(carlosk): move this cleanup into the NavigationRequest destructor once
733 // we properly cancel ongoing navigations. 756 // we properly cancel ongoing navigations.
734 frame_tree_node->render_manager()->CleanUpNavigation(); 757 frame_tree_node->render_manager()->CleanUpNavigation();
735 } 758 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 914 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
892 time_to_commit); 915 time_to_commit);
893 UMA_HISTOGRAM_TIMES( 916 UMA_HISTOGRAM_TIMES(
894 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 917 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
895 time_to_network); 918 time_to_network);
896 } 919 }
897 navigation_data_.reset(); 920 navigation_data_.reset();
898 } 921 }
899 922
900 } // namespace content 923 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.h ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698