| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 | 354 |
| 355 void RenderFrameHostManager::OnCrossSiteResponse( | 355 void RenderFrameHostManager::OnCrossSiteResponse( |
| 356 RenderFrameHostImpl* pending_render_frame_host, | 356 RenderFrameHostImpl* pending_render_frame_host, |
| 357 const GlobalRequestID& global_request_id, | 357 const GlobalRequestID& global_request_id, |
| 358 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, | 358 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, |
| 359 const std::vector<GURL>& transfer_url_chain, | 359 const std::vector<GURL>& transfer_url_chain, |
| 360 const Referrer& referrer, | 360 const Referrer& referrer, |
| 361 PageTransition page_transition, | 361 ui::PageTransition page_transition, |
| 362 bool should_replace_current_entry) { | 362 bool should_replace_current_entry) { |
| 363 // We should only get here for transfer navigations. Most cross-process | 363 // We should only get here for transfer navigations. Most cross-process |
| 364 // navigations can just continue and wait to run the unload handler (by | 364 // navigations can just continue and wait to run the unload handler (by |
| 365 // swapping out) when the new navigation commits. | 365 // swapping out) when the new navigation commits. |
| 366 CHECK(cross_site_transferring_request.get()); | 366 CHECK(cross_site_transferring_request.get()); |
| 367 | 367 |
| 368 // A transfer should only have come from our pending or current RFH. | 368 // A transfer should only have come from our pending or current RFH. |
| 369 // TODO(creis): We need to handle the case that the pending RFH has changed | 369 // TODO(creis): We need to handle the case that the pending RFH has changed |
| 370 // in the mean time, while this was being posted from the IO thread. We | 370 // in the mean time, while this was being posted from the IO thread. We |
| 371 // should probably cancel the request in that case. | 371 // should probably cancel the request in that case. |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 return current_entry && web_ui_.get() && | 795 return current_entry && web_ui_.get() && |
| 796 (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( | 796 (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( |
| 797 controller.GetBrowserContext(), current_entry->GetURL()) == | 797 controller.GetBrowserContext(), current_entry->GetURL()) == |
| 798 WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( | 798 WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType( |
| 799 controller.GetBrowserContext(), new_entry->GetURL())); | 799 controller.GetBrowserContext(), new_entry->GetURL())); |
| 800 } | 800 } |
| 801 | 801 |
| 802 SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation( | 802 SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation( |
| 803 const GURL& dest_url, | 803 const GURL& dest_url, |
| 804 SiteInstance* dest_instance, | 804 SiteInstance* dest_instance, |
| 805 PageTransition dest_transition, | 805 ui::PageTransition dest_transition, |
| 806 bool dest_is_restore, | 806 bool dest_is_restore, |
| 807 bool dest_is_view_source_mode) { | 807 bool dest_is_view_source_mode) { |
| 808 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); | 808 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |
| 809 SiteInstance* new_instance = current_instance; | 809 SiteInstance* new_instance = current_instance; |
| 810 | 810 |
| 811 // We do not currently swap processes for navigations in webview tag guests. | 811 // We do not currently swap processes for navigations in webview tag guests. |
| 812 bool is_guest_scheme = current_instance->GetSiteURL().SchemeIs(kGuestScheme); | 812 bool is_guest_scheme = current_instance->GetSiteURL().SchemeIs(kGuestScheme); |
| 813 | 813 |
| 814 // Determine if we need a new BrowsingInstance for this entry. If true, this | 814 // Determine if we need a new BrowsingInstance for this entry. If true, this |
| 815 // implies that it will get a new SiteInstance (and likely process), and that | 815 // implies that it will get a new SiteInstance (and likely process), and that |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 // we would have two RenderFrameHosts in the same SiteInstance and the same | 849 // we would have two RenderFrameHosts in the same SiteInstance and the same |
| 850 // frame, resulting in page_id conflicts for their NavigationEntries. | 850 // frame, resulting in page_id conflicts for their NavigationEntries. |
| 851 if (force_swap) | 851 if (force_swap) |
| 852 CHECK_NE(new_instance, current_instance); | 852 CHECK_NE(new_instance, current_instance); |
| 853 return new_instance; | 853 return new_instance; |
| 854 } | 854 } |
| 855 | 855 |
| 856 SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL( | 856 SiteInstance* RenderFrameHostManager::GetSiteInstanceForURL( |
| 857 const GURL& dest_url, | 857 const GURL& dest_url, |
| 858 SiteInstance* dest_instance, | 858 SiteInstance* dest_instance, |
| 859 PageTransition dest_transition, | 859 ui::PageTransition dest_transition, |
| 860 bool dest_is_restore, | 860 bool dest_is_restore, |
| 861 bool dest_is_view_source_mode, | 861 bool dest_is_view_source_mode, |
| 862 SiteInstance* current_instance, | 862 SiteInstance* current_instance, |
| 863 bool force_browsing_instance_swap) { | 863 bool force_browsing_instance_swap) { |
| 864 NavigationControllerImpl& controller = | 864 NavigationControllerImpl& controller = |
| 865 delegate_->GetControllerForRenderManager(); | 865 delegate_->GetControllerForRenderManager(); |
| 866 BrowserContext* browser_context = controller.GetBrowserContext(); | 866 BrowserContext* browser_context = controller.GetBrowserContext(); |
| 867 | 867 |
| 868 // If the entry has an instance already we should use it. | 868 // If the entry has an instance already we should use it. |
| 869 if (dest_instance) { | 869 if (dest_instance) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 884 // | 884 // |
| 885 // If this navigation is generated, then it probably corresponds to a search | 885 // If this navigation is generated, then it probably corresponds to a search |
| 886 // query. Given that search results typically lead to users navigating to | 886 // query. Given that search results typically lead to users navigating to |
| 887 // other sites, we don't really want to use the search engine hostname to | 887 // other sites, we don't really want to use the search engine hostname to |
| 888 // determine the site instance for this navigation. | 888 // determine the site instance for this navigation. |
| 889 // | 889 // |
| 890 // NOTE: This can be removed once we have a way to transition between | 890 // NOTE: This can be removed once we have a way to transition between |
| 891 // RenderViews in response to a link click. | 891 // RenderViews in response to a link click. |
| 892 // | 892 // |
| 893 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerSite) && | 893 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerSite) && |
| 894 PageTransitionCoreTypeIs(dest_transition, PAGE_TRANSITION_GENERATED)) { | 894 ui::PageTransitionCoreTypeIs( |
| 895 dest_transition, ui::PAGE_TRANSITION_GENERATED)) { |
| 895 return current_instance; | 896 return current_instance; |
| 896 } | 897 } |
| 897 | 898 |
| 898 SiteInstanceImpl* current_site_instance = | 899 SiteInstanceImpl* current_site_instance = |
| 899 static_cast<SiteInstanceImpl*>(current_instance); | 900 static_cast<SiteInstanceImpl*>(current_instance); |
| 900 | 901 |
| 901 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it | 902 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it |
| 902 // for this entry. We won't commit the SiteInstance to this site until the | 903 // for this entry. We won't commit the SiteInstance to this site until the |
| 903 // navigation commits (in DidNavigate), unless the navigation entry was | 904 // navigation commits (in DidNavigate), unless the navigation entry was |
| 904 // restored or it's a Web UI as described below. | 905 // restored or it's a Web UI as described below. |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1712 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 1712 SiteInstance* instance) { | 1713 SiteInstance* instance) { |
| 1713 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1714 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 1714 if (iter != proxy_hosts_.end()) { | 1715 if (iter != proxy_hosts_.end()) { |
| 1715 delete iter->second; | 1716 delete iter->second; |
| 1716 proxy_hosts_.erase(iter); | 1717 proxy_hosts_.erase(iter); |
| 1717 } | 1718 } |
| 1718 } | 1719 } |
| 1719 | 1720 |
| 1720 } // namespace content | 1721 } // namespace content |
| OLD | NEW |