OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/site_instance_impl.h" | 5 #include "content/browser/site_instance_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/browsing_instance.h" | 8 #include "content/browser/browsing_instance.h" |
9 #include "content/browser/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
10 #include "content/browser/renderer_host/render_process_host_impl.h" | 10 #include "content/browser/renderer_host/render_process_host_impl.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 return true; | 258 return true; |
259 | 259 |
260 // If either URL is invalid, they aren't part of the same site. | 260 // If either URL is invalid, they aren't part of the same site. |
261 if (!url1.is_valid() || !url2.is_valid()) | 261 if (!url1.is_valid() || !url2.is_valid()) |
262 return false; | 262 return false; |
263 | 263 |
264 // If the schemes differ, they aren't part of the same site. | 264 // If the schemes differ, they aren't part of the same site. |
265 if (url1.scheme() != url2.scheme()) | 265 if (url1.scheme() != url2.scheme()) |
266 return false; | 266 return false; |
267 | 267 |
268 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); | 268 return net::registry_controlled_domains::SameDomainOrHost( |
| 269 url1, |
| 270 url2, |
| 271 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
269 } | 272 } |
270 | 273 |
271 /*static*/ | 274 /*static*/ |
272 GURL SiteInstance::GetSiteForURL(BrowserContext* browser_context, | 275 GURL SiteInstance::GetSiteForURL(BrowserContext* browser_context, |
273 const GURL& real_url) { | 276 const GURL& real_url) { |
274 // TODO(fsamuel, creis): For some reason appID is not recognized as a host. | 277 // TODO(fsamuel, creis): For some reason appID is not recognized as a host. |
275 if (real_url.SchemeIs(chrome::kGuestScheme)) | 278 if (real_url.SchemeIs(chrome::kGuestScheme)) |
276 return real_url; | 279 return real_url; |
277 | 280 |
278 GURL url = SiteInstanceImpl::GetEffectiveURL(browser_context, real_url); | 281 GURL url = SiteInstanceImpl::GetEffectiveURL(browser_context, real_url); |
(...skipping 12 matching lines...) Expand all Loading... |
291 | 294 |
292 // Remove port, if any. | 295 // Remove port, if any. |
293 if (site.has_port()) { | 296 if (site.has_port()) { |
294 GURL::Replacements rep; | 297 GURL::Replacements rep; |
295 rep.ClearPort(); | 298 rep.ClearPort(); |
296 site = site.ReplaceComponents(rep); | 299 site = site.ReplaceComponents(rep); |
297 } | 300 } |
298 | 301 |
299 // If this URL has a registered domain, we only want to remember that part. | 302 // If this URL has a registered domain, we only want to remember that part. |
300 std::string domain = | 303 std::string domain = |
301 net::RegistryControlledDomainService::GetDomainAndRegistry(url); | 304 net::registry_controlled_domains::GetDomainAndRegistry( |
| 305 url, |
| 306 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
302 if (!domain.empty()) { | 307 if (!domain.empty()) { |
303 GURL::Replacements rep; | 308 GURL::Replacements rep; |
304 rep.SetHostStr(domain); | 309 rep.SetHostStr(domain); |
305 site = site.ReplaceComponents(rep); | 310 site = site.ReplaceComponents(rep); |
306 } | 311 } |
307 } | 312 } |
308 return site; | 313 return site; |
309 } | 314 } |
310 | 315 |
311 /*static*/ | 316 /*static*/ |
(...skipping 18 matching lines...) Expand all Loading... |
330 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 335 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
331 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || | 336 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || |
332 command_line.HasSwitch(switches::kSitePerProcess)) { | 337 command_line.HasSwitch(switches::kSitePerProcess)) { |
333 ChildProcessSecurityPolicyImpl* policy = | 338 ChildProcessSecurityPolicyImpl* policy = |
334 ChildProcessSecurityPolicyImpl::GetInstance(); | 339 ChildProcessSecurityPolicyImpl::GetInstance(); |
335 policy->LockToOrigin(process_->GetID(), site_); | 340 policy->LockToOrigin(process_->GetID(), site_); |
336 } | 341 } |
337 } | 342 } |
338 | 343 |
339 } // namespace content | 344 } // namespace content |
OLD | NEW |