| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/site_isolation_policy.h" | 5 #include "content/common/site_isolation_policy.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/feature_list.h" | |
| 9 #include "base/lazy_instance.h" | |
| 10 #include "content/public/common/browser_side_navigation_policy.h" | |
| 11 #include "content/public/common/content_client.h" | |
| 12 #include "content/public/common/content_features.h" | |
| 13 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
| 14 | 9 |
| 15 namespace content { | 10 namespace content { |
| 16 | 11 |
| 17 // static | 12 // static |
| 18 bool SiteIsolationPolicy::AreCrossProcessFramesPossible() { | 13 bool SiteIsolationPolicy::AreCrossProcessFramesPossible() { |
| 19 return UseDedicatedProcessesForAllSites() || | 14 return true; |
| 20 IsTopDocumentIsolationEnabled() || | |
| 21 GetContentClient()->IsSupplementarySiteIsolationModeEnabled() || | |
| 22 base::FeatureList::IsEnabled(::features::kGuestViewCrossProcessFrames); | |
| 23 } | 15 } |
| 24 | 16 |
| 25 // static | 17 // static |
| 26 bool SiteIsolationPolicy::UseDedicatedProcessesForAllSites() { | 18 bool SiteIsolationPolicy::UseDedicatedProcessesForAllSites() { |
| 27 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 19 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 28 switches::kSitePerProcess); | 20 switches::kSitePerProcess); |
| 29 } | 21 } |
| 30 | 22 |
| 31 // static | 23 // static |
| 32 bool SiteIsolationPolicy::IsTopDocumentIsolationEnabled() { | 24 bool SiteIsolationPolicy::IsTopDocumentIsolationEnabled() { |
| 33 // --site-per-process trumps --top-document-isolation. | 25 // --site-per-process trumps --top-document-isolation. |
| 34 if (UseDedicatedProcessesForAllSites()) | 26 if (UseDedicatedProcessesForAllSites()) |
| 35 return false; | 27 return false; |
| 36 | 28 |
| 37 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 29 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 38 switches::kTopDocumentIsolation); | 30 switches::kTopDocumentIsolation); |
| 39 } | 31 } |
| 40 | 32 |
| 41 } // namespace content | 33 } // namespace content |
| OLD | NEW |