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.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 // about:blank should not "use up" a new SiteInstance. The SiteInstance can | 640 // about:blank should not "use up" a new SiteInstance. The SiteInstance can |
641 // still be used for a normal web site. | 641 // still be used for a normal web site. |
642 if (url == GURL(url::kAboutBlankURL)) | 642 if (url == GURL(url::kAboutBlankURL)) |
643 return false; | 643 return false; |
644 | 644 |
645 // The embedder will then have the opportunity to determine if the URL | 645 // The embedder will then have the opportunity to determine if the URL |
646 // should "use up" the SiteInstance. | 646 // should "use up" the SiteInstance. |
647 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); | 647 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); |
648 } | 648 } |
649 | 649 |
650 void NavigatorImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host, | 650 void NavigatorImpl::RequestOpenURL( |
651 const GURL& url, | 651 RenderFrameHostImpl* render_frame_host, |
652 SiteInstance* source_site_instance, | 652 const GURL& url, |
653 const Referrer& referrer, | 653 bool uses_post, |
654 WindowOpenDisposition disposition, | 654 const scoped_refptr<ResourceRequestBodyImpl>& body, |
655 bool should_replace_current_entry, | 655 SiteInstance* source_site_instance, |
656 bool user_gesture) { | 656 const Referrer& referrer, |
| 657 WindowOpenDisposition disposition, |
| 658 bool should_replace_current_entry, |
| 659 bool user_gesture) { |
657 // Note: This can be called for subframes (even when OOPIFs are not possible) | 660 // Note: This can be called for subframes (even when OOPIFs are not possible) |
658 // if the disposition calls for a different window. | 661 // if the disposition calls for a different window. |
659 | 662 |
660 // Only the current RenderFrameHost should be sending an OpenURL request. | 663 // Only the current RenderFrameHost should be sending an OpenURL request. |
661 // Pending RenderFrameHost should know where it is navigating and pending | 664 // Pending RenderFrameHost should know where it is navigating and pending |
662 // deletion RenderFrameHost shouldn't be trying to navigate. | 665 // deletion RenderFrameHost shouldn't be trying to navigate. |
663 if (render_frame_host != | 666 if (render_frame_host != |
664 render_frame_host->frame_tree_node()->current_frame_host()) { | 667 render_frame_host->frame_tree_node()->current_frame_host()) { |
665 return; | 668 return; |
666 } | 669 } |
(...skipping 17 matching lines...) Expand all Loading... |
684 // (possibly of a new or different WebContents) otherwise. | 687 // (possibly of a new or different WebContents) otherwise. |
685 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && | 688 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && |
686 disposition == CURRENT_TAB && render_frame_host->GetParent()) { | 689 disposition == CURRENT_TAB && render_frame_host->GetParent()) { |
687 frame_tree_node_id = | 690 frame_tree_node_id = |
688 render_frame_host->frame_tree_node()->frame_tree_node_id(); | 691 render_frame_host->frame_tree_node()->frame_tree_node_id(); |
689 } | 692 } |
690 | 693 |
691 OpenURLParams params(dest_url, referrer, frame_tree_node_id, disposition, | 694 OpenURLParams params(dest_url, referrer, frame_tree_node_id, disposition, |
692 ui::PAGE_TRANSITION_LINK, | 695 ui::PAGE_TRANSITION_LINK, |
693 true /* is_renderer_initiated */); | 696 true /* is_renderer_initiated */); |
| 697 params.uses_post = uses_post; |
| 698 params.post_data = body; |
694 params.source_site_instance = source_site_instance; | 699 params.source_site_instance = source_site_instance; |
695 if (redirect_chain.size() > 0) | 700 if (redirect_chain.size() > 0) |
696 params.redirect_chain = redirect_chain; | 701 params.redirect_chain = redirect_chain; |
697 params.should_replace_current_entry = should_replace_current_entry; | 702 params.should_replace_current_entry = should_replace_current_entry; |
698 params.user_gesture = user_gesture; | 703 params.user_gesture = user_gesture; |
699 | 704 |
700 if (render_frame_host->web_ui()) { | 705 if (render_frame_host->web_ui()) { |
701 // Web UI pages sometimes want to override the page transition type for | 706 // Web UI pages sometimes want to override the page transition type for |
702 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for | 707 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for |
703 // automatically generated suggestions). We don't override other types | 708 // automatically generated suggestions). We don't override other types |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 if (pending_entry != controller_->GetVisibleEntry() || | 1178 if (pending_entry != controller_->GetVisibleEntry() || |
1174 !should_preserve_entry) { | 1179 !should_preserve_entry) { |
1175 controller_->DiscardPendingEntry(true); | 1180 controller_->DiscardPendingEntry(true); |
1176 | 1181 |
1177 // Also force the UI to refresh. | 1182 // Also force the UI to refresh. |
1178 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1183 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
1179 } | 1184 } |
1180 } | 1185 } |
1181 | 1186 |
1182 } // namespace content | 1187 } // namespace content |
OLD | NEW |