cros: Don't check consume kiosk flag for enterprise managed device.
[chromium-blink-merge.git] / content / common / sandbox_seccomp_bpf_linux.h
blob16a120e85bc12afb83257b1149495bcc8ce07d73
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_SANDBOX_SECCOMP_BPF_LINUX_H_
6 #define CONTENT_COMMON_SANDBOX_SECCOMP_BPF_LINUX_H_
8 #include "base/basictypes.h"
9 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy_forward.h"
11 namespace content {
13 // This class has two main sets of APIs. One can be used to start the sandbox
14 // for internal content process types, the other is indirectly exposed as
15 // a public content/ API and uses a supplied policy.
16 class SandboxSeccompBpf {
17 public:
18 // This is the API to enable a seccomp-bpf sandbox for content/
19 // process-types:
20 // Is the sandbox globally enabled, can anything use it at all ?
21 // This looks at global command line flags to see if the sandbox
22 // should be enabled at all.
23 static bool IsSeccompBpfDesired();
24 // Should the sandbox be enabled for process_type ?
25 static bool ShouldEnableSeccompBpf(const std::string& process_type);
26 // Check if the kernel supports this sandbox. It's useful to "prewarm"
27 // this, part of the result will be cached.
28 static bool SupportsSandbox();
29 // Start the sandbox and apply the policy for process_type, depending on
30 // command line switches.
31 static bool StartSandbox(const std::string& process_type);
33 // This is the API to enable a seccomp-bpf sandbox by using an
34 // external policy.
35 static bool StartSandboxWithExternalPolicy(
36 playground2::BpfSandboxPolicy policy);
37 // The "baseline" policy can be a useful base to build a sandbox policy.
38 static playground2::BpfSandboxPolicyCallback GetBaselinePolicy();
40 private:
41 DISALLOW_IMPLICIT_CONSTRUCTORS(SandboxSeccompBpf);
44 } // namespace content
46 #endif // CONTENT_COMMON_SANDBOX_SECCOMP_BPF_LINUX_H_