summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host/site_instance.cc
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-22 23:56:30 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-22 23:56:30 +0000
commit3a8eecb2bb859491b344be321abb4ff3d2b7f0f3 (patch)
tree07f90f564c2c5d92d38f1fdae15597a523ca31c1 /chrome/browser/renderer_host/site_instance.cc
parent58bc899f2ffdc14d78b6f209f57415e79837d7a6 (diff)
downloadchromium_src-3a8eecb2bb859491b344be321abb4ff3d2b7f0f3.zip
chromium_src-3a8eecb2bb859491b344be321abb4ff3d2b7f0f3.tar.gz
chromium_src-3a8eecb2bb859491b344be321abb4ff3d2b7f0f3.tar.bz2
Implement app process model isolation.
The process grouping logic is unfortunately duplicated in SiteInstance and RenderView. URLs that are part of extension X's web extent get converted into a pseudo URL of the form chrome-extension://X/path. This groups pages from an extension app and its offline resources into the same process. The rest is mostly plumbing and passing data around. BUG=41273 Review URL: http://codereview.chromium.org/1735004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/site_instance.cc')
-rw-r--r--chrome/browser/renderer_host/site_instance.cc29
1 files changed, 26 insertions, 3 deletions
diff --git a/chrome/browser/renderer_host/site_instance.cc b/chrome/browser/renderer_host/site_instance.cc
index 337ce3d..62c6bd7 100644
--- a/chrome/browser/renderer_host/site_instance.cc
+++ b/chrome/browser/renderer_host/site_instance.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/browsing_instance.h"
#include "chrome/browser/dom_ui/dom_ui_factory.h"
+#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/notification_service.h"
@@ -79,7 +80,7 @@ void SiteInstance::SetSite(const GURL& url) {
// Remember that this SiteInstance has been used to load a URL, even if the
// URL is invalid.
has_site_ = true;
- site_ = GetSiteForURL(url);
+ site_ = GetSiteForURL(browsing_instance_->profile(), url);
// Now that we have a site, register it with the BrowsingInstance. This
// ensures that we won't create another SiteInstance for this site within
@@ -111,7 +112,9 @@ SiteInstance* SiteInstance::CreateSiteInstanceForURL(Profile* profile,
}
/*static*/
-GURL SiteInstance::GetSiteForURL(const GURL& url) {
+GURL SiteInstance::GetSiteForURL(Profile* profile, const GURL& real_url) {
+ GURL url = GetEffectiveURL(profile, real_url);
+
// URLs with no host should have an empty site.
GURL site;
@@ -144,7 +147,11 @@ GURL SiteInstance::GetSiteForURL(const GURL& url) {
}
/*static*/
-bool SiteInstance::IsSameWebSite(const GURL& url1, const GURL& url2) {
+bool SiteInstance::IsSameWebSite(Profile* profile,
+ const GURL& real_url1, const GURL& real_url2) {
+ GURL url1 = GetEffectiveURL(profile, real_url1);
+ GURL url2 = GetEffectiveURL(profile, real_url2);
+
// We infer web site boundaries based on the registered domain name of the
// top-level page and the scheme. We do not pay attention to the port if
// one is present, because pages served from different ports can still
@@ -167,6 +174,22 @@ bool SiteInstance::IsSameWebSite(const GURL& url1, const GURL& url2) {
return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2);
}
+/*static*/
+GURL SiteInstance::GetEffectiveURL(Profile* profile, const GURL& url) {
+ if (!profile || !profile->GetExtensionsService())
+ return url;
+
+ Extension* extension =
+ profile->GetExtensionsService()->GetExtensionByWebExtent(url);
+ if (extension) {
+ // If the URL is part of an extension's web extent, convert it to an
+ // extension URL.
+ return extension->GetResourceURL(url.path());
+ } else {
+ return url;
+ }
+}
+
RenderProcessHost::Type SiteInstance::GetRendererType() {
// We may not have a site at this point, which generally means this is a
// normal navigation.