1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/base_switches.h"
6 #include "base/command_line.h"
7 #include "build/build_config.h"
8 #include "components/nacl/common/nacl_switches.h"
9 #include "content/public/common/content_switches.h"
10 #include "sandbox/policy/switches.h"
11
12 namespace nacl {
13
CopyNaClCommandLineArguments(base::CommandLine * cmd_line)14 void CopyNaClCommandLineArguments(base::CommandLine* cmd_line) {
15 const base::CommandLine& browser_command_line =
16 *base::CommandLine::ForCurrentProcess();
17
18 // Propagate the following switches to the NaCl loader command line (along
19 // with any associated values) if present in the browser command line.
20 // TODO(gregoryd): check which flags of those below can be supported.
21 static const char* const kSwitchNames[] = {
22 sandbox::policy::switches::kNoSandbox,
23 switches::kDisableBreakpad,
24 switches::kFullMemoryCrashReport,
25 switches::kEnableLogging,
26 switches::kDisableLogging,
27 switches::kLoggingLevel,
28 switches::kVerboseLoggingInNacl,
29 switches::kNoErrorDialogs,
30 #if BUILDFLAG(IS_APPLE)
31 sandbox::policy::switches::kEnableSandboxLogging,
32 #endif
33 #if BUILDFLAG(IS_WIN)
34 switches::kDisableHighResTimer,
35 switches::kRaiseTimerFrequency,
36 #endif
37 };
38 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
39 std::size(kSwitchNames));
40 }
41
42 } // namespace nacl
43