summaryrefslogtreecommitdiffstats
path: root/content/common/site_isolation_policy.cc
blob: 694c9db3336be49465f81223f9f2f49e70575a07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/common/site_isolation_policy.h"

#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "content/public/common/browser_plugin_guest_mode.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"

namespace content {

// static
bool SiteIsolationPolicy::AreCrossProcessFramesPossible() {
  return base::CommandLine::ForCurrentProcess()->HasSwitch(
             switches::kSitePerProcess) ||
         GetContentClient()->IsSupplementarySiteIsolationModeEnabled() ||
         BrowserPluginGuestMode::UseCrossProcessFramesForGuests();
}

// static
bool SiteIsolationPolicy::UseDedicatedProcessesForAllSites() {
  return base::CommandLine::ForCurrentProcess()->HasSwitch(
      switches::kSitePerProcess);
}

// static
bool SiteIsolationPolicy::UseSubframeNavigationEntries() {
  // Enable the new navigation history behavior if any manner of site isolation
  // is active.
  // PlzNavigate: also enable the new navigation history behavior.
  return AreCrossProcessFramesPossible() || IsBrowserSideNavigationEnabled();
}

}  // namespace content