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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 ui::PageTransition transition) { | 616 ui::PageTransition transition) { |
625 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( | 617 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( |
626 switches::kEnableBrowserSideNavigation)); | 618 switches::kEnableBrowserSideNavigation)); |
627 // TODO(clamy): When we handle renderer initiated navigations, make sure not | 619 // TODO(clamy): When we handle renderer initiated navigations, make sure not |
628 // to use a different process for subframes if --site-per-process is not | 620 // to use a different process for subframes if --site-per-process is not |
629 // enabled. | 621 // enabled. |
630 | 622 |
631 // Pick the right RenderFrameHost to commit the navigation. | 623 // Pick the right RenderFrameHost to commit the navigation. |
632 // TODO(clamy): Replace the default values by the right ones. | 624 // TODO(clamy): Replace the default values by the right ones. |
633 RenderFrameHostImpl* render_frame_host = UpdateStateForNavigate( | 625 RenderFrameHostImpl* render_frame_host = UpdateStateForNavigate( |
634 url, NULL, transition, false, false, GlobalRequestID(), | 626 url, nullptr, nullptr, transition, false, false, GlobalRequestID(), |
635 NavigationEntryImpl::kInvalidBindings); | 627 NavigationEntryImpl::kInvalidBindings); |
636 | 628 |
637 // If the renderer that needs to navigate is not live (it was just created or | 629 // If the renderer that needs to navigate is not live (it was just created or |
638 // it crashed), initialize it. | 630 // it crashed), initialize it. |
639 if (!render_frame_host->render_view_host()->IsRenderViewLive()) { | 631 if (!render_frame_host->render_view_host()->IsRenderViewLive()) { |
640 // Recreate the opener chain. | 632 // Recreate the opener chain. |
641 int opener_route_id = delegate_->CreateOpenerRenderViewsForRenderManager( | 633 int opener_route_id = delegate_->CreateOpenerRenderViewsForRenderManager( |
642 render_frame_host->GetSiteInstance()); | 634 render_frame_host->GetSiteInstance()); |
643 if (!InitRenderView(render_frame_host->render_view_host(), | 635 if (!InitRenderView(render_frame_host->render_view_host(), |
644 opener_route_id, | 636 opener_route_id, |
645 MSG_ROUTING_NONE, | 637 MSG_ROUTING_NONE, |
646 frame_tree_node_->IsMainFrame())) { | 638 frame_tree_node_->IsMainFrame())) { |
647 return NULL; | 639 return nullptr; |
648 } | 640 } |
649 } | 641 } |
650 return render_frame_host; | 642 return render_frame_host; |
651 } | 643 } |
652 | 644 |
653 void RenderFrameHostManager::Observe( | 645 void RenderFrameHostManager::Observe( |
654 int type, | 646 int type, |
655 const NotificationSource& source, | 647 const NotificationSource& source, |
656 const NotificationDetails& details) { | 648 const NotificationDetails& details) { |
657 switch (type) { | 649 switch (type) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 delegate_->GetControllerForRenderManager(); | 763 delegate_->GetControllerForRenderManager(); |
772 return current_entry && web_ui_.get() && | 764 return current_entry && web_ui_.get() && |
773 (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( | 765 (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( |
774 controller.GetBrowserContext(), current_entry->GetURL()) == | 766 controller.GetBrowserContext(), current_entry->GetURL()) == |
775 WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( | 767 WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( |
776 controller.GetBrowserContext(), new_url)); | 768 controller.GetBrowserContext(), new_url)); |
777 } | 769 } |
778 | 770 |
779 SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation( | 771 SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation( |
780 const GURL& dest_url, | 772 const GURL& dest_url, |
773 SiteInstance* source_instance, | |
781 SiteInstance* dest_instance, | 774 SiteInstance* dest_instance, |
782 ui::PageTransition dest_transition, | 775 ui::PageTransition transition, |
783 bool dest_is_restore, | 776 bool dest_is_restore, |
784 bool dest_is_view_source_mode) { | 777 bool dest_is_view_source_mode) { |
785 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); | 778 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |
786 SiteInstance* new_instance = current_instance; | 779 SiteInstance* new_instance = current_instance; |
787 | 780 |
788 // We do not currently swap processes for navigations in webview tag guests. | 781 // We do not currently swap processes for navigations in webview tag guests. |
789 if (current_instance->GetSiteURL().SchemeIs(kGuestScheme)) | 782 if (current_instance->GetSiteURL().SchemeIs(kGuestScheme)) |
790 return current_instance; | 783 return current_instance; |
791 | 784 |
792 // Determine if we need a new BrowsingInstance for this entry. If true, this | 785 // Determine if we need a new BrowsingInstance for this entry. If true, this |
(...skipping 13 matching lines...) Expand all Loading... | |
806 bool current_is_view_source_mode = current_entry ? | 799 bool current_is_view_source_mode = current_entry ? |
807 current_entry->IsViewSourceMode() : dest_is_view_source_mode; | 800 current_entry->IsViewSourceMode() : dest_is_view_source_mode; |
808 bool force_swap = ShouldSwapBrowsingInstancesForNavigation( | 801 bool force_swap = ShouldSwapBrowsingInstancesForNavigation( |
809 current_effective_url, | 802 current_effective_url, |
810 current_is_view_source_mode, | 803 current_is_view_source_mode, |
811 dest_instance, | 804 dest_instance, |
812 SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url), | 805 SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url), |
813 dest_is_view_source_mode); | 806 dest_is_view_source_mode); |
814 if (ShouldTransitionCrossSite() || force_swap) { | 807 if (ShouldTransitionCrossSite() || force_swap) { |
815 new_instance = GetSiteInstanceForURL( | 808 new_instance = GetSiteInstanceForURL( |
816 dest_url, | 809 dest_url, source_instance, current_instance, dest_instance, |
817 dest_instance, | 810 transition, dest_is_restore, dest_is_view_source_mode, force_swap); |
818 dest_transition, | |
819 dest_is_restore, | |
820 dest_is_view_source_mode, | |
821 current_instance, | |
822 force_swap); | |
823 } | 811 } |
824 | 812 |
825 // If force_swap is true, we must use a different SiteInstance. If we didn't, | 813 // If force_swap is true, we must use a different SiteInstance. If we didn't, |
826 // we would have two RenderFrameHosts in the same SiteInstance and the same | 814 // we would have two RenderFrameHosts in the same SiteInstance and the same |
827 // frame, resulting in page_id conflicts for their NavigationEntries. | 815 // frame, resulting in page_id conflicts for their NavigationEntries. |
828 if (force_swap) | 816 if (force_swap) |
829 CHECK_NE(new_instance, current_instance); | 817 CHECK_NE(new_instance, current_instance); |
830 return new_instance; | 818 return new_instance; |
831 } | 819 } |
832 | 820 |
833 SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL( | 821 SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL( |
834 const GURL& dest_url, | 822 const GURL& dest_url, |
823 SiteInstance* source_instance, | |
824 SiteInstance* current_instance, | |
835 SiteInstance* dest_instance, | 825 SiteInstance* dest_instance, |
836 ui::PageTransition dest_transition, | 826 ui::PageTransition transition, |
837 bool dest_is_restore, | 827 bool dest_is_restore, |
838 bool dest_is_view_source_mode, | 828 bool dest_is_view_source_mode, |
839 SiteInstance* current_instance, | |
840 bool force_browsing_instance_swap) { | 829 bool force_browsing_instance_swap) { |
841 NavigationControllerImpl& controller = | 830 NavigationControllerImpl& controller = |
842 delegate_->GetControllerForRenderManager(); | 831 delegate_->GetControllerForRenderManager(); |
843 BrowserContext* browser_context = controller.GetBrowserContext(); | 832 BrowserContext* browser_context = controller.GetBrowserContext(); |
844 | 833 |
845 // If the entry has an instance already we should use it. | 834 // If the entry has an instance already we should use it. |
846 if (dest_instance) { | 835 if (dest_instance) { |
847 // If we are forcing a swap, this should be in a different BrowsingInstance. | 836 // If we are forcing a swap, this should be in a different BrowsingInstance. |
848 if (force_browsing_instance_swap) { | 837 if (force_browsing_instance_swap) { |
849 CHECK(!dest_instance->IsRelatedSiteInstance( | 838 CHECK(!dest_instance->IsRelatedSiteInstance( |
(...skipping 12 matching lines...) Expand all Loading... | |
862 // If this navigation is generated, then it probably corresponds to a search | 851 // If this navigation is generated, then it probably corresponds to a search |
863 // query. Given that search results typically lead to users navigating to | 852 // query. Given that search results typically lead to users navigating to |
864 // other sites, we don't really want to use the search engine hostname to | 853 // other sites, we don't really want to use the search engine hostname to |
865 // determine the site instance for this navigation. | 854 // determine the site instance for this navigation. |
866 // | 855 // |
867 // NOTE: This can be removed once we have a way to transition between | 856 // NOTE: This can be removed once we have a way to transition between |
868 // RenderViews in response to a link click. | 857 // RenderViews in response to a link click. |
869 // | 858 // |
870 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerSite) && | 859 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerSite) && |
871 ui::PageTransitionCoreTypeIs( | 860 ui::PageTransitionCoreTypeIs( |
872 dest_transition, ui::PAGE_TRANSITION_GENERATED)) { | 861 transition, ui::PAGE_TRANSITION_GENERATED)) { |
873 return current_instance; | 862 return current_instance; |
874 } | 863 } |
875 | 864 |
876 SiteInstanceImpl* current_site_instance = | 865 SiteInstanceImpl* current_site_instance = |
877 static_cast<SiteInstanceImpl*>(current_instance); | 866 static_cast<SiteInstanceImpl*>(current_instance); |
878 | 867 |
879 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it | 868 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it |
880 // for this entry. We won't commit the SiteInstance to this site until the | 869 // for this entry. We won't commit the SiteInstance to this site until the |
881 // navigation commits (in DidNavigate), unless the navigation entry was | 870 // navigation commits (in DidNavigate), unless the navigation entry was |
882 // restored or it's a Web UI as described below. | 871 // restored or it's a Web UI as described below. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
964 // We don't need a swap when going from view-source to a debug URL like | 953 // We don't need a swap when going from view-source to a debug URL like |
965 // chrome://crash, however. | 954 // chrome://crash, however. |
966 // TODO(creis): Refactor this method so this duplicated code isn't needed. | 955 // TODO(creis): Refactor this method so this duplicated code isn't needed. |
967 // See http://crbug.com/123007. | 956 // See http://crbug.com/123007. |
968 if (current_entry && | 957 if (current_entry && |
969 current_entry->IsViewSourceMode() != dest_is_view_source_mode && | 958 current_entry->IsViewSourceMode() != dest_is_view_source_mode && |
970 !IsRendererDebugURL(dest_url)) { | 959 !IsRendererDebugURL(dest_url)) { |
971 return SiteInstance::CreateForURL(browser_context, dest_url); | 960 return SiteInstance::CreateForURL(browser_context, dest_url); |
972 } | 961 } |
973 | 962 |
963 // Use the source site instance in case of data URLs or about:blank pages. | |
Charlie Reis
2014/12/09 19:14:37
nit: source SiteInstance
nit: Add ", because the c
lfg
2014/12/10 21:53:00
Done.
| |
964 GURL blank_page(url::kAboutBlankURL); | |
965 if (dest_url == blank_page || dest_url.scheme() == url::kDataScheme) | |
966 return source_instance; | |
967 | |
974 // Use the current SiteInstance for same site navigations, as long as the | 968 // Use the current SiteInstance for same site navigations, as long as the |
975 // process type is correct. (The URL may have been installed as an app since | 969 // process type is correct. (The URL may have been installed as an app since |
976 // the last time we visited it.) | 970 // the last time we visited it.) |
977 const GURL& current_url = | 971 const GURL& current_url = |
978 GetCurrentURLForSiteInstance(current_instance, current_entry); | 972 GetCurrentURLForSiteInstance(current_instance, current_entry); |
979 if (SiteInstance::IsSameWebSite(browser_context, current_url, dest_url) && | 973 if (SiteInstance::IsSameWebSite(browser_context, current_url, dest_url) && |
980 !current_site_instance->HasWrongProcessForURL(dest_url)) { | 974 !current_site_instance->HasWrongProcessForURL(dest_url)) { |
981 return current_instance; | 975 return current_instance; |
982 } | 976 } |
983 | 977 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1430 // |rvh| to Shutdown. | 1424 // |rvh| to Shutdown. |
1431 FrameTree* tree = rvh->GetDelegate()->GetFrameTree(); | 1425 FrameTree* tree = rvh->GetDelegate()->GetFrameTree(); |
1432 tree->ForEach(base::Bind( | 1426 tree->ForEach(base::Bind( |
1433 &RenderFrameHostManager::ClearProxiesInSiteInstance, | 1427 &RenderFrameHostManager::ClearProxiesInSiteInstance, |
1434 site_instance_id)); | 1428 site_instance_id)); |
1435 } | 1429 } |
1436 } | 1430 } |
1437 } | 1431 } |
1438 | 1432 |
1439 RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( | 1433 RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( |
1440 const GURL& url, | 1434 const GURL& dest_url, |
1441 SiteInstance* instance, | 1435 SiteInstance* source_instance, |
1436 SiteInstance* dest_instance, | |
1442 ui::PageTransition transition, | 1437 ui::PageTransition transition, |
1443 bool is_restore, | 1438 bool dest_is_restore, |
1444 bool is_view_source_mode, | 1439 bool dest_is_view_source_mode, |
1445 const GlobalRequestID& transferred_request_id, | 1440 const GlobalRequestID& transferred_request_id, |
1446 int bindings) { | 1441 int bindings) { |
1447 // If we are currently navigating cross-process, we want to get back to normal | 1442 // If we are currently navigating cross-process, we want to get back to normal |
1448 // and then navigate as usual. | 1443 // and then navigate as usual. |
1449 if (cross_navigation_pending_) { | 1444 if (cross_navigation_pending_) { |
1450 if (pending_render_frame_host_) | 1445 if (pending_render_frame_host_) |
1451 CancelPending(); | 1446 CancelPending(); |
1452 cross_navigation_pending_ = false; | 1447 cross_navigation_pending_ = false; |
1453 } | 1448 } |
1454 | 1449 |
1455 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); | 1450 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |
1456 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( | 1451 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( |
1457 url, instance, transition, is_restore, is_view_source_mode); | 1452 dest_url, source_instance, dest_instance, transition, |
1453 dest_is_restore, dest_is_view_source_mode); | |
1458 | 1454 |
1459 const NavigationEntry* current_entry = | 1455 const NavigationEntry* current_entry = |
1460 delegate_->GetLastCommittedNavigationEntryForRenderManager(); | 1456 delegate_->GetLastCommittedNavigationEntryForRenderManager(); |
1461 | 1457 |
1462 if (new_instance.get() != current_instance) { | 1458 if (new_instance.get() != current_instance) { |
1463 TRACE_EVENT_INSTANT2( | 1459 TRACE_EVENT_INSTANT2( |
1464 "navigation", | 1460 "navigation", |
1465 "RenderFrameHostManager::UpdateStateForNavigate:New SiteInstance", | 1461 "RenderFrameHostManager::UpdateStateForNavigate:New SiteInstance", |
1466 TRACE_EVENT_SCOPE_THREAD, | 1462 TRACE_EVENT_SCOPE_THREAD, |
1467 "current_instance id", current_instance->GetId(), | 1463 "current_instance id", current_instance->GetId(), |
1468 "new_instance id", new_instance->GetId()); | 1464 "new_instance id", new_instance->GetId()); |
1469 | 1465 |
1470 // New SiteInstance: create a pending RFH to navigate. | 1466 // New SiteInstance: create a pending RFH to navigate. |
1471 DCHECK(!cross_navigation_pending_); | 1467 DCHECK(!cross_navigation_pending_); |
1472 | 1468 |
1473 // This will possibly create (set to NULL) a Web UI object for the pending | 1469 // This will possibly create (set to NULL) a Web UI object for the pending |
1474 // page. We'll use this later to give the page special access. This must | 1470 // page. We'll use this later to give the page special access. This must |
1475 // happen before the new renderer is created below so it will get bindings. | 1471 // happen before the new renderer is created below so it will get bindings. |
1476 // It must also happen after the above conditional call to CancelPending(), | 1472 // It must also happen after the above conditional call to CancelPending(), |
1477 // otherwise CancelPending may clear the pending_web_ui_ and the page will | 1473 // otherwise CancelPending may clear the pending_web_ui_ and the page will |
1478 // not have its bindings set appropriately. | 1474 // not have its bindings set appropriately. |
1479 SetPendingWebUI(url, bindings); | 1475 SetPendingWebUI(dest_url, bindings); |
1480 CreatePendingRenderFrameHost(current_instance, new_instance.get(), | 1476 CreatePendingRenderFrameHost(current_instance, new_instance.get(), |
1481 frame_tree_node_->IsMainFrame()); | 1477 frame_tree_node_->IsMainFrame()); |
1482 if (!pending_render_frame_host_.get()) { | 1478 if (!pending_render_frame_host_.get()) { |
1483 return NULL; | 1479 return NULL; |
1484 } | 1480 } |
1485 | 1481 |
1486 // Check if our current RFH is live before we set up a transition. | 1482 // Check if our current RFH is live before we set up a transition. |
1487 if (!render_frame_host_->IsRenderFrameLive()) { | 1483 if (!render_frame_host_->IsRenderFrameLive()) { |
1488 if (!cross_navigation_pending_) { | 1484 if (!cross_navigation_pending_) { |
1489 // The current RFH is not live. There's no reason to sit around with a | 1485 // 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... | |
1547 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. | 1543 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. |
1548 DCHECK(!cross_navigation_pending_); | 1544 DCHECK(!cross_navigation_pending_); |
1549 | 1545 |
1550 // It's possible to swap out the current RFH and then decide to navigate in it | 1546 // It's possible to swap out the current RFH and then decide to navigate in it |
1551 // anyway (e.g., a cross-process navigation that redirects back to the | 1547 // anyway (e.g., a cross-process navigation that redirects back to the |
1552 // original site). In that case, we have a proxy for the current RFH but | 1548 // original site). In that case, we have a proxy for the current RFH but |
1553 // haven't deleted it yet. The new navigation will swap it back in, so we can | 1549 // haven't deleted it yet. The new navigation will swap it back in, so we can |
1554 // delete the proxy. | 1550 // delete the proxy. |
1555 DeleteRenderFrameProxyHost(new_instance.get()); | 1551 DeleteRenderFrameProxyHost(new_instance.get()); |
1556 | 1552 |
1557 if (ShouldReuseWebUI(current_entry, url)) { | 1553 if (ShouldReuseWebUI(current_entry, dest_url)) { |
1558 pending_web_ui_.reset(); | 1554 pending_web_ui_.reset(); |
1559 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); | 1555 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); |
1560 } else { | 1556 } else { |
1561 SetPendingWebUI(url, bindings); | 1557 SetPendingWebUI(dest_url, bindings); |
1562 // Make sure the new RenderViewHost has the right bindings. | 1558 // Make sure the new RenderViewHost has the right bindings. |
1563 if (pending_web_ui() && | 1559 if (pending_web_ui() && |
1564 !render_frame_host_->GetProcess()->IsIsolatedGuest()) { | 1560 !render_frame_host_->GetProcess()->IsIsolatedGuest()) { |
1565 render_frame_host_->render_view_host()->AllowBindings( | 1561 render_frame_host_->render_view_host()->AllowBindings( |
1566 pending_web_ui()->GetBindings()); | 1562 pending_web_ui()->GetBindings()); |
1567 } | 1563 } |
1568 } | 1564 } |
1569 | 1565 |
1570 if (pending_web_ui() && render_frame_host_->IsRenderFrameLive()) { | 1566 if (pending_web_ui() && render_frame_host_->IsRenderFrameLive()) { |
1571 pending_web_ui()->GetController()->RenderViewReused( | 1567 pending_web_ui()->GetController()->RenderViewReused( |
1572 render_frame_host_->render_view_host()); | 1568 render_frame_host_->render_view_host()); |
1573 } | 1569 } |
1574 | 1570 |
1575 // The renderer can exit view source mode when any error or cancellation | 1571 // The renderer can exit view source mode when any error or cancellation |
1576 // happen. We must overwrite to recover the mode. | 1572 // happen. We must overwrite to recover the mode. |
1577 if (is_view_source_mode) { | 1573 if (dest_is_view_source_mode) { |
1578 render_frame_host_->render_view_host()->Send( | 1574 render_frame_host_->render_view_host()->Send( |
1579 new ViewMsg_EnableViewSourceMode( | 1575 new ViewMsg_EnableViewSourceMode( |
1580 render_frame_host_->render_view_host()->GetRoutingID())); | 1576 render_frame_host_->render_view_host()->GetRoutingID())); |
1581 } | 1577 } |
1582 | 1578 |
1583 return render_frame_host_.get(); | 1579 return render_frame_host_.get(); |
1584 } | 1580 } |
1585 | 1581 |
1586 void RenderFrameHostManager::CancelPending() { | 1582 void RenderFrameHostManager::CancelPending() { |
1587 TRACE_EVENT1("navigation", "RenderFrameHostManager::CancelPending", | 1583 TRACE_EVENT1("navigation", "RenderFrameHostManager::CancelPending", |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1674 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1670 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
1675 SiteInstance* instance) { | 1671 SiteInstance* instance) { |
1676 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1672 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
1677 if (iter != proxy_hosts_.end()) { | 1673 if (iter != proxy_hosts_.end()) { |
1678 delete iter->second; | 1674 delete iter->second; |
1679 proxy_hosts_.erase(iter); | 1675 proxy_hosts_.erase(iter); |
1680 } | 1676 } |
1681 } | 1677 } |
1682 | 1678 |
1683 } // namespace content | 1679 } // namespace content |
OLD | NEW |