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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 | 301 |
302 bool NavigatorImpl::NavigateToEntry( | 302 bool NavigatorImpl::NavigateToEntry( |
303 FrameTreeNode* frame_tree_node, | 303 FrameTreeNode* frame_tree_node, |
304 const FrameNavigationEntry& frame_entry, | 304 const FrameNavigationEntry& frame_entry, |
305 const NavigationEntryImpl& entry, | 305 const NavigationEntryImpl& entry, |
306 ReloadType reload_type, | 306 ReloadType reload_type, |
307 bool is_same_document_history_load, | 307 bool is_same_document_history_load, |
308 bool is_history_navigation_in_new_child, | 308 bool is_history_navigation_in_new_child, |
309 bool is_pending_entry, | 309 bool is_pending_entry, |
310 const scoped_refptr<ResourceRequestBodyImpl>& post_body) { | 310 const scoped_refptr<ResourceRequestBody>& post_body) { |
311 TRACE_EVENT0("browser,navigation", "NavigatorImpl::NavigateToEntry"); | 311 TRACE_EVENT0("browser,navigation", "NavigatorImpl::NavigateToEntry"); |
312 | 312 |
313 GURL dest_url = frame_entry.url(); | 313 GURL dest_url = frame_entry.url(); |
314 Referrer dest_referrer = frame_entry.referrer(); | 314 Referrer dest_referrer = frame_entry.referrer(); |
315 if (reload_type == ReloadType::ORIGINAL_REQUEST_URL && | 315 if (reload_type == ReloadType::ORIGINAL_REQUEST_URL && |
316 entry.GetOriginalRequestURL().is_valid() && !entry.GetHasPostData()) { | 316 entry.GetOriginalRequestURL().is_valid() && !entry.GetHasPostData()) { |
317 // We may have been redirected when navigating to the current URL. | 317 // We may have been redirected when navigating to the current URL. |
318 // Use the URL the user originally intended to visit, if it's valid and if a | 318 // Use the URL the user originally intended to visit, if it's valid and if a |
319 // POST wasn't involved; the latter case avoids issues with sending data to | 319 // POST wasn't involved; the latter case avoids issues with sending data to |
320 // the wrong page. | 320 // the wrong page. |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 712 |
713 // The embedder will then have the opportunity to determine if the URL | 713 // The embedder will then have the opportunity to determine if the URL |
714 // should "use up" the SiteInstance. | 714 // should "use up" the SiteInstance. |
715 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); | 715 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); |
716 } | 716 } |
717 | 717 |
718 void NavigatorImpl::RequestOpenURL( | 718 void NavigatorImpl::RequestOpenURL( |
719 RenderFrameHostImpl* render_frame_host, | 719 RenderFrameHostImpl* render_frame_host, |
720 const GURL& url, | 720 const GURL& url, |
721 bool uses_post, | 721 bool uses_post, |
722 const scoped_refptr<ResourceRequestBodyImpl>& body, | 722 const scoped_refptr<ResourceRequestBody>& body, |
723 const std::string& extra_headers, | 723 const std::string& extra_headers, |
724 const Referrer& referrer, | 724 const Referrer& referrer, |
725 WindowOpenDisposition disposition, | 725 WindowOpenDisposition disposition, |
726 bool force_new_process_for_new_contents, | 726 bool force_new_process_for_new_contents, |
727 bool should_replace_current_entry, | 727 bool should_replace_current_entry, |
728 bool user_gesture, | 728 bool user_gesture, |
729 blink::WebTriggeringEventInfo triggering_event_info) { | 729 blink::WebTriggeringEventInfo triggering_event_info) { |
730 // Note: This can be called for subframes (even when OOPIFs are not possible) | 730 // Note: This can be called for subframes (even when OOPIFs are not possible) |
731 // if the disposition calls for a different window. | 731 // if the disposition calls for a different window. |
732 | 732 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 void NavigatorImpl::RequestTransferURL( | 809 void NavigatorImpl::RequestTransferURL( |
810 RenderFrameHostImpl* render_frame_host, | 810 RenderFrameHostImpl* render_frame_host, |
811 const GURL& url, | 811 const GURL& url, |
812 SiteInstance* source_site_instance, | 812 SiteInstance* source_site_instance, |
813 const std::vector<GURL>& redirect_chain, | 813 const std::vector<GURL>& redirect_chain, |
814 const Referrer& referrer, | 814 const Referrer& referrer, |
815 ui::PageTransition page_transition, | 815 ui::PageTransition page_transition, |
816 const GlobalRequestID& transferred_global_request_id, | 816 const GlobalRequestID& transferred_global_request_id, |
817 bool should_replace_current_entry, | 817 bool should_replace_current_entry, |
818 const std::string& method, | 818 const std::string& method, |
819 scoped_refptr<ResourceRequestBodyImpl> post_body, | 819 scoped_refptr<ResourceRequestBody> post_body, |
820 const std::string& extra_headers) { | 820 const std::string& extra_headers) { |
821 // |method != "POST"| should imply absence of |post_body|. | 821 // |method != "POST"| should imply absence of |post_body|. |
822 if (method != "POST" && post_body) { | 822 if (method != "POST" && post_body) { |
823 NOTREACHED(); | 823 NOTREACHED(); |
824 post_body = nullptr; | 824 post_body = nullptr; |
825 } | 825 } |
826 | 826 |
827 // This call only makes sense for subframes if OOPIFs are possible. | 827 // This call only makes sense for subframes if OOPIFs are possible. |
828 DCHECK(!render_frame_host->GetParent() || | 828 DCHECK(!render_frame_host->GetParent() || |
829 SiteIsolationPolicy::AreCrossProcessFramesPossible()); | 829 SiteIsolationPolicy::AreCrossProcessFramesPossible()); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 void NavigatorImpl::RequestNavigation( | 1131 void NavigatorImpl::RequestNavigation( |
1132 FrameTreeNode* frame_tree_node, | 1132 FrameTreeNode* frame_tree_node, |
1133 const GURL& dest_url, | 1133 const GURL& dest_url, |
1134 const Referrer& dest_referrer, | 1134 const Referrer& dest_referrer, |
1135 const FrameNavigationEntry& frame_entry, | 1135 const FrameNavigationEntry& frame_entry, |
1136 const NavigationEntryImpl& entry, | 1136 const NavigationEntryImpl& entry, |
1137 ReloadType reload_type, | 1137 ReloadType reload_type, |
1138 PreviewsState previews_state, | 1138 PreviewsState previews_state, |
1139 bool is_same_document_history_load, | 1139 bool is_same_document_history_load, |
1140 bool is_history_navigation_in_new_child, | 1140 bool is_history_navigation_in_new_child, |
1141 const scoped_refptr<ResourceRequestBodyImpl>& post_body, | 1141 const scoped_refptr<ResourceRequestBody>& post_body, |
1142 base::TimeTicks navigation_start) { | 1142 base::TimeTicks navigation_start) { |
1143 CHECK(IsBrowserSideNavigationEnabled()); | 1143 CHECK(IsBrowserSideNavigationEnabled()); |
1144 DCHECK(frame_tree_node); | 1144 DCHECK(frame_tree_node); |
1145 | 1145 |
1146 // This value must be set here because creating a NavigationRequest might | 1146 // This value must be set here because creating a NavigationRequest might |
1147 // change the renderer live/non-live status and change this result. | 1147 // change the renderer live/non-live status and change this result. |
1148 // We don't want to dispatch a beforeunload handler if | 1148 // We don't want to dispatch a beforeunload handler if |
1149 // is_history_navigation_in_new_child is true. This indicates a newly created | 1149 // is_history_navigation_in_new_child is true. This indicates a newly created |
1150 // child frame which does not have a beforunload handler. | 1150 // child frame which does not have a beforunload handler. |
1151 bool should_dispatch_beforeunload = | 1151 bool should_dispatch_beforeunload = |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 if (navigation_handle) | 1303 if (navigation_handle) |
1304 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1304 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
1305 | 1305 |
1306 controller_->SetPendingEntry(std::move(entry)); | 1306 controller_->SetPendingEntry(std::move(entry)); |
1307 if (delegate_) | 1307 if (delegate_) |
1308 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1308 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1309 } | 1309 } |
1310 } | 1310 } |
1311 | 1311 |
1312 } // namespace content | 1312 } // namespace content |
OLD | NEW |