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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
730 } | 730 } |
731 | 731 |
732 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); | 732 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); |
733 | 733 |
734 // TODO(creis): Pass the redirect_chain into this method to support client | 734 // TODO(creis): Pass the redirect_chain into this method to support client |
735 // redirects. http://crbug.com/311721. | 735 // redirects. http://crbug.com/311721. |
736 std::vector<GURL> redirect_chain; | 736 std::vector<GURL> redirect_chain; |
737 | 737 |
738 GURL dest_url(url); | 738 GURL dest_url(url); |
739 if (!GetContentClient()->browser()->ShouldAllowOpenURL( | 739 if (!GetContentClient()->browser()->ShouldAllowOpenURL( |
740 current_site_instance, url)) { | 740 current_site_instance, url)) { |
Charlie Reis
2016/11/01 18:12:19
Sanity check: Are we ok with sending the current_s
alexmos
2016/11/01 22:04:22
I added a comment - I think |current_site_instance
Charlie Reis
2016/11/01 23:16:27
Interesting-- yes. While it could have been a dif
alexmos
2016/11/01 23:36:59
Yes, after also checking with lukasza@, I don't th
| |
741 dest_url = GURL(url::kAboutBlankURL); | 741 dest_url = GURL(url::kAboutBlankURL); |
Charlie Reis
2016/11/01 18:12:19
Should we be returning here, as below?
alexmos
2016/11/01 22:04:22
Good question. I think this is ok as-is, since a
Charlie Reis
2016/11/01 23:16:27
Sure, cleaning it up separately sounds fine.
| |
742 } | 742 } |
743 | 743 |
744 int frame_tree_node_id = -1; | 744 int frame_tree_node_id = -1; |
745 | 745 |
746 // Send the navigation to the current FrameTreeNode if it's destined for a | 746 // Send the navigation to the current FrameTreeNode if it's destined for a |
747 // subframe in the current tab. We'll assume it's for the main frame | 747 // subframe in the current tab. We'll assume it's for the main frame |
748 // (possibly of a new or different WebContents) otherwise. | 748 // (possibly of a new or different WebContents) otherwise. |
749 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && | 749 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && |
750 disposition == WindowOpenDisposition::CURRENT_TAB && | 750 disposition == WindowOpenDisposition::CURRENT_TAB && |
751 render_frame_host->GetParent()) { | 751 render_frame_host->GetParent()) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 | 815 |
816 // Allow the delegate to cancel the transfer. | 816 // Allow the delegate to cancel the transfer. |
817 if (!delegate_->ShouldTransferNavigation( | 817 if (!delegate_->ShouldTransferNavigation( |
818 render_frame_host->frame_tree_node()->IsMainFrame())) | 818 render_frame_host->frame_tree_node()->IsMainFrame())) |
819 return; | 819 return; |
820 | 820 |
821 GURL dest_url(url); | 821 GURL dest_url(url); |
822 Referrer referrer_to_use(referrer); | 822 Referrer referrer_to_use(referrer); |
823 FrameTreeNode* node = render_frame_host->frame_tree_node(); | 823 FrameTreeNode* node = render_frame_host->frame_tree_node(); |
824 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); | 824 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); |
825 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance, | 825 // It is important to pass in the source_site_instance if it is available |
826 url)) { | 826 // (such as when navigating a proxy). See https://crbug.com/656752. |
827 dest_url = GURL(url::kAboutBlankURL); | 827 if (!GetContentClient()->browser()->ShouldAllowOpenURL( |
828 source_site_instance ? source_site_instance : current_site_instance, | |
829 url)) { | |
830 // It is important to return here, rather than rewrite the dest_url to | |
831 // about:blank. The latter won't actually have any effect when | |
832 // transferring, as NavigateToEntry will think that the transfer is to the | |
833 // same RFH that started the navigation and let the existing navigation | |
834 // (for the disallowed URL) proceed. | |
835 return; | |
828 } | 836 } |
829 | 837 |
830 // TODO(creis): Determine if this transfer started as a browser-initiated | 838 // TODO(creis): Determine if this transfer started as a browser-initiated |
831 // navigation. See https://crbug.com/495161. | 839 // navigation. See https://crbug.com/495161. |
832 bool is_renderer_initiated = true; | 840 bool is_renderer_initiated = true; |
833 if (render_frame_host->web_ui()) { | 841 if (render_frame_host->web_ui()) { |
834 // Web UI pages sometimes want to override the page transition type for | 842 // Web UI pages sometimes want to override the page transition type for |
835 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for | 843 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for |
836 // automatically generated suggestions). We don't override other types | 844 // automatically generated suggestions). We don't override other types |
837 // like TYPED because they have different implications (e.g., autocomplete). | 845 // like TYPED because they have different implications (e.g., autocomplete). |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1261 if (navigation_handle) | 1269 if (navigation_handle) |
1262 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1270 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
1263 | 1271 |
1264 controller_->SetPendingEntry(std::move(entry)); | 1272 controller_->SetPendingEntry(std::move(entry)); |
1265 if (delegate_) | 1273 if (delegate_) |
1266 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1274 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1267 } | 1275 } |
1268 } | 1276 } |
1269 | 1277 |
1270 } // namespace content | 1278 } // namespace content |
OLD | NEW |