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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
637 // about:blank should not "use up" a new SiteInstance. The SiteInstance can | 637 // about:blank should not "use up" a new SiteInstance. The SiteInstance can |
638 // still be used for a normal web site. | 638 // still be used for a normal web site. |
639 if (url == GURL(url::kAboutBlankURL)) | 639 if (url == GURL(url::kAboutBlankURL)) |
640 return false; | 640 return false; |
641 | 641 |
642 // The embedder will then have the opportunity to determine if the URL | 642 // The embedder will then have the opportunity to determine if the URL |
643 // should "use up" the SiteInstance. | 643 // should "use up" the SiteInstance. |
644 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); | 644 return GetContentClient()->browser()->ShouldAssignSiteForURL(url); |
645 } | 645 } |
646 | 646 |
647 void NavigatorImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host, | 647 void NavigatorImpl::RequestOpenURL( |
648 const GURL& url, | 648 RenderFrameHostImpl* render_frame_host, |
649 SiteInstance* source_site_instance, | 649 const GURL& url, |
650 const Referrer& referrer, | 650 const std::string& method, |
651 WindowOpenDisposition disposition, | 651 const scoped_refptr<ResourceRequestBody>& body, |
652 bool should_replace_current_entry, | 652 SiteInstance* source_site_instance, |
653 bool user_gesture) { | 653 const Referrer& referrer, |
654 WindowOpenDisposition disposition, | |
655 bool should_replace_current_entry, | |
656 bool user_gesture) { | |
654 // Note: This can be called for subframes (even when OOPIFs are not possible) | 657 // Note: This can be called for subframes (even when OOPIFs are not possible) |
655 // if the disposition calls for a different window. | 658 // if the disposition calls for a different window. |
656 | 659 |
657 // Only the current RenderFrameHost should be sending an OpenURL request. | 660 // Only the current RenderFrameHost should be sending an OpenURL request. |
658 // Pending RenderFrameHost should know where it is navigating and pending | 661 // Pending RenderFrameHost should know where it is navigating and pending |
659 // deletion RenderFrameHost shouldn't be trying to navigate. | 662 // deletion RenderFrameHost shouldn't be trying to navigate. |
660 if (render_frame_host != | 663 if (render_frame_host != |
661 render_frame_host->frame_tree_node()->current_frame_host()) { | 664 render_frame_host->frame_tree_node()->current_frame_host()) { |
662 return; | 665 return; |
663 } | 666 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
706 // Note also that we hide the referrer for Web UI pages. We don't really | 709 // Note also that we hide the referrer for Web UI pages. We don't really |
707 // want web sites to see a referrer of "chrome://blah" (and some | 710 // want web sites to see a referrer of "chrome://blah" (and some |
708 // chrome: URLs might have search terms or other stuff we don't want to | 711 // chrome: URLs might have search terms or other stuff we don't want to |
709 // send to the site), so we send no referrer. | 712 // send to the site), so we send no referrer. |
710 params.referrer = Referrer(); | 713 params.referrer = Referrer(); |
711 | 714 |
712 // Navigations in Web UI pages count as browser-initiated navigations. | 715 // Navigations in Web UI pages count as browser-initiated navigations. |
713 params.is_renderer_initiated = false; | 716 params.is_renderer_initiated = false; |
714 } | 717 } |
715 | 718 |
719 // TODO / DO NOT SUBMIT: Need to plumb through |method| and |body|. | |
720 // | |
721 // Option #1: | |
722 // - Add |method| and |body| fields to OpenURLParams | |
723 // - OpenURLParams is //content's public API | |
724 // - ResourceRequestBody (the type of |body| variable here) is currently | |
725 // internal to //content, but maybe we can expose a small part of it via | |
726 // //content's public API: | |
727 // - expose: ResourceRequestBody::CreateFromVectorOfBytes | |
728 // - expose: thread-safe-ref-counting of ResourceRequestBody | |
729 // - hide: ResourceRequestBody::impl_ (unique pointer to RRBImpl) | |
730 // | |
731 // Option #2: | |
732 // - |delegate_| below is still an internal-to-//content NavigatorDelegate. | |
733 // So maybe we can keep things internal somehow? I don't see how, since | |
734 // ultimately we will always call into //chrome (or other embedder | |
735 // of //content). | |
Łukasz Anforowicz
2016/05/20 23:24:22
WDYT? Does option #1 (exposing a minimal Resource
Łukasz Anforowicz
2016/05/23 13:43:18
Actually, feel free to ignore the question - after
| |
716 if (delegate_) | 736 if (delegate_) |
717 delegate_->RequestOpenURL(render_frame_host, params); | 737 delegate_->RequestOpenURL(render_frame_host, params); |
718 } | 738 } |
719 | 739 |
720 void NavigatorImpl::RequestTransferURL( | 740 void NavigatorImpl::RequestTransferURL( |
721 RenderFrameHostImpl* render_frame_host, | 741 RenderFrameHostImpl* render_frame_host, |
722 const GURL& url, | 742 const GURL& url, |
723 SiteInstance* source_site_instance, | 743 SiteInstance* source_site_instance, |
724 const std::vector<GURL>& redirect_chain, | 744 const std::vector<GURL>& redirect_chain, |
725 const Referrer& referrer, | 745 const Referrer& referrer, |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1163 if (pending_entry != controller_->GetVisibleEntry() || | 1183 if (pending_entry != controller_->GetVisibleEntry() || |
1164 !should_preserve_entry) { | 1184 !should_preserve_entry) { |
1165 controller_->DiscardPendingEntry(true); | 1185 controller_->DiscardPendingEntry(true); |
1166 | 1186 |
1167 // Also force the UI to refresh. | 1187 // Also force the UI to refresh. |
1168 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1188 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
1169 } | 1189 } |
1170 } | 1190 } |
1171 | 1191 |
1172 } // namespace content | 1192 } // namespace content |
OLD | NEW |