| 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 "content/public/common/content_client.h" |
| 10 #include "content/public/common/content_features.h" |
| 8 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 9 | 12 |
| 10 namespace content { | 13 namespace content { |
| 11 | 14 |
| 12 // static | 15 // static |
| 13 bool SiteIsolationPolicy::AreCrossProcessFramesPossible() { | 16 bool SiteIsolationPolicy::AreCrossProcessFramesPossible() { |
| 17 // Before turning this on for Android, input event routing needs to be |
| 18 // completed there, and perf regressions in https://crbug.com/690229 need to be |
| 19 // investigated. |
| 20 #if defined(OS_ANDROID) |
| 21 return UseDedicatedProcessesForAllSites() || |
| 22 IsTopDocumentIsolationEnabled() || |
| 23 GetContentClient()->IsSupplementarySiteIsolationModeEnabled() || |
| 24 base::FeatureList::IsEnabled(::features::kGuestViewCrossProcessFrames); |
| 25 #else |
| 14 return true; | 26 return true; |
| 27 #endif |
| 15 } | 28 } |
| 16 | 29 |
| 17 // static | 30 // static |
| 18 bool SiteIsolationPolicy::UseDedicatedProcessesForAllSites() { | 31 bool SiteIsolationPolicy::UseDedicatedProcessesForAllSites() { |
| 19 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 32 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 20 switches::kSitePerProcess); | 33 switches::kSitePerProcess); |
| 21 } | 34 } |
| 22 | 35 |
| 23 // static | 36 // static |
| 24 bool SiteIsolationPolicy::IsTopDocumentIsolationEnabled() { | 37 bool SiteIsolationPolicy::IsTopDocumentIsolationEnabled() { |
| 25 // --site-per-process trumps --top-document-isolation. | 38 // --site-per-process trumps --top-document-isolation. |
| 26 if (UseDedicatedProcessesForAllSites()) | 39 if (UseDedicatedProcessesForAllSites()) |
| 27 return false; | 40 return false; |
| 28 | 41 |
| 29 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 42 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 30 switches::kTopDocumentIsolation); | 43 switches::kTopDocumentIsolation); |
| 31 } | 44 } |
| 32 | 45 |
| 33 } // namespace content | 46 } // namespace content |
| OLD | NEW |