xref: /aosp_15_r20/external/cronet/components/nacl/common/nacl_cmd_line.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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   };
31   cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames);
32 }
33 
34 }  // namespace nacl
35