| Index: components/nacl/common/nacl_cmd_line.cc
|
| diff --git a/components/nacl/common/nacl_cmd_line.cc b/components/nacl/common/nacl_cmd_line.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..85f91e65512792279db351e5782d75597438d11a
|
| --- /dev/null
|
| +++ b/components/nacl/common/nacl_cmd_line.cc
|
| @@ -0,0 +1,47 @@
|
| +// Copyright (c) 2012 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 "base/basictypes.h"
|
| +#include "base/command_line.h"
|
| +#include "components/nacl/common/nacl_delegate.h"
|
| +
|
| +namespace nacl {
|
| +
|
| +void CopyNaClCommandLineArguments(CommandLine* cmd_line) {
|
| + const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
|
| +
|
| + // Propagate the following switches to the NaCl loader command line (along
|
| + // with any associated values) if present in the browser command line.
|
| + // TODO(gregoryd): check which flags of those below can be supported.
|
| +
|
| + static const NaClDelegate::NaClSwitch kSwitchIds[] = {
|
| + NaClDelegate::kNoSandbox,
|
| + NaClDelegate::kTestNaClSandbox,
|
| + NaClDelegate::kDisableBreakpad,
|
| + NaClDelegate::kFullMemoryCrashReport,
|
| + NaClDelegate::kEnableLogging,
|
| + NaClDelegate::kDisableLogging,
|
| + NaClDelegate::kLoggingLevel,
|
| + NaClDelegate::kEnableDCHECK,
|
| + NaClDelegate::kSilentDumpOnDCHECK,
|
| + NaClDelegate::kMemoryProfiling,
|
| + NaClDelegate::kNoErrorDialogs,
|
| +#if defined(OS_MACOSX)
|
| + NaClDelegate::kEnableSandboxLogging,
|
| +#endif
|
| + };
|
| +
|
| + static const char** kSwitchNames = NULL;
|
| + int listLength = sizeof(kSwitchIds) / sizeof(int);
|
| + if (kSwitchNames == NULL) {
|
| + kSwitchNames = new const char* [listLength];
|
| + for (int i = 0; i < listLength; i++) {
|
| + kSwitchNames[i] = GetNaClDelegate()->GetSwitch(kSwitchIds[i]);
|
| + }
|
| + }
|
| +
|
| + cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, listLength);
|
| +}
|
| +
|
| +} // namespace nacl
|
|
|