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