Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 10546029: Revert 139933 - Clean up RenderViewHostManager swapping logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_content_browser_client.cc
===================================================================
--- chrome/browser/chrome_content_browser_client.cc (revision 140789)
+++ chrome/browser/chrome_content_browser_client.cc (working copy)
@@ -261,21 +261,6 @@
return false;
}
-// If |url| has an extension or isolated app (not a hosted app) associated with
-// it, return it. Otherwise return null.
-const Extension* GetExtensionOrIsolatedApp(const GURL& url,
- ExtensionService* service) {
- const Extension* extension =
- service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo(url));
- // Ignore hosted apps that aren't isolated apps.
- if (extension &&
- extension->is_hosted_app() &&
- !extension->is_storage_isolated())
- extension = NULL;
- return extension;
-}
-
-
bool CertMatchesFilter(const net::X509Certificate& cert,
const base::DictionaryValue& filter) {
// TODO(markusheintz): This is the minimal required filter implementation.
@@ -646,29 +631,28 @@
site_instance->GetId()));
}
-bool ChromeContentBrowserClient::ShouldSwapBrowsingInstanceForNavigation(
- content::BrowserContext* browser_context,
+bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation(
const GURL& current_url,
const GURL& new_url) {
- Profile* profile = Profile::FromBrowserContext(browser_context);
- ExtensionService* service = profile->GetExtensionService();
- if (!service)
+ if (current_url.is_empty()) {
+ // Always choose a new process when navigating to extension URLs. The
+ // process grouping logic will combine all of a given extension's pages
+ // into the same process.
+ if (new_url.SchemeIs(chrome::kExtensionScheme))
+ return true;
+
return false;
+ }
- // We must use a new BrowsingInstance (forcing a process swap and disabling
- // scripting by existing tabs) if one of the URLs is an extension and the
- // other is not the exact same extension.
- //
- // We ignore hosted apps here so that other tabs in their BrowsingInstance can
- // script them. Navigations to/from a hosted app will still trigger a
- // SiteInstance swap in RenderViewHostManager.
- //
- // However, we do use a new BrowsingInstance for isolated apps, which should
- // not be scriptable by other tabs.
- const Extension* current_extension =
- GetExtensionOrIsolatedApp(current_url, service);
- const Extension* new_extension = GetExtensionOrIsolatedApp(new_url, service);
- return current_extension != new_extension;
+ // Also, we must switch if one is an extension and the other is not the exact
+ // same extension.
+ if (current_url.SchemeIs(chrome::kExtensionScheme) ||
+ new_url.SchemeIs(chrome::kExtensionScheme)) {
+ if (current_url.GetOrigin() != new_url.GetOrigin())
+ return true;
+ }
+
+ return false;
}
bool ChromeContentBrowserClient::ShouldSwapProcessesForRedirect(
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | content/browser/debugger/devtools_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698