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 "content/browser/browsing_instance.h" | 7 #include "content/browser/browsing_instance.h" |
8 #include "content/browser/child_process_security_policy_impl.h" | 8 #include "content/browser/child_process_security_policy_impl.h" |
9 #include "content/browser/frame_host/debug_urls.h" | 9 #include "content/browser/frame_host/debug_urls.h" |
10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // static | 361 // static |
362 GURL SiteInstanceImpl::GetEffectiveURL(BrowserContext* browser_context, | 362 GURL SiteInstanceImpl::GetEffectiveURL(BrowserContext* browser_context, |
363 const GURL& url) { | 363 const GURL& url) { |
364 return GetContentClient()->browser()-> | 364 return GetContentClient()->browser()-> |
365 GetEffectiveURL(browser_context, url); | 365 GetEffectiveURL(browser_context, url); |
366 } | 366 } |
367 | 367 |
368 // static | 368 // static |
369 bool SiteInstanceImpl::DoesSiteRequireDedicatedProcess( | 369 bool SiteInstanceImpl::DoesSiteRequireDedicatedProcess( |
370 BrowserContext* browser_context, | 370 BrowserContext* browser_context, |
371 const GURL& effective_url) { | 371 const GURL& url) { |
372 // If --site-per-process is enabled, site isolation is enabled everywhere. | 372 // If --site-per-process is enabled, site isolation is enabled everywhere. |
373 if (SiteIsolationPolicy::UseDedicatedProcessesForAllSites()) | 373 if (SiteIsolationPolicy::UseDedicatedProcessesForAllSites()) |
374 return true; | 374 return true; |
375 | 375 |
376 // Let the content embedder enable site isolation for specific URLs. | 376 // Let the content embedder enable site isolation for specific URLs. Use the |
| 377 // canonical site url for this check, so that schemes with nested origins |
| 378 // (blob and filesystem) work properly. |
| 379 GURL site_url = GetSiteForURL(browser_context, url); |
377 if (GetContentClient()->IsSupplementarySiteIsolationModeEnabled() && | 380 if (GetContentClient()->IsSupplementarySiteIsolationModeEnabled() && |
378 GetContentClient()->browser()->DoesSiteRequireDedicatedProcess( | 381 GetContentClient()->browser()->DoesSiteRequireDedicatedProcess( |
379 browser_context, effective_url)) { | 382 browser_context, site_url)) { |
380 return true; | 383 return true; |
381 } | 384 } |
382 | 385 |
383 return false; | 386 return false; |
384 } | 387 } |
385 | 388 |
386 void SiteInstanceImpl::RenderProcessHostDestroyed(RenderProcessHost* host) { | 389 void SiteInstanceImpl::RenderProcessHostDestroyed(RenderProcessHost* host) { |
387 DCHECK_EQ(process_, host); | 390 DCHECK_EQ(process_, host); |
388 process_->RemoveObserver(this); | 391 process_->RemoveObserver(this); |
389 process_ = nullptr; | 392 process_ = nullptr; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 browsing_instance_->browser_context(), site_)) | 432 browsing_instance_->browser_context(), site_)) |
430 return; | 433 return; |
431 | 434 |
432 ChildProcessSecurityPolicyImpl* policy = | 435 ChildProcessSecurityPolicyImpl* policy = |
433 ChildProcessSecurityPolicyImpl::GetInstance(); | 436 ChildProcessSecurityPolicyImpl::GetInstance(); |
434 policy->LockToOrigin(process_->GetID(), site_); | 437 policy->LockToOrigin(process_->GetID(), site_); |
435 } | 438 } |
436 } | 439 } |
437 | 440 |
438 } // namespace content | 441 } // namespace content |
OLD | NEW |