| Index: content/browser/site_instance_impl.cc
|
| diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
|
| index 589979176b2bf96e13f6aa95e85b9530ff5ce27a..14e1651adfdf82c530934da8e60622e6505e107b 100644
|
| --- a/content/browser/site_instance_impl.cc
|
| +++ b/content/browser/site_instance_impl.cc
|
| @@ -237,8 +237,37 @@ SiteInstance* SiteInstance::CreateForURL(BrowserContext* browser_context,
|
| }
|
|
|
| /*static*/
|
| -GURL SiteInstanceImpl::GetSiteForURL(BrowserContext* browser_context,
|
| - const GURL& real_url) {
|
| +bool SiteInstance::IsSameWebSite(BrowserContext* browser_context,
|
| + const GURL& real_url1,
|
| + const GURL& real_url2) {
|
| + GURL url1 = SiteInstanceImpl::GetEffectiveURL(browser_context, real_url1);
|
| + GURL url2 = SiteInstanceImpl::GetEffectiveURL(browser_context, 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
|
| + // access each other if they change their document.domain variable.
|
| +
|
| + // Some special URLs will match the site instance of any other URL. This is
|
| + // done before checking both of them for validity, since we want these URLs
|
| + // to have the same site instance as even an invalid one.
|
| + if (IsURLSameAsAnySiteInstance(url1) || IsURLSameAsAnySiteInstance(url2))
|
| + return true;
|
| +
|
| + // If either URL is invalid, they aren't part of the same site.
|
| + if (!url1.is_valid() || !url2.is_valid())
|
| + return false;
|
| +
|
| + // If the schemes differ, they aren't part of the same site.
|
| + if (url1.scheme() != url2.scheme())
|
| + return false;
|
| +
|
| + return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2);
|
| +}
|
| +
|
| +/*static*/
|
| +GURL SiteInstance::GetSiteForURL(BrowserContext* browser_context,
|
| + const GURL& real_url) {
|
| // TODO(fsamuel, creis): For some reason appID is not recognized as a host.
|
| if (real_url.SchemeIs(chrome::kGuestScheme))
|
| return real_url;
|
| @@ -277,35 +306,6 @@ GURL SiteInstanceImpl::GetSiteForURL(BrowserContext* browser_context,
|
| }
|
|
|
| /*static*/
|
| -bool SiteInstance::IsSameWebSite(BrowserContext* browser_context,
|
| - const GURL& real_url1,
|
| - const GURL& real_url2) {
|
| - GURL url1 = SiteInstanceImpl::GetEffectiveURL(browser_context, real_url1);
|
| - GURL url2 = SiteInstanceImpl::GetEffectiveURL(browser_context, 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
|
| - // access each other if they change their document.domain variable.
|
| -
|
| - // Some special URLs will match the site instance of any other URL. This is
|
| - // done before checking both of them for validity, since we want these URLs
|
| - // to have the same site instance as even an invalid one.
|
| - if (IsURLSameAsAnySiteInstance(url1) || IsURLSameAsAnySiteInstance(url2))
|
| - return true;
|
| -
|
| - // If either URL is invalid, they aren't part of the same site.
|
| - if (!url1.is_valid() || !url2.is_valid())
|
| - return false;
|
| -
|
| - // If the schemes differ, they aren't part of the same site.
|
| - if (url1.scheme() != url2.scheme())
|
| - return false;
|
| -
|
| - return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2);
|
| -}
|
| -
|
| -/*static*/
|
| GURL SiteInstanceImpl::GetEffectiveURL(BrowserContext* browser_context,
|
| const GURL& url) {
|
| return GetContentClient()->browser()->
|
|
|