| 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "content/browser/frame_host/cross_site_transferring_request.h" | 7 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| 8 #include "content/browser/frame_host/navigation_controller_impl.h" | 8 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 9 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 10 #include "content/browser/frame_host/navigation_request.h" | 10 #include "content/browser/frame_host/navigation_request.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 RenderViewHostDeletedObserver rvh_observer(old_rvh); | 316 RenderViewHostDeletedObserver rvh_observer(old_rvh); |
| 317 active_test_rvh()->SendNavigate(max_page_id + 1, url); | 317 active_test_rvh()->SendNavigate(max_page_id + 1, url); |
| 318 | 318 |
| 319 if (old_rvh != active_rvh() && !rvh_observer.deleted()) | 319 if (old_rvh != active_rvh() && !rvh_observer.deleted()) |
| 320 EXPECT_TRUE(old_rvh->IsSwappedOut()); | 320 EXPECT_TRUE(old_rvh->IsSwappedOut()); |
| 321 } | 321 } |
| 322 | 322 |
| 323 bool ShouldSwapProcesses(RenderFrameHostManager* manager, | 323 bool ShouldSwapProcesses(RenderFrameHostManager* manager, |
| 324 const NavigationEntryImpl* current_entry, | 324 const NavigationEntryImpl* current_entry, |
| 325 const NavigationEntryImpl* new_entry) const { | 325 const NavigationEntryImpl* new_entry) const { |
| 326 return manager->ShouldSwapBrowsingInstancesForNavigation(current_entry, | 326 CHECK(new_entry); |
| 327 new_entry); | 327 BrowserContext* browser_context = |
| 328 manager->delegate_->GetControllerForRenderManager().GetBrowserContext(); |
| 329 const GURL& current_effective_url = current_entry ? |
| 330 SiteInstanceImpl::GetEffectiveURL(browser_context, |
| 331 current_entry->GetURL()) : |
| 332 manager->render_frame_host_->GetSiteInstance()->GetSiteURL(); |
| 333 bool current_is_view_source_mode = current_entry ? |
| 334 current_entry->IsViewSourceMode() : new_entry->IsViewSourceMode(); |
| 335 return manager->ShouldSwapBrowsingInstancesForNavigation( |
| 336 current_effective_url, |
| 337 current_is_view_source_mode, |
| 338 new_entry->site_instance(), |
| 339 SiteInstanceImpl::GetEffectiveURL(browser_context, new_entry->GetURL()), |
| 340 new_entry->IsViewSourceMode()); |
| 328 } | 341 } |
| 329 | 342 |
| 330 // Creates a test RenderViewHost that's swapped out. | 343 // Creates a test RenderViewHost that's swapped out. |
| 331 TestRenderViewHost* CreateSwappedOutRenderViewHost() { | 344 TestRenderViewHost* CreateSwappedOutRenderViewHost() { |
| 332 const GURL kChromeURL("chrome://foo"); | 345 const GURL kChromeURL("chrome://foo"); |
| 333 const GURL kDestUrl("http://www.google.com/"); | 346 const GURL kDestUrl("http://www.google.com/"); |
| 334 | 347 |
| 335 // Navigate our first tab to a chrome url and then to the destination. | 348 // Navigate our first tab to a chrome url and then to the destination. |
| 336 NavigateActiveAndCommit(kChromeURL); | 349 NavigateActiveAndCommit(kChromeURL); |
| 337 TestRenderViewHost* ntp_rvh = static_cast<TestRenderViewHost*>( | 350 TestRenderViewHost* ntp_rvh = static_cast<TestRenderViewHost*>( |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 NavigationRequestForRenderFrameManager( | 1898 NavigationRequestForRenderFrameManager( |
| 1886 main_test_rfh()->frame_tree_node()->render_manager()); | 1899 main_test_rfh()->frame_tree_node()->render_manager()); |
| 1887 ASSERT_TRUE(main_request); | 1900 ASSERT_TRUE(main_request); |
| 1888 EXPECT_EQ(kUrl3, main_request->info_for_testing().navigation_params.url); | 1901 EXPECT_EQ(kUrl3, main_request->info_for_testing().navigation_params.url); |
| 1889 EXPECT_EQ(kUrl3, main_request->info_for_testing().first_party_for_cookies); | 1902 EXPECT_EQ(kUrl3, main_request->info_for_testing().first_party_for_cookies); |
| 1890 EXPECT_TRUE(main_request->info_for_testing().is_main_frame); | 1903 EXPECT_TRUE(main_request->info_for_testing().is_main_frame); |
| 1891 EXPECT_FALSE(main_request->info_for_testing().parent_is_main_frame); | 1904 EXPECT_FALSE(main_request->info_for_testing().parent_is_main_frame); |
| 1892 } | 1905 } |
| 1893 | 1906 |
| 1894 } // namespace content | 1907 } // namespace content |
| OLD | NEW |