| 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/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 // new navigating RenderFrameHost. | 449 // new navigating RenderFrameHost. |
| 450 transferring_render_frame_host->set_is_loading(false); | 450 transferring_render_frame_host->set_is_loading(false); |
| 451 | 451 |
| 452 // Treat the last URL in the chain as the destination and the remainder as | 452 // Treat the last URL in the chain as the destination and the remainder as |
| 453 // the redirect chain. | 453 // the redirect chain. |
| 454 CHECK(transfer_url_chain.size()); | 454 CHECK(transfer_url_chain.size()); |
| 455 GURL transfer_url = transfer_url_chain.back(); | 455 GURL transfer_url = transfer_url_chain.back(); |
| 456 std::vector<GURL> rest_of_chain = transfer_url_chain; | 456 std::vector<GURL> rest_of_chain = transfer_url_chain; |
| 457 rest_of_chain.pop_back(); | 457 rest_of_chain.pop_back(); |
| 458 | 458 |
| 459 // |extra_headers| passed to RequestTransferURL below are always empty for | |
| 460 // now, because there are no known scenarios where headers (from POST request | |
| 461 // made from one renderer) need to be forwarded into the renderer where that | |
| 462 // request ends up being transfered to. In particular, XSSAuditor doesn't | |
| 463 // look at the headers (e.g. the Content-Type header) when analyzing the body | |
| 464 // of the POST request. | |
| 465 std::string extra_headers; | |
| 466 | |
| 467 transferring_render_frame_host->frame_tree_node() | 459 transferring_render_frame_host->frame_tree_node() |
| 468 ->navigator() | 460 ->navigator() |
| 469 ->RequestTransferURL( | 461 ->RequestTransferURL( |
| 470 transferring_render_frame_host, transfer_url, nullptr, rest_of_chain, | 462 transferring_render_frame_host, transfer_url, nullptr, rest_of_chain, |
| 471 referrer, page_transition, global_request_id, | 463 referrer, page_transition, global_request_id, |
| 472 should_replace_current_entry, | 464 should_replace_current_entry, |
| 473 transfer_navigation_handle_->IsPost() ? "POST" : "GET", | 465 transfer_navigation_handle_->IsPost() ? "POST" : "GET", |
| 474 transfer_navigation_handle_->resource_request_body(), extra_headers); | 466 transfer_navigation_handle_->resource_request_body()); |
| 475 | 467 |
| 476 // If the navigation continued, the NavigationHandle should have been | 468 // If the navigation continued, the NavigationHandle should have been |
| 477 // transfered to a RenderFrameHost. In the other cases, it should be cleared. | 469 // transfered to a RenderFrameHost. In the other cases, it should be cleared. |
| 478 // If the NavigationHandle wasn't claimed, this will lead to the cancelation | 470 // If the NavigationHandle wasn't claimed, this will lead to the cancelation |
| 479 // of the request in the network stack. | 471 // of the request in the network stack. |
| 480 transfer_navigation_handle_.reset(); | 472 transfer_navigation_handle_.reset(); |
| 481 | 473 |
| 482 // If the navigation in the new renderer did not start, inform the | 474 // If the navigation in the new renderer did not start, inform the |
| 483 // FrameTreeNode that it stopped loading. | 475 // FrameTreeNode that it stopped loading. |
| 484 if (!frame_tree_node_->IsLoading() && frame_tree_node_was_loading) | 476 if (!frame_tree_node_->IsLoading() && frame_tree_node_was_loading) |
| (...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2716 resolved_url)) { | 2708 resolved_url)) { |
| 2717 DCHECK(!dest_instance || | 2709 DCHECK(!dest_instance || |
| 2718 dest_instance == render_frame_host_->GetSiteInstance()); | 2710 dest_instance == render_frame_host_->GetSiteInstance()); |
| 2719 return false; | 2711 return false; |
| 2720 } | 2712 } |
| 2721 | 2713 |
| 2722 return true; | 2714 return true; |
| 2723 } | 2715 } |
| 2724 | 2716 |
| 2725 } // namespace content | 2717 } // namespace content |
| OLD | NEW |