| Index: chrome/common/nacl_delegate.cc
|
| diff --git a/chrome/common/nacl_delegate.cc b/chrome/common/nacl_delegate.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e77efe92dafadb64316b8642515880c81be4e2fb
|
| --- /dev/null
|
| +++ b/chrome/common/nacl_delegate.cc
|
| @@ -0,0 +1,73 @@
|
| +// Copyright (c) 2013 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 "components/nacl/common/nacl_delegate.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/path_service.h"
|
| +#include "chrome/common/chrome_paths.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| +
|
| +const char* NaClDelegate::GetSwitch(NaClSwitch switch_name) {
|
| + switch (switch_name) {
|
| + case kDisableBreakpad:
|
| + return switches::kDisableBreakpad;
|
| + case kDisableLogging:
|
| + return switches::kDisableLogging;
|
| + case kEnableDCHECK:
|
| + return switches::kEnableDCHECK;
|
| + case kEnableLogging:
|
| + return switches::kEnableLogging;
|
| + case kFullMemoryCrashReport:
|
| + return switches::kFullMemoryCrashReport;
|
| + case kLoggingLevel:
|
| + return switches::kLoggingLevel;
|
| + case kMemoryProfiling:
|
| + return switches::kMemoryProfiling;
|
| + case kNaClBrokerProcess:
|
| + return switches::kNaClBrokerProcess;
|
| + case kNaClLoaderProcess:
|
| + return switches::kNaClLoaderProcess;
|
| + case kNoErrorDialogs:
|
| + return switches::kNoErrorDialogs;
|
| + case kNoSandbox:
|
| + return switches::kNoSandbox;
|
| + case kProcessType:
|
| + return switches::kProcessType;
|
| + case kSilentDumpOnDCHECK:
|
| + return switches::kSilentDumpOnDCHECK;
|
| + case kTestNaClSandbox:
|
| + return switches::kTestNaClSandbox;
|
| +#if defined(OS_MACOSX)
|
| + case kEnableSandboxLogging:
|
| + return switches::kEnableSandboxLogging;
|
| +#endif
|
| + default:
|
| + NOTREACHED();
|
| + return NULL;
|
| + }
|
| +}
|
| +
|
| +#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
| +bool NaClDelegate::GetFilePath(NaClFilePath path, base::FilePath* file_path) {
|
| + int chrome_path = 0;
|
| + switch (path) {
|
| + case kFileNaClHelper:
|
| + chrome_path = chrome::FILE_NACL_HELPER;
|
| + break;
|
| + case kFileNaClHelperBootstrap:
|
| + chrome_path = chrome::FILE_NACL_HELPER_BOOTSTRAP;
|
| + break;
|
| + default:
|
| + NOTREACHED();
|
| + return false;
|
| + }
|
| + return PathService::Get(chrome_path, file_path);
|
| +}
|
| +#endif
|
| +
|
| +NaClDelegate* GetNaClDelegate() {
|
| + static NaClDelegate* naclDelegate = new NaClDelegate;
|
| + return naclDelegate;
|
| +}
|
|
|