| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/render_view_host_manager.h" | 5 #include "content/browser/tab_contents/render_view_host_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/browser/renderer_host/render_view_host.h" | 9 #include "content/browser/renderer_host/render_view_host.h" |
| 10 #include "content/browser/renderer_host/render_view_host_delegate.h" | 10 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 | 380 |
| 381 SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( | 381 SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( |
| 382 const NavigationEntry& entry, | 382 const NavigationEntry& entry, |
| 383 SiteInstance* curr_instance) { | 383 SiteInstance* curr_instance) { |
| 384 // NOTE: This is only called when ShouldTransitionCrossSite is true. | 384 // NOTE: This is only called when ShouldTransitionCrossSite is true. |
| 385 | 385 |
| 386 const GURL& dest_url = entry.url(); | 386 const GURL& dest_url = entry.url(); |
| 387 NavigationController& controller = delegate_->GetControllerForRenderManager(); | 387 NavigationController& controller = delegate_->GetControllerForRenderManager(); |
| 388 content::BrowserContext* browser_context = controller.browser_context(); | 388 content::BrowserContext* browser_context = controller.browser_context(); |
| 389 | 389 |
| 390 // If the entry has an instance already we should use it, unless the URL | 390 // If the entry has an instance already we should use it. |
| 391 // is part of an app that has been installed or uninstalled since the last | 391 if (entry.site_instance()) |
| 392 // visit. | 392 return entry.site_instance(); |
| 393 if (entry.site_instance()) { | |
| 394 if (entry.site_instance()->HasWrongProcessForURL(dest_url)) | |
| 395 return curr_instance->GetRelatedSiteInstance(dest_url); | |
| 396 else | |
| 397 return entry.site_instance(); | |
| 398 } | |
| 399 | 393 |
| 400 // (UGLY) HEURISTIC, process-per-site only: | 394 // (UGLY) HEURISTIC, process-per-site only: |
| 401 // | 395 // |
| 402 // If this navigation is generated, then it probably corresponds to a search | 396 // If this navigation is generated, then it probably corresponds to a search |
| 403 // query. Given that search results typically lead to users navigating to | 397 // query. Given that search results typically lead to users navigating to |
| 404 // other sites, we don't really want to use the search engine hostname to | 398 // other sites, we don't really want to use the search engine hostname to |
| 405 // determine the site instance for this navigation. | 399 // determine the site instance for this navigation. |
| 406 // | 400 // |
| 407 // NOTE: This can be removed once we have a way to transition between | 401 // NOTE: This can be removed once we have a way to transition between |
| 408 // RenderViews in response to a link click. | 402 // RenderViews in response to a link click. |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 } | 796 } |
| 803 } | 797 } |
| 804 | 798 |
| 805 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { | 799 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { |
| 806 if (!rvh->site_instance()) | 800 if (!rvh->site_instance()) |
| 807 return false; | 801 return false; |
| 808 | 802 |
| 809 return swapped_out_hosts_.find(rvh->site_instance()->id()) != | 803 return swapped_out_hosts_.find(rvh->site_instance()->id()) != |
| 810 swapped_out_hosts_.end(); | 804 swapped_out_hosts_.end(); |
| 811 } | 805 } |
| OLD | NEW |