| 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/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "content/public/common/browser_plugin_guest_mode.h" | |
| 10 #include "content/public/common/browser_side_navigation_policy.h" | 9 #include "content/public/common/browser_side_navigation_policy.h" |
| 11 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| 12 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 13 | 12 |
| 14 namespace content { | 13 namespace content { |
| 15 | 14 |
| 16 // static | 15 // static |
| 17 bool SiteIsolationPolicy::AreCrossProcessFramesPossible() { | 16 bool SiteIsolationPolicy::AreCrossProcessFramesPossible() { |
| 18 return UseDedicatedProcessesForAllSites() || | 17 return UseDedicatedProcessesForAllSites() || |
| 19 IsTopDocumentIsolationEnabled() || | 18 IsTopDocumentIsolationEnabled() || |
| 20 GetContentClient()->IsSupplementarySiteIsolationModeEnabled() || | 19 GetContentClient()->IsSupplementarySiteIsolationModeEnabled() || |
| 21 BrowserPluginGuestMode::UseCrossProcessFramesForGuests(); | 20 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 21 switches::kUseCrossProcessFramesForGuests); |
| 22 } | 22 } |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 bool SiteIsolationPolicy::UseDedicatedProcessesForAllSites() { | 25 bool SiteIsolationPolicy::UseDedicatedProcessesForAllSites() { |
| 26 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 26 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 27 switches::kSitePerProcess); | 27 switches::kSitePerProcess); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 bool SiteIsolationPolicy::IsTopDocumentIsolationEnabled() { | 31 bool SiteIsolationPolicy::IsTopDocumentIsolationEnabled() { |
| 32 // --site-per-process trumps --top-document-isolation. | 32 // --site-per-process trumps --top-document-isolation. |
| 33 if (UseDedicatedProcessesForAllSites()) | 33 if (UseDedicatedProcessesForAllSites()) |
| 34 return false; | 34 return false; |
| 35 | 35 |
| 36 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 36 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 37 switches::kTopDocumentIsolation); | 37 switches::kTopDocumentIsolation); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 bool SiteIsolationPolicy::UseSubframeNavigationEntries() { | 41 bool SiteIsolationPolicy::UseSubframeNavigationEntries() { |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace content | 45 } // namespace content |
| OLD | NEW |