Chromium Code Reviews| 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 // Select an appropriate renderer to commit the navigation. | 514 // Select an appropriate renderer to commit the navigation. |
| 515 RenderFrameHostImpl* render_frame_host = nullptr; | 515 RenderFrameHostImpl* render_frame_host = nullptr; |
| 516 if (response_should_be_rendered_) { | 516 if (response_should_be_rendered_) { |
| 517 render_frame_host = | 517 render_frame_host = |
| 518 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); | 518 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); |
| 519 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL( | 519 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL( |
| 520 render_frame_host, common_params_.url); | 520 render_frame_host, common_params_.url); |
| 521 } | 521 } |
| 522 DCHECK(render_frame_host || !response_should_be_rendered_); | 522 DCHECK(render_frame_host || !response_should_be_rendered_); |
| 523 | 523 |
| 524 // For renderer-initiated navigations that are set to commit in a different | |
| 525 // renderer, allow the embedder to cancel the transfer. | |
| 526 if (!browser_initiated_ && render_frame_host && | 524 if (!browser_initiated_ && render_frame_host && |
| 527 render_frame_host != frame_tree_node_->current_frame_host() && | 525 render_frame_host != frame_tree_node_->current_frame_host()) { |
| 528 !frame_tree_node_->navigator()->GetDelegate()->ShouldTransferNavigation( | 526 // Reset the source location information if the navigation will not commit |
| 529 frame_tree_node_->IsMainFrame())) { | 527 // in the current renderer process. This information originated in another |
| 530 frame_tree_node_->ResetNavigationRequest(false); | 528 // process (the current one), it should not be transferred to the new one. |
| 531 return; | 529 common_params_.source_location.reset(); |
| 530 | |
| 531 // Allow the embedder to cancel the transfer if needed. | |
|
nasko
2017/03/02 23:56:04
nit: Technically there are no transfers in PlzNavi
clamy
2017/03/06 13:27:53
No indeed. I've rephrased the comment to remove th
| |
| 532 if (!frame_tree_node_->navigator()->GetDelegate()->ShouldTransferNavigation( | |
| 533 frame_tree_node_->IsMainFrame())) { | |
| 534 frame_tree_node_->ResetNavigationRequest(false); | |
| 535 return; | |
| 536 } | |
| 532 } | 537 } |
| 533 | 538 |
| 534 if (navigation_data) | 539 if (navigation_data) |
| 535 navigation_handle_->set_navigation_data(std::move(navigation_data)); | 540 navigation_handle_->set_navigation_data(std::move(navigation_data)); |
| 536 | 541 |
| 537 // Store the response and the StreamHandle until checks have been processed. | 542 // Store the response and the StreamHandle until checks have been processed. |
| 538 response_ = response; | 543 response_ = response; |
| 539 body_ = std::move(body); | 544 body_ = std::move(body); |
| 540 | 545 |
| 541 // Check if the navigation should be allowed to proceed. | 546 // Check if the navigation should be allowed to proceed. |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 769 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 774 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 770 | 775 |
| 771 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 776 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 772 common_params_, request_params_, | 777 common_params_, request_params_, |
| 773 is_view_source_); | 778 is_view_source_); |
| 774 | 779 |
| 775 frame_tree_node_->ResetNavigationRequest(true); | 780 frame_tree_node_->ResetNavigationRequest(true); |
| 776 } | 781 } |
| 777 | 782 |
| 778 } // namespace content | 783 } // namespace content |
| OLD | NEW |