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/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 } | 154 } |
155 return new_web_ui.Pass(); | 155 return new_web_ui.Pass(); |
156 } | 156 } |
157 | 157 |
158 RenderFrameHostImpl* RenderFrameHostManager::Navigate( | 158 RenderFrameHostImpl* RenderFrameHostManager::Navigate( |
159 const NavigationEntryImpl& entry) { | 159 const NavigationEntryImpl& entry) { |
160 TRACE_EVENT1("navigation", "RenderFrameHostManager:Navigate", | 160 TRACE_EVENT1("navigation", "RenderFrameHostManager:Navigate", |
161 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); | 161 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); |
162 // Create a pending RenderFrameHost to use for the navigation. | 162 // Create a pending RenderFrameHost to use for the navigation. |
163 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate( | 163 RenderFrameHostImpl* dest_render_frame_host = UpdateStateForNavigate( |
164 entry.GetURL(), | 164 entry.GetURL(), entry.source_site_instance(), entry.site_instance(), |
165 entry.site_instance(), | |
166 entry.GetTransitionType(), | 165 entry.GetTransitionType(), |
167 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE, | 166 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE, |
168 entry.IsViewSourceMode(), | 167 entry.IsViewSourceMode(), entry.transferred_global_request_id(), |
169 entry.transferred_global_request_id(), | |
170 entry.bindings()); | 168 entry.bindings()); |
171 if (!dest_render_frame_host) | 169 if (!dest_render_frame_host) |
172 return NULL; // We weren't able to create a pending render frame host. | 170 return NULL; // We weren't able to create a pending render frame host. |
173 | 171 |
174 // If the current render_frame_host_ isn't live, we should create it so | 172 // If the current render_frame_host_ isn't live, we should create it so |
175 // that we don't show a sad tab while the dest_render_frame_host fetches | 173 // that we don't show a sad tab while the dest_render_frame_host fetches |
176 // its first page. (Bug 1145340) | 174 // its first page. (Bug 1145340) |
177 if (dest_render_frame_host != render_frame_host_ && | 175 if (dest_render_frame_host != render_frame_host_ && |
178 !render_frame_host_->IsRenderFrameLive()) { | 176 !render_frame_host_->IsRenderFrameLive()) { |
179 // Note: we don't call InitRenderView here because we are navigating away | 177 // Note: we don't call InitRenderView here because we are navigating away |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 // the redirect chain. | 369 // the redirect chain. |
372 CHECK(transfer_url_chain.size()); | 370 CHECK(transfer_url_chain.size()); |
373 GURL transfer_url = transfer_url_chain.back(); | 371 GURL transfer_url = transfer_url_chain.back(); |
374 std::vector<GURL> rest_of_chain = transfer_url_chain; | 372 std::vector<GURL> rest_of_chain = transfer_url_chain; |
375 rest_of_chain.pop_back(); | 373 rest_of_chain.pop_back(); |
376 | 374 |
377 // We don't know whether the original request had |user_action| set to true. | 375 // We don't know whether the original request had |user_action| set to true. |
378 // However, since we force the navigation to be in the current tab, it | 376 // However, since we force the navigation to be in the current tab, it |
379 // doesn't matter. | 377 // doesn't matter. |
380 pending_render_frame_host->frame_tree_node()->navigator()->RequestTransferURL( | 378 pending_render_frame_host->frame_tree_node()->navigator()->RequestTransferURL( |
381 pending_render_frame_host, | 379 pending_render_frame_host, transfer_url, nullptr, rest_of_chain, referrer, |
382 transfer_url, | 380 page_transition, CURRENT_TAB, global_request_id, |
383 rest_of_chain, | 381 should_replace_current_entry, true); |
384 referrer, | |
385 page_transition, | |
386 CURRENT_TAB, | |
387 global_request_id, | |
388 should_replace_current_entry, | |
389 true); | |
390 | 382 |
391 // The transferring request was only needed during the RequestTransferURL | 383 // The transferring request was only needed during the RequestTransferURL |
392 // call, so it is safe to clear at this point. | 384 // call, so it is safe to clear at this point. |
393 cross_site_transferring_request_.reset(); | 385 cross_site_transferring_request_.reset(); |
394 } | 386 } |
395 | 387 |
396 void RenderFrameHostManager::OnDeferredAfterResponseStarted( | 388 void RenderFrameHostManager::OnDeferredAfterResponseStarted( |
397 const GlobalRequestID& global_request_id, | 389 const GlobalRequestID& global_request_id, |
398 RenderFrameHostImpl* pending_render_frame_host) { | 390 RenderFrameHostImpl* pending_render_frame_host) { |
399 DCHECK(!response_started_id_.get()); | 391 DCHECK(!response_started_id_.get()); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 ui::PageTransition transition) { | 621 ui::PageTransition transition) { |
630 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( | 622 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( |
631 switches::kEnableBrowserSideNavigation)); | 623 switches::kEnableBrowserSideNavigation)); |
632 // TODO(clamy): When we handle renderer initiated navigations, make sure not | 624 // TODO(clamy): When we handle renderer initiated navigations, make sure not |
633 // to use a different process for subframes if --site-per-process is not | 625 // to use a different process for subframes if --site-per-process is not |
634 // enabled. | 626 // enabled. |
635 | 627 |
636 // Pick the right RenderFrameHost to commit the navigation. | 628 // Pick the right RenderFrameHost to commit the navigation. |
637 // TODO(clamy): Replace the default values by the right ones. | 629 // TODO(clamy): Replace the default values by the right ones. |
638 RenderFrameHostImpl* render_frame_host = UpdateStateForNavigate( | 630 RenderFrameHostImpl* render_frame_host = UpdateStateForNavigate( |
639 url, NULL, transition, false, false, GlobalRequestID(), | 631 url, nullptr, nullptr, transition, false, false, GlobalRequestID(), |
640 NavigationEntryImpl::kInvalidBindings); | 632 NavigationEntryImpl::kInvalidBindings); |
641 | 633 |
642 // If the renderer that needs to navigate is not live (it was just created or | 634 // If the renderer that needs to navigate is not live (it was just created or |
643 // it crashed), initialize it. | 635 // it crashed), initialize it. |
644 if (!render_frame_host->render_view_host()->IsRenderViewLive()) { | 636 if (!render_frame_host->render_view_host()->IsRenderViewLive()) { |
645 // Recreate the opener chain. | 637 // Recreate the opener chain. |
646 int opener_route_id = delegate_->CreateOpenerRenderViewsForRenderManager( | 638 int opener_route_id = delegate_->CreateOpenerRenderViewsForRenderManager( |
647 render_frame_host->GetSiteInstance()); | 639 render_frame_host->GetSiteInstance()); |
648 if (!InitRenderView(render_frame_host->render_view_host(), | 640 if (!InitRenderView(render_frame_host->render_view_host(), |
649 opener_route_id, | 641 opener_route_id, |
650 MSG_ROUTING_NONE, | 642 MSG_ROUTING_NONE, |
651 frame_tree_node_->IsMainFrame())) { | 643 frame_tree_node_->IsMainFrame())) { |
652 return NULL; | 644 return nullptr; |
653 } | 645 } |
654 } | 646 } |
655 return render_frame_host; | 647 return render_frame_host; |
656 } | 648 } |
657 | 649 |
658 void RenderFrameHostManager::Observe( | 650 void RenderFrameHostManager::Observe( |
659 int type, | 651 int type, |
660 const NotificationSource& source, | 652 const NotificationSource& source, |
661 const NotificationDetails& details) { | 653 const NotificationDetails& details) { |
662 switch (type) { | 654 switch (type) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
776 delegate_->GetControllerForRenderManager(); | 768 delegate_->GetControllerForRenderManager(); |
777 return current_entry && web_ui_.get() && | 769 return current_entry && web_ui_.get() && |
778 (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( | 770 (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( |
779 controller.GetBrowserContext(), current_entry->GetURL()) == | 771 controller.GetBrowserContext(), current_entry->GetURL()) == |
780 WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( | 772 WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( |
781 controller.GetBrowserContext(), new_url)); | 773 controller.GetBrowserContext(), new_url)); |
782 } | 774 } |
783 | 775 |
784 SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation( | 776 SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation( |
785 const GURL& dest_url, | 777 const GURL& dest_url, |
778 SiteInstance* source_instance, | |
786 SiteInstance* dest_instance, | 779 SiteInstance* dest_instance, |
787 ui::PageTransition dest_transition, | 780 ui::PageTransition transition, |
788 bool dest_is_restore, | 781 bool dest_is_restore, |
789 bool dest_is_view_source_mode) { | 782 bool dest_is_view_source_mode) { |
790 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); | 783 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |
791 SiteInstance* new_instance = current_instance; | 784 SiteInstance* new_instance = current_instance; |
792 | 785 |
793 // We do not currently swap processes for navigations in webview tag guests. | 786 // We do not currently swap processes for navigations in webview tag guests. |
794 if (current_instance->GetSiteURL().SchemeIs(kGuestScheme)) | 787 if (current_instance->GetSiteURL().SchemeIs(kGuestScheme)) |
795 return current_instance; | 788 return current_instance; |
796 | 789 |
797 // Determine if we need a new BrowsingInstance for this entry. If true, this | 790 // Determine if we need a new BrowsingInstance for this entry. If true, this |
(...skipping 13 matching lines...) Expand all Loading... | |
811 bool current_is_view_source_mode = current_entry ? | 804 bool current_is_view_source_mode = current_entry ? |
812 current_entry->IsViewSourceMode() : dest_is_view_source_mode; | 805 current_entry->IsViewSourceMode() : dest_is_view_source_mode; |
813 bool force_swap = ShouldSwapBrowsingInstancesForNavigation( | 806 bool force_swap = ShouldSwapBrowsingInstancesForNavigation( |
814 current_effective_url, | 807 current_effective_url, |
815 current_is_view_source_mode, | 808 current_is_view_source_mode, |
816 dest_instance, | 809 dest_instance, |
817 SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url), | 810 SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url), |
818 dest_is_view_source_mode); | 811 dest_is_view_source_mode); |
819 if (ShouldTransitionCrossSite() || force_swap) { | 812 if (ShouldTransitionCrossSite() || force_swap) { |
820 new_instance = GetSiteInstanceForURL( | 813 new_instance = GetSiteInstanceForURL( |
821 dest_url, | 814 dest_url, source_instance, current_instance, dest_instance, |
822 dest_instance, | 815 transition, dest_is_restore, dest_is_view_source_mode, force_swap); |
823 dest_transition, | |
824 dest_is_restore, | |
825 dest_is_view_source_mode, | |
826 current_instance, | |
827 force_swap); | |
828 } | 816 } |
829 | 817 |
830 // If force_swap is true, we must use a different SiteInstance. If we didn't, | 818 // If force_swap is true, we must use a different SiteInstance. If we didn't, |
831 // we would have two RenderFrameHosts in the same SiteInstance and the same | 819 // we would have two RenderFrameHosts in the same SiteInstance and the same |
832 // frame, resulting in page_id conflicts for their NavigationEntries. | 820 // frame, resulting in page_id conflicts for their NavigationEntries. |
833 if (force_swap) | 821 if (force_swap) |
834 CHECK_NE(new_instance, current_instance); | 822 CHECK_NE(new_instance, current_instance); |
835 return new_instance; | 823 return new_instance; |
836 } | 824 } |
837 | 825 |
838 SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL( | 826 SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL( |
839 const GURL& dest_url, | 827 const GURL& dest_url, |
828 SiteInstance* source_instance, | |
829 SiteInstance* current_instance, | |
840 SiteInstance* dest_instance, | 830 SiteInstance* dest_instance, |
841 ui::PageTransition dest_transition, | 831 ui::PageTransition transition, |
842 bool dest_is_restore, | 832 bool dest_is_restore, |
843 bool dest_is_view_source_mode, | 833 bool dest_is_view_source_mode, |
844 SiteInstance* current_instance, | |
845 bool force_browsing_instance_swap) { | 834 bool force_browsing_instance_swap) { |
846 NavigationControllerImpl& controller = | 835 NavigationControllerImpl& controller = |
847 delegate_->GetControllerForRenderManager(); | 836 delegate_->GetControllerForRenderManager(); |
848 BrowserContext* browser_context = controller.GetBrowserContext(); | 837 BrowserContext* browser_context = controller.GetBrowserContext(); |
849 | 838 |
850 // If the entry has an instance already we should use it. | 839 // If the entry has an instance already we should use it. |
851 if (dest_instance) { | 840 if (dest_instance) { |
852 // If we are forcing a swap, this should be in a different BrowsingInstance. | 841 // If we are forcing a swap, this should be in a different BrowsingInstance. |
853 if (force_browsing_instance_swap) { | 842 if (force_browsing_instance_swap) { |
854 CHECK(!dest_instance->IsRelatedSiteInstance( | 843 CHECK(!dest_instance->IsRelatedSiteInstance( |
(...skipping 12 matching lines...) Expand all Loading... | |
867 // If this navigation is generated, then it probably corresponds to a search | 856 // If this navigation is generated, then it probably corresponds to a search |
868 // query. Given that search results typically lead to users navigating to | 857 // query. Given that search results typically lead to users navigating to |
869 // other sites, we don't really want to use the search engine hostname to | 858 // other sites, we don't really want to use the search engine hostname to |
870 // determine the site instance for this navigation. | 859 // determine the site instance for this navigation. |
871 // | 860 // |
872 // NOTE: This can be removed once we have a way to transition between | 861 // NOTE: This can be removed once we have a way to transition between |
873 // RenderViews in response to a link click. | 862 // RenderViews in response to a link click. |
874 // | 863 // |
875 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerSite) && | 864 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerSite) && |
876 ui::PageTransitionCoreTypeIs( | 865 ui::PageTransitionCoreTypeIs( |
877 dest_transition, ui::PAGE_TRANSITION_GENERATED)) { | 866 transition, ui::PAGE_TRANSITION_GENERATED)) { |
878 return current_instance; | 867 return current_instance; |
879 } | 868 } |
880 | 869 |
881 SiteInstanceImpl* current_site_instance = | 870 SiteInstanceImpl* current_site_instance = |
882 static_cast<SiteInstanceImpl*>(current_instance); | 871 static_cast<SiteInstanceImpl*>(current_instance); |
883 | 872 |
884 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it | 873 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it |
885 // for this entry. We won't commit the SiteInstance to this site until the | 874 // for this entry. We won't commit the SiteInstance to this site until the |
886 // navigation commits (in DidNavigate), unless the navigation entry was | 875 // navigation commits (in DidNavigate), unless the navigation entry was |
887 // restored or it's a Web UI as described below. | 876 // restored or it's a Web UI as described below. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
969 // We don't need a swap when going from view-source to a debug URL like | 958 // We don't need a swap when going from view-source to a debug URL like |
970 // chrome://crash, however. | 959 // chrome://crash, however. |
971 // TODO(creis): Refactor this method so this duplicated code isn't needed. | 960 // TODO(creis): Refactor this method so this duplicated code isn't needed. |
972 // See http://crbug.com/123007. | 961 // See http://crbug.com/123007. |
973 if (current_entry && | 962 if (current_entry && |
974 current_entry->IsViewSourceMode() != dest_is_view_source_mode && | 963 current_entry->IsViewSourceMode() != dest_is_view_source_mode && |
975 !IsRendererDebugURL(dest_url)) { | 964 !IsRendererDebugURL(dest_url)) { |
976 return SiteInstance::CreateForURL(browser_context, dest_url); | 965 return SiteInstance::CreateForURL(browser_context, dest_url); |
977 } | 966 } |
978 | 967 |
968 // Use the source SiteInstance in case of data URLs or about:blank pages, | |
969 // because the content is then controlled and/or scriptable by the source | |
970 // SiteInstance. | |
971 GURL blank_page(url::kAboutBlankURL); | |
nasko
2014/12/11 01:14:44
nit: s/blank_page/about_blank/. Any page with vali
lfg
2014/12/11 23:55:24
Done.
| |
972 if (dest_url == blank_page || dest_url.scheme() == url::kDataScheme) | |
Charlie Reis
2014/12/11 00:43:39
We should also test whether source_instance is nul
lfg
2014/12/11 23:55:24
Done.
| |
973 return source_instance; | |
974 | |
979 // Use the current SiteInstance for same site navigations, as long as the | 975 // Use the current SiteInstance for same site navigations, as long as the |
980 // process type is correct. (The URL may have been installed as an app since | 976 // process type is correct. (The URL may have been installed as an app since |
981 // the last time we visited it.) | 977 // the last time we visited it.) |
982 const GURL& current_url = | 978 const GURL& current_url = |
983 GetCurrentURLForSiteInstance(current_instance, current_entry); | 979 GetCurrentURLForSiteInstance(current_instance, current_entry); |
984 if (SiteInstance::IsSameWebSite(browser_context, current_url, dest_url) && | 980 if (SiteInstance::IsSameWebSite(browser_context, current_url, dest_url) && |
985 !current_site_instance->HasWrongProcessForURL(dest_url)) { | 981 !current_site_instance->HasWrongProcessForURL(dest_url)) { |
986 return current_instance; | 982 return current_instance; |
987 } | 983 } |
988 | 984 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1435 // |rvh| to Shutdown. | 1431 // |rvh| to Shutdown. |
1436 FrameTree* tree = rvh->GetDelegate()->GetFrameTree(); | 1432 FrameTree* tree = rvh->GetDelegate()->GetFrameTree(); |
1437 tree->ForEach(base::Bind( | 1433 tree->ForEach(base::Bind( |
1438 &RenderFrameHostManager::ClearProxiesInSiteInstance, | 1434 &RenderFrameHostManager::ClearProxiesInSiteInstance, |
1439 site_instance_id)); | 1435 site_instance_id)); |
1440 } | 1436 } |
1441 } | 1437 } |
1442 } | 1438 } |
1443 | 1439 |
1444 RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( | 1440 RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( |
1445 const GURL& url, | 1441 const GURL& dest_url, |
1446 SiteInstance* instance, | 1442 SiteInstance* source_instance, |
1443 SiteInstance* dest_instance, | |
1447 ui::PageTransition transition, | 1444 ui::PageTransition transition, |
1448 bool is_restore, | 1445 bool dest_is_restore, |
1449 bool is_view_source_mode, | 1446 bool dest_is_view_source_mode, |
1450 const GlobalRequestID& transferred_request_id, | 1447 const GlobalRequestID& transferred_request_id, |
1451 int bindings) { | 1448 int bindings) { |
1452 // If we are currently navigating cross-process, we want to get back to normal | 1449 // If we are currently navigating cross-process, we want to get back to normal |
1453 // and then navigate as usual. | 1450 // and then navigate as usual. |
1454 if (cross_navigation_pending_) { | 1451 if (cross_navigation_pending_) { |
1455 if (pending_render_frame_host_) | 1452 if (pending_render_frame_host_) |
1456 CancelPending(); | 1453 CancelPending(); |
1457 cross_navigation_pending_ = false; | 1454 cross_navigation_pending_ = false; |
1458 } | 1455 } |
1459 | 1456 |
1460 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); | 1457 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |
1461 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( | 1458 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( |
1462 url, instance, transition, is_restore, is_view_source_mode); | 1459 dest_url, source_instance, dest_instance, transition, |
1460 dest_is_restore, dest_is_view_source_mode); | |
1463 | 1461 |
1464 const NavigationEntry* current_entry = | 1462 const NavigationEntry* current_entry = |
1465 delegate_->GetLastCommittedNavigationEntryForRenderManager(); | 1463 delegate_->GetLastCommittedNavigationEntryForRenderManager(); |
1466 | 1464 |
1467 if (new_instance.get() != current_instance) { | 1465 if (new_instance.get() != current_instance) { |
1468 TRACE_EVENT_INSTANT2( | 1466 TRACE_EVENT_INSTANT2( |
1469 "navigation", | 1467 "navigation", |
1470 "RenderFrameHostManager::UpdateStateForNavigate:New SiteInstance", | 1468 "RenderFrameHostManager::UpdateStateForNavigate:New SiteInstance", |
1471 TRACE_EVENT_SCOPE_THREAD, | 1469 TRACE_EVENT_SCOPE_THREAD, |
1472 "current_instance id", current_instance->GetId(), | 1470 "current_instance id", current_instance->GetId(), |
1473 "new_instance id", new_instance->GetId()); | 1471 "new_instance id", new_instance->GetId()); |
1474 | 1472 |
1475 // New SiteInstance: create a pending RFH to navigate. | 1473 // New SiteInstance: create a pending RFH to navigate. |
1476 DCHECK(!cross_navigation_pending_); | 1474 DCHECK(!cross_navigation_pending_); |
1477 | 1475 |
1478 // This will possibly create (set to NULL) a Web UI object for the pending | 1476 // This will possibly create (set to NULL) a Web UI object for the pending |
1479 // page. We'll use this later to give the page special access. This must | 1477 // page. We'll use this later to give the page special access. This must |
1480 // happen before the new renderer is created below so it will get bindings. | 1478 // happen before the new renderer is created below so it will get bindings. |
1481 // It must also happen after the above conditional call to CancelPending(), | 1479 // It must also happen after the above conditional call to CancelPending(), |
1482 // otherwise CancelPending may clear the pending_web_ui_ and the page will | 1480 // otherwise CancelPending may clear the pending_web_ui_ and the page will |
1483 // not have its bindings set appropriately. | 1481 // not have its bindings set appropriately. |
1484 SetPendingWebUI(url, bindings); | 1482 SetPendingWebUI(dest_url, bindings); |
1485 CreatePendingRenderFrameHost(current_instance, new_instance.get(), | 1483 CreatePendingRenderFrameHost(current_instance, new_instance.get(), |
1486 frame_tree_node_->IsMainFrame()); | 1484 frame_tree_node_->IsMainFrame()); |
1487 if (!pending_render_frame_host_.get()) { | 1485 if (!pending_render_frame_host_.get()) { |
1488 return NULL; | 1486 return NULL; |
1489 } | 1487 } |
1490 | 1488 |
1491 // Check if our current RFH is live before we set up a transition. | 1489 // Check if our current RFH is live before we set up a transition. |
1492 if (!render_frame_host_->IsRenderFrameLive()) { | 1490 if (!render_frame_host_->IsRenderFrameLive()) { |
1493 if (!cross_navigation_pending_) { | 1491 if (!cross_navigation_pending_) { |
1494 // The current RFH is not live. There's no reason to sit around with a | 1492 // The current RFH is not live. There's no reason to sit around with a |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1552 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. | 1550 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. |
1553 DCHECK(!cross_navigation_pending_); | 1551 DCHECK(!cross_navigation_pending_); |
1554 | 1552 |
1555 // It's possible to swap out the current RFH and then decide to navigate in it | 1553 // It's possible to swap out the current RFH and then decide to navigate in it |
1556 // anyway (e.g., a cross-process navigation that redirects back to the | 1554 // anyway (e.g., a cross-process navigation that redirects back to the |
1557 // original site). In that case, we have a proxy for the current RFH but | 1555 // original site). In that case, we have a proxy for the current RFH but |
1558 // haven't deleted it yet. The new navigation will swap it back in, so we can | 1556 // haven't deleted it yet. The new navigation will swap it back in, so we can |
1559 // delete the proxy. | 1557 // delete the proxy. |
1560 DeleteRenderFrameProxyHost(new_instance.get()); | 1558 DeleteRenderFrameProxyHost(new_instance.get()); |
1561 | 1559 |
1562 if (ShouldReuseWebUI(current_entry, url)) { | 1560 if (ShouldReuseWebUI(current_entry, dest_url)) { |
1563 pending_web_ui_.reset(); | 1561 pending_web_ui_.reset(); |
1564 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); | 1562 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); |
1565 } else { | 1563 } else { |
1566 SetPendingWebUI(url, bindings); | 1564 SetPendingWebUI(dest_url, bindings); |
1567 // Make sure the new RenderViewHost has the right bindings. | 1565 // Make sure the new RenderViewHost has the right bindings. |
1568 if (pending_web_ui() && | 1566 if (pending_web_ui() && |
1569 !render_frame_host_->GetProcess()->IsIsolatedGuest()) { | 1567 !render_frame_host_->GetProcess()->IsIsolatedGuest()) { |
1570 render_frame_host_->render_view_host()->AllowBindings( | 1568 render_frame_host_->render_view_host()->AllowBindings( |
1571 pending_web_ui()->GetBindings()); | 1569 pending_web_ui()->GetBindings()); |
1572 } | 1570 } |
1573 } | 1571 } |
1574 | 1572 |
1575 if (pending_web_ui() && render_frame_host_->IsRenderFrameLive()) { | 1573 if (pending_web_ui() && render_frame_host_->IsRenderFrameLive()) { |
1576 pending_web_ui()->GetController()->RenderViewReused( | 1574 pending_web_ui()->GetController()->RenderViewReused( |
1577 render_frame_host_->render_view_host()); | 1575 render_frame_host_->render_view_host()); |
1578 } | 1576 } |
1579 | 1577 |
1580 // The renderer can exit view source mode when any error or cancellation | 1578 // The renderer can exit view source mode when any error or cancellation |
1581 // happen. We must overwrite to recover the mode. | 1579 // happen. We must overwrite to recover the mode. |
1582 if (is_view_source_mode) { | 1580 if (dest_is_view_source_mode) { |
1583 render_frame_host_->render_view_host()->Send( | 1581 render_frame_host_->render_view_host()->Send( |
1584 new ViewMsg_EnableViewSourceMode( | 1582 new ViewMsg_EnableViewSourceMode( |
1585 render_frame_host_->render_view_host()->GetRoutingID())); | 1583 render_frame_host_->render_view_host()->GetRoutingID())); |
1586 } | 1584 } |
1587 | 1585 |
1588 return render_frame_host_.get(); | 1586 return render_frame_host_.get(); |
1589 } | 1587 } |
1590 | 1588 |
1591 void RenderFrameHostManager::CancelPending() { | 1589 void RenderFrameHostManager::CancelPending() { |
1592 TRACE_EVENT1("navigation", "RenderFrameHostManager::CancelPending", | 1590 TRACE_EVENT1("navigation", "RenderFrameHostManager::CancelPending", |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1679 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1677 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
1680 SiteInstance* instance) { | 1678 SiteInstance* instance) { |
1681 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1679 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
1682 if (iter != proxy_hosts_.end()) { | 1680 if (iter != proxy_hosts_.end()) { |
1683 delete iter->second; | 1681 delete iter->second; |
1684 proxy_hosts_.erase(iter); | 1682 proxy_hosts_.erase(iter); |
1685 } | 1683 } |
1686 } | 1684 } |
1687 | 1685 |
1688 } // namespace content | 1686 } // namespace content |
OLD | NEW |