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 12301013: Ensure extensions and the Chrome Web Store are loaded in new BrowsingInstances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review comments. Created 7 years, 10 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
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index e1908ecd0cfaf524fefaf5a55872100f4c988ffa..db7b4173b68299dbe2c50b75fd5bed3ae9e0e094 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -975,6 +975,7 @@ void ChromeContentBrowserClient::SiteInstanceDeleting(
}
bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation(
+ SiteInstance* site_instance,
const GURL& current_url,
const GURL& new_url) {
if (current_url.is_empty()) {
@@ -995,6 +996,31 @@ bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation(
return true;
}
+ // The checks below only matter if we can retrieve which extensions are
+ // installed.
+ Profile* profile =
+ Profile::FromBrowserContext(site_instance->GetBrowserContext());
+ ExtensionService* service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
+ if (!service)
+ return false;
+
+ // We must swap if the URL is for an extension and we are not using an
+ // extension process.
+ const Extension* new_extension =
+ service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo(new_url));
+ // Ignore all hosted apps except the Chrome Web Store, since they do not
+ // require their own BrowsingInstance (e.g., postMessage is ok).
+ if (new_extension &&
+ new_extension->is_hosted_app() &&
+ new_extension->id() != extension_misc::kWebStoreAppId)
+ new_extension = NULL;
+ if (new_extension &&
+ site_instance->HasProcess() &&
+ !service->process_map()->Contains(new_extension->id(),
+ site_instance->GetProcess()->GetID()))
+ return true;
+
return false;
}
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | content/browser/devtools/devtools_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698