| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 if (!GetContentClient()->browser()->ShouldAllowOpenURL( | 744 if (!GetContentClient()->browser()->ShouldAllowOpenURL( |
| 745 current_site_instance, url)) { | 745 current_site_instance, url)) { |
| 746 dest_url = GURL(url::kAboutBlankURL); | 746 dest_url = GURL(url::kAboutBlankURL); |
| 747 } | 747 } |
| 748 | 748 |
| 749 int frame_tree_node_id = -1; | 749 int frame_tree_node_id = -1; |
| 750 | 750 |
| 751 // Send the navigation to the current FrameTreeNode if it's destined for a | 751 // Send the navigation to the current FrameTreeNode if it's destined for a |
| 752 // subframe in the current tab. We'll assume it's for the main frame | 752 // subframe in the current tab. We'll assume it's for the main frame |
| 753 // (possibly of a new or different WebContents) otherwise. | 753 // (possibly of a new or different WebContents) otherwise. |
| 754 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && | 754 if (disposition == WindowOpenDisposition::CURRENT_TAB && |
| 755 disposition == WindowOpenDisposition::CURRENT_TAB && | |
| 756 render_frame_host->GetParent()) { | 755 render_frame_host->GetParent()) { |
| 757 frame_tree_node_id = | 756 frame_tree_node_id = |
| 758 render_frame_host->frame_tree_node()->frame_tree_node_id(); | 757 render_frame_host->frame_tree_node()->frame_tree_node_id(); |
| 759 } | 758 } |
| 760 | 759 |
| 761 OpenURLParams params(dest_url, referrer, frame_tree_node_id, disposition, | 760 OpenURLParams params(dest_url, referrer, frame_tree_node_id, disposition, |
| 762 ui::PAGE_TRANSITION_LINK, | 761 ui::PAGE_TRANSITION_LINK, |
| 763 true /* is_renderer_initiated */); | 762 true /* is_renderer_initiated */); |
| 764 params.uses_post = uses_post; | 763 params.uses_post = uses_post; |
| 765 params.post_data = body; | 764 params.post_data = body; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 // entry. Subframe transfers should only be possible in OOPIF-enabled modes, | 859 // entry. Subframe transfers should only be possible in OOPIF-enabled modes, |
| 861 // and should have a clone of the last committed entry with a | 860 // and should have a clone of the last committed entry with a |
| 862 // FrameNavigationEntry for the target frame. Main frame transfers should | 861 // FrameNavigationEntry for the target frame. Main frame transfers should |
| 863 // have a new NavigationEntry. | 862 // have a new NavigationEntry. |
| 864 // TODO(creis): Make this unnecessary by creating (and validating) the params | 863 // TODO(creis): Make this unnecessary by creating (and validating) the params |
| 865 // directly, passing them to the destination RenderFrameHost. See | 864 // directly, passing them to the destination RenderFrameHost. See |
| 866 // https://crbug.com/536906. | 865 // https://crbug.com/536906. |
| 867 std::unique_ptr<NavigationEntryImpl> entry; | 866 std::unique_ptr<NavigationEntryImpl> entry; |
| 868 if (!node->IsMainFrame()) { | 867 if (!node->IsMainFrame()) { |
| 869 // Subframe case: create FrameNavigationEntry. | 868 // Subframe case: create FrameNavigationEntry. |
| 870 CHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); | |
| 871 if (controller_->GetLastCommittedEntry()) { | 869 if (controller_->GetLastCommittedEntry()) { |
| 872 entry = controller_->GetLastCommittedEntry()->Clone(); | 870 entry = controller_->GetLastCommittedEntry()->Clone(); |
| 873 entry->set_extra_headers(extra_headers); | 871 entry->set_extra_headers(extra_headers); |
| 874 } else { | 872 } else { |
| 875 // If there's no last committed entry, create an entry for about:blank | 873 // If there's no last committed entry, create an entry for about:blank |
| 876 // with a subframe entry for our destination. | 874 // with a subframe entry for our destination. |
| 877 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208. | 875 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208. |
| 878 entry = NavigationEntryImpl::FromNavigationEntry( | 876 entry = NavigationEntryImpl::FromNavigationEntry( |
| 879 controller_->CreateNavigationEntry( | 877 controller_->CreateNavigationEntry( |
| 880 GURL(url::kAboutBlankURL), referrer_to_use, page_transition, | 878 GURL(url::kAboutBlankURL), referrer_to_use, page_transition, |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 if (navigation_handle) | 1268 if (navigation_handle) |
| 1271 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1269 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
| 1272 | 1270 |
| 1273 controller_->SetPendingEntry(std::move(entry)); | 1271 controller_->SetPendingEntry(std::move(entry)); |
| 1274 if (delegate_) | 1272 if (delegate_) |
| 1275 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1273 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
| 1276 } | 1274 } |
| 1277 } | 1275 } |
| 1278 | 1276 |
| 1279 } // namespace content | 1277 } // namespace content |
| OLD | NEW |