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

Unified Diff: chrome/browser/site_details.cc

Issue 1377933004: Modify --isolate-extensions to not isolate hosted apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_isolate_apps3
Patch Set: Fixes from charlie Created 5 years, 2 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/site_details.cc
diff --git a/chrome/browser/site_details.cc b/chrome/browser/site_details.cc
index 54970b6b6acc152fecba150ade24c4d3fbcb58ca..bf9d9478200dd518a863c3300248ff3232bb2eee 100644
--- a/chrome/browser/site_details.cc
+++ b/chrome/browser/site_details.cc
@@ -7,7 +7,12 @@
#include "base/metrics/histogram.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
+
+#if defined(ENABLE_EXTENSIONS)
+#include "extensions/browser/extension_registry.h"
#include "extensions/common/constants.h"
+#include "extensions/common/extension.h"
+#endif
using content::BrowserThread;
using content::RenderProcessHost;
@@ -16,7 +21,9 @@ using content::WebContents;
namespace {
-bool ShouldIsolate(IsolationScenarioType policy, const GURL& site) {
+bool ShouldIsolate(content::BrowserContext* browser_context,
+ IsolationScenarioType policy,
+ const GURL& site) {
switch (policy) {
case ISOLATE_ALL_SITES:
return true;
@@ -26,8 +33,19 @@ bool ShouldIsolate(IsolationScenarioType policy, const GURL& site) {
// the New Tab Page gets counted as two processes under this policy, and
// extensions are isolated as well.
return !site.SchemeIs(url::kHttpScheme);
- case ISOLATE_EXTENSIONS:
- return site.SchemeIs(extensions::kExtensionScheme);
+ case ISOLATE_EXTENSIONS: {
+#if !defined(ENABLE_EXTENSIONS)
+ return false;
+#else
+ if (!site.SchemeIs(extensions::kExtensionScheme))
+ return false;
+ extensions::ExtensionRegistry* registry =
+ extensions::ExtensionRegistry::Get(browser_context);
+ const extensions::Extension* extension =
+ registry->enabled_extensions().GetExtensionOrAppByURL(site);
+ return extension && !extension->is_hosted_app();
+#endif
+ }
}
NOTREACHED();
return true;
@@ -41,7 +59,10 @@ IsolationScenario::~IsolationScenario() {}
void IsolationScenario::CollectSiteInfoForScenario(SiteInstance* primary,
const GURL& site) {
- const GURL& isolated = ShouldIsolate(policy, site) ? site : GURL("http://");
+ const GURL& isolated =
+ ShouldIsolate(primary->GetBrowserContext(), policy, site)
+ ? site
+ : GURL("http://");
sites.insert(isolated);
browsing_instance_site_map[primary->GetId()].insert(isolated);
}
« no previous file with comments | « chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc ('k') | chrome/browser/site_details_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698