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 #include "content/renderer/renderer_main_platform_delegate.h"
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "content/public/common/content_switches.h"
11 #ifdef USE_SECCOMP_BPF
12 #include "content/common/sandbox_linux/android/sandbox_bpf_base_policy_android.h"
13 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
18 RendererMainPlatformDelegate::RendererMainPlatformDelegate(
19 const MainFunctionParams
& parameters
)
20 : parameters_(parameters
) {
23 RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
26 void RendererMainPlatformDelegate::PlatformInitialize() {
29 void RendererMainPlatformDelegate::PlatformUninitialize() {
32 bool RendererMainPlatformDelegate::EnableSandbox() {
33 #ifdef USE_SECCOMP_BPF
34 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
35 switches::kEnableSeccompFilterSandbox
)) {
38 if (!sandbox::SandboxBPF::SupportsSeccompSandbox(
39 sandbox::SandboxBPF::SeccompLevel::MULTI_THREADED
)) {
40 LOG(WARNING
) << "Seccomp-BPF sandbox enabled without kernel support. "
41 << "Ignoring flag and proceeding without seccomp sandbox.";
45 sandbox::SandboxBPF
sandbox(new SandboxBPFBasePolicyAndroid());
47 sandbox
.StartSandbox(sandbox::SandboxBPF::SeccompLevel::MULTI_THREADED
));
52 } // namespace content