| 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 "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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 (response->head.headers->response_code() == 204 || | 695 (response->head.headers->response_code() == 204 || |
| 696 response->head.headers->response_code() == 205)) { | 696 response->head.headers->response_code() == 205)) { |
| 697 CancelNavigation(frame_tree_node); | 697 CancelNavigation(frame_tree_node); |
| 698 return; | 698 return; |
| 699 } | 699 } |
| 700 | 700 |
| 701 // Select an appropriate renderer to commit the navigation. | 701 // Select an appropriate renderer to commit the navigation. |
| 702 RenderFrameHostImpl* render_frame_host = | 702 RenderFrameHostImpl* render_frame_host = |
| 703 frame_tree_node->render_manager()->GetFrameHostForNavigation( | 703 frame_tree_node->render_manager()->GetFrameHostForNavigation( |
| 704 *navigation_request); | 704 *navigation_request); |
| 705 |
| 706 // The renderer can exit view source mode when any error or cancellation |
| 707 // happen. When reusing the same renderer, overwrite to recover the mode. |
| 708 if (navigation_request->is_view_source() && |
| 709 render_frame_host == |
| 710 frame_tree_node->render_manager()->current_frame_host()) { |
| 711 DCHECK(!render_frame_host->GetParent()); |
| 712 render_frame_host->render_view_host()->Send( |
| 713 new ViewMsg_EnableViewSourceMode( |
| 714 render_frame_host->render_view_host()->GetRoutingID())); |
| 715 } |
| 716 |
| 705 CheckWebUIRendererDoesNotDisplayNormalURL( | 717 CheckWebUIRendererDoesNotDisplayNormalURL( |
| 706 render_frame_host, navigation_request->common_params().url); | 718 render_frame_host, navigation_request->common_params().url); |
| 707 | 719 |
| 708 render_frame_host->CommitNavigation(response, body.Pass(), | 720 render_frame_host->CommitNavigation(response, body.Pass(), |
| 709 navigation_request->common_params(), | 721 navigation_request->common_params(), |
| 710 navigation_request->request_params()); | 722 navigation_request->request_params()); |
| 711 } | 723 } |
| 712 | 724 |
| 713 // PlzNavigate | 725 // PlzNavigate |
| 714 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { | 726 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 891 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
| 880 time_to_commit); | 892 time_to_commit); |
| 881 UMA_HISTOGRAM_TIMES( | 893 UMA_HISTOGRAM_TIMES( |
| 882 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 894 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
| 883 time_to_network); | 895 time_to_network); |
| 884 } | 896 } |
| 885 navigation_data_.reset(); | 897 navigation_data_.reset(); |
| 886 } | 898 } |
| 887 | 899 |
| 888 } // namespace content | 900 } // namespace content |
| OLD | NEW |