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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
759 params.uses_post = uses_post; | 759 params.uses_post = uses_post; |
760 params.post_data = body; | 760 params.post_data = body; |
761 params.extra_headers = extra_headers; | 761 params.extra_headers = extra_headers; |
762 params.source_site_instance = source_site_instance; | 762 params.source_site_instance = source_site_instance; |
763 if (redirect_chain.size() > 0) | 763 if (redirect_chain.size() > 0) |
764 params.redirect_chain = redirect_chain; | 764 params.redirect_chain = redirect_chain; |
765 params.should_replace_current_entry = should_replace_current_entry; | 765 params.should_replace_current_entry = should_replace_current_entry; |
766 params.user_gesture = user_gesture; | 766 params.user_gesture = user_gesture; |
767 | 767 |
768 if (render_frame_host->web_ui()) { | 768 if (render_frame_host->web_ui()) { |
769 // Web UI pages sometimes want to override the page transition type for | 769 // Note that we hide the referrer for Web UI pages. We don't really want |
770 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for | 770 // web sites to see a referrer of "chrome://blah" (and some chrome: URLs |
771 // automatically generated suggestions). We don't override other types | 771 // might have search terms or other stuff we don't want to send to the |
772 // like TYPED because they have different implications (e.g., autocomplete). | 772 // site), so we send no referrer. |
773 if (ui::PageTransitionCoreTypeIs( | |
774 params.transition, ui::PAGE_TRANSITION_LINK)) | |
775 params.transition = render_frame_host->web_ui()->GetLinkTransitionType(); | |
Charlie Reis
2016/11/04 23:31:59
Sanity check: No other actual WebUI pages rely on
Devlin
2016/11/05 01:23:17
No other WebUI ever sets a transition type (and th
| |
776 | |
777 // Note also that we hide the referrer for Web UI pages. We don't really | |
778 // want web sites to see a referrer of "chrome://blah" (and some | |
779 // chrome: URLs might have search terms or other stuff we don't want to | |
780 // send to the site), so we send no referrer. | |
781 params.referrer = Referrer(); | 773 params.referrer = Referrer(); |
782 | 774 |
783 // Navigations in Web UI pages count as browser-initiated navigations. | 775 // Navigations in Web UI pages count as browser-initiated navigations. |
784 params.is_renderer_initiated = false; | 776 params.is_renderer_initiated = false; |
785 } | 777 } |
786 | 778 |
787 GetContentClient()->browser()->OverrideOpenURLParams(current_site_instance, | 779 GetContentClient()->browser()->OverrideOpenURLParams(current_site_instance, |
788 ¶ms); | 780 ¶ms); |
789 | 781 |
790 if (delegate_) | 782 if (delegate_) |
791 delegate_->RequestOpenURL(render_frame_host, params); | 783 delegate_->RequestOpenURL(render_frame_host, params); |
792 } | 784 } |
793 | 785 |
794 void NavigatorImpl::RequestTransferURL( | 786 void NavigatorImpl::RequestTransferURL( |
Devlin
2016/11/02 22:01:43
There's no ContentBrowserClient::OverrideTransferU
Charlie Reis
2016/11/04 23:31:59
Interesting. It would be nice to unify these if p
Devlin
2016/11/05 01:23:17
Sounds good to me! Done.
| |
795 RenderFrameHostImpl* render_frame_host, | 787 RenderFrameHostImpl* render_frame_host, |
796 const GURL& url, | 788 const GURL& url, |
797 SiteInstance* source_site_instance, | 789 SiteInstance* source_site_instance, |
798 const std::vector<GURL>& redirect_chain, | 790 const std::vector<GURL>& redirect_chain, |
799 const Referrer& referrer, | 791 const Referrer& referrer, |
800 ui::PageTransition page_transition, | 792 ui::PageTransition page_transition, |
801 const GlobalRequestID& transferred_global_request_id, | 793 const GlobalRequestID& transferred_global_request_id, |
802 bool should_replace_current_entry, | 794 bool should_replace_current_entry, |
803 const std::string& method, | 795 const std::string& method, |
804 scoped_refptr<ResourceRequestBodyImpl> post_body, | 796 scoped_refptr<ResourceRequestBodyImpl> post_body, |
(...skipping 19 matching lines...) Expand all Loading... | |
824 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); | 816 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); |
825 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance, | 817 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance, |
826 url)) { | 818 url)) { |
827 dest_url = GURL(url::kAboutBlankURL); | 819 dest_url = GURL(url::kAboutBlankURL); |
828 } | 820 } |
829 | 821 |
830 // TODO(creis): Determine if this transfer started as a browser-initiated | 822 // TODO(creis): Determine if this transfer started as a browser-initiated |
831 // navigation. See https://crbug.com/495161. | 823 // navigation. See https://crbug.com/495161. |
832 bool is_renderer_initiated = true; | 824 bool is_renderer_initiated = true; |
833 if (render_frame_host->web_ui()) { | 825 if (render_frame_host->web_ui()) { |
834 // Web UI pages sometimes want to override the page transition type for | 826 // Note that we hide the referrer for Web UI pages. We don't really want |
835 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for | 827 // web sites to see a referrer of "chrome://blah" (and some chrome: URLs |
836 // automatically generated suggestions). We don't override other types | 828 // might have search terms or other stuff we don't want to send to the |
837 // like TYPED because they have different implications (e.g., autocomplete). | 829 // site), so we send no referrer. |
838 if (ui::PageTransitionCoreTypeIs(page_transition, ui::PAGE_TRANSITION_LINK)) | |
839 page_transition = render_frame_host->web_ui()->GetLinkTransitionType(); | |
840 | |
841 // Note also that we hide the referrer for Web UI pages. We don't really | |
842 // want web sites to see a referrer of "chrome://blah" (and some | |
843 // chrome: URLs might have search terms or other stuff we don't want to | |
844 // send to the site), so we send no referrer. | |
845 referrer_to_use = Referrer(); | 830 referrer_to_use = Referrer(); |
846 | 831 |
847 // Navigations in Web UI pages count as browser-initiated navigations. | 832 // Navigations in Web UI pages count as browser-initiated navigations. |
848 is_renderer_initiated = false; | 833 is_renderer_initiated = false; |
849 } | 834 } |
850 | 835 |
851 // Create a NavigationEntry for the transfer, without making it the pending | 836 // Create a NavigationEntry for the transfer, without making it the pending |
852 // entry. Subframe transfers should only be possible in OOPIF-enabled modes, | 837 // entry. Subframe transfers should only be possible in OOPIF-enabled modes, |
853 // and should have a clone of the last committed entry with a | 838 // and should have a clone of the last committed entry with a |
854 // FrameNavigationEntry for the target frame. Main frame transfers should | 839 // FrameNavigationEntry for the target frame. Main frame transfers should |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1261 if (navigation_handle) | 1246 if (navigation_handle) |
1262 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1247 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
1263 | 1248 |
1264 controller_->SetPendingEntry(std::move(entry)); | 1249 controller_->SetPendingEntry(std::move(entry)); |
1265 if (delegate_) | 1250 if (delegate_) |
1266 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1251 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1267 } | 1252 } |
1268 } | 1253 } |
1269 | 1254 |
1270 } // namespace content | 1255 } // namespace content |
OLD | NEW |