OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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. |
| 4 |
| 5 #include "components/nacl/common/nacl_delegate.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/path_service.h" |
| 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "chrome/common/chrome_switches.h" |
| 11 |
| 12 const char* NaClDelegate::GetSwitch(NaClSwitch switch_name) { |
| 13 switch (switch_name) { |
| 14 case kDisableBreakpad: |
| 15 return switches::kDisableBreakpad; |
| 16 case kDisableLogging: |
| 17 return switches::kDisableLogging; |
| 18 case kEnableDCHECK: |
| 19 return switches::kEnableDCHECK; |
| 20 case kEnableLogging: |
| 21 return switches::kEnableLogging; |
| 22 case kFullMemoryCrashReport: |
| 23 return switches::kFullMemoryCrashReport; |
| 24 case kLoggingLevel: |
| 25 return switches::kLoggingLevel; |
| 26 case kMemoryProfiling: |
| 27 return switches::kMemoryProfiling; |
| 28 case kNaClBrokerProcess: |
| 29 return switches::kNaClBrokerProcess; |
| 30 case kNaClLoaderProcess: |
| 31 return switches::kNaClLoaderProcess; |
| 32 case kNoErrorDialogs: |
| 33 return switches::kNoErrorDialogs; |
| 34 case kNoSandbox: |
| 35 return switches::kNoSandbox; |
| 36 case kProcessType: |
| 37 return switches::kProcessType; |
| 38 case kSilentDumpOnDCHECK: |
| 39 return switches::kSilentDumpOnDCHECK; |
| 40 case kTestNaClSandbox: |
| 41 return switches::kTestNaClSandbox; |
| 42 #if defined(OS_MACOSX) |
| 43 case kEnableSandboxLogging: |
| 44 return switches::kEnableSandboxLogging; |
| 45 #endif |
| 46 default: |
| 47 NOTREACHED(); |
| 48 return NULL; |
| 49 } |
| 50 } |
| 51 |
| 52 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 53 bool NaClDelegate::GetFilePath(NaClFilePath path, base::FilePath* file_path) { |
| 54 int chrome_path = 0; |
| 55 switch (path) { |
| 56 case kFileNaClHelper: |
| 57 chrome_path = chrome::FILE_NACL_HELPER; |
| 58 break; |
| 59 case kFileNaClHelperBootstrap: |
| 60 chrome_path = chrome::FILE_NACL_HELPER_BOOTSTRAP; |
| 61 break; |
| 62 default: |
| 63 NOTREACHED(); |
| 64 return false; |
| 65 } |
| 66 return PathService::Get(chrome_path, file_path); |
| 67 } |
| 68 #endif |
| 69 |
| 70 NaClDelegate* GetNaClDelegate() { |
| 71 static NaClDelegate* naclDelegate = new NaClDelegate; |
| 72 return naclDelegate; |
| 73 } |
OLD | NEW |