OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/nacl/common/nacl_paths.h" | 5 #include "components/nacl/common/nacl_paths.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "components/nacl/common/nacl_switches.h" | 10 #include "components/nacl/common/nacl_switches.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 namespace nacl { | 35 namespace nacl { |
36 | 36 |
37 bool PathProvider(int key, base::FilePath* result) { | 37 bool PathProvider(int key, base::FilePath* result) { |
38 switch (key) { | 38 switch (key) { |
39 #if defined(OS_LINUX) | 39 #if defined(OS_LINUX) |
40 case FILE_NACL_HELPER: | 40 case FILE_NACL_HELPER: |
41 return GetNaClHelperPath(kInternalNaClHelperFileName, result); | 41 return GetNaClHelperPath(kInternalNaClHelperFileName, result); |
42 case FILE_NACL_HELPER_NONSFI: | 42 case FILE_NACL_HELPER_NONSFI: |
43 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
44 switches::kUseNaClHelperNonSfi) == "false") { | |
45 // nacl_helper_nonsfi is disabled by the flag. So, use nacl_helper | |
46 // in Non-SFI mode instead. This is old behavior just in case. | |
47 // TODO(hidehiko): Remove this code path, when the old feature is | |
48 // cleaned after nacl_helper_nonsfi is officially launched and | |
49 // its stability is confirmed. | |
50 return GetNaClHelperPath(kInternalNaClHelperFileName, result); | |
51 } | |
52 return GetNaClHelperPath(kInternalNaClHelperNonSfiFileName, result); | 43 return GetNaClHelperPath(kInternalNaClHelperNonSfiFileName, result); |
53 case FILE_NACL_HELPER_BOOTSTRAP: | 44 case FILE_NACL_HELPER_BOOTSTRAP: |
54 return GetNaClHelperPath(kInternalNaClHelperBootstrapFileName, result); | 45 return GetNaClHelperPath(kInternalNaClHelperBootstrapFileName, result); |
55 #endif | 46 #endif |
56 default: | 47 default: |
57 return false; | 48 return false; |
58 } | 49 } |
59 } | 50 } |
60 | 51 |
61 // This cannot be done as a static initializer sadly since Visual Studio will | 52 // This cannot be done as a static initializer sadly since Visual Studio will |
62 // eliminate this object file if there is no direct entry point into it. | 53 // eliminate this object file if there is no direct entry point into it. |
63 void RegisterPathProvider() { | 54 void RegisterPathProvider() { |
64 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 55 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
65 } | 56 } |
66 | 57 |
67 } // namespace nacl | 58 } // namespace nacl |
OLD | NEW |