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