OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/navigation_request.h" | 5 #include "content/browser/frame_host/navigation_request.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "content/browser/appcache/appcache_navigation_handle.h" | 10 #include "content/browser/appcache/appcache_navigation_handle.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 // Select an appropriate renderer to commit the navigation. | 519 // Select an appropriate renderer to commit the navigation. |
520 RenderFrameHostImpl* render_frame_host = nullptr; | 520 RenderFrameHostImpl* render_frame_host = nullptr; |
521 if (response_should_be_rendered_) { | 521 if (response_should_be_rendered_) { |
522 render_frame_host = | 522 render_frame_host = |
523 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); | 523 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); |
524 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL( | 524 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL( |
525 render_frame_host, common_params_.url); | 525 render_frame_host, common_params_.url); |
526 } | 526 } |
527 DCHECK(render_frame_host || !response_should_be_rendered_); | 527 DCHECK(render_frame_host || !response_should_be_rendered_); |
528 | 528 |
529 // For renderer-initiated navigations that are set to commit in a different | |
530 // renderer, allow the embedder to cancel the transfer. | |
531 if (!browser_initiated_ && render_frame_host && | 529 if (!browser_initiated_ && render_frame_host && |
532 render_frame_host != frame_tree_node_->current_frame_host() && | 530 render_frame_host != frame_tree_node_->current_frame_host()) { |
533 !frame_tree_node_->navigator()->GetDelegate()->ShouldTransferNavigation( | 531 // Reset the source location information if the navigation will not commit |
534 frame_tree_node_->IsMainFrame())) { | 532 // in the current renderer process. This information originated in another |
535 frame_tree_node_->ResetNavigationRequest(false); | 533 // process (the current one), it should not be transferred to the new one. |
536 return; | 534 common_params_.source_location.reset(); |
| 535 |
| 536 // Allow the embedder to cancel the cross-process commit if needed. |
| 537 // TODO(clamy): Rename ShouldTransferNavigation once PlzNavigate ships. |
| 538 if (!frame_tree_node_->navigator()->GetDelegate()->ShouldTransferNavigation( |
| 539 frame_tree_node_->IsMainFrame())) { |
| 540 frame_tree_node_->ResetNavigationRequest(false); |
| 541 return; |
| 542 } |
537 } | 543 } |
538 | 544 |
539 if (navigation_data) | 545 if (navigation_data) |
540 navigation_handle_->set_navigation_data(std::move(navigation_data)); | 546 navigation_handle_->set_navigation_data(std::move(navigation_data)); |
541 | 547 |
542 // Store the response and the StreamHandle until checks have been processed. | 548 // Store the response and the StreamHandle until checks have been processed. |
543 response_ = response; | 549 response_ = response; |
544 body_ = std::move(body); | 550 body_ = std::move(body); |
545 | 551 |
546 // Check if the navigation should be allowed to proceed. | 552 // Check if the navigation should be allowed to proceed. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 780 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
775 | 781 |
776 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 782 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
777 common_params_, request_params_, | 783 common_params_, request_params_, |
778 is_view_source_); | 784 is_view_source_); |
779 | 785 |
780 frame_tree_node_->ResetNavigationRequest(true); | 786 frame_tree_node_->ResetNavigationRequest(true); |
781 } | 787 } |
782 | 788 |
783 } // namespace content | 789 } // namespace content |
OLD | NEW |