Support for unpacked ARM packed relocations.
[chromium-blink-merge.git] / components / nacl / common / nacl_paths.cc
blobcb046c23eacbd1157101bdb7e51dfa175e71f4a6
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
3 // found in the LICENSE file.
5 #include "components/nacl/common/nacl_paths.h"
7 #include "base/file_util.h"
8 #include "base/path_service.h"
10 namespace {
12 #if defined(OS_POSIX) && !defined(OS_MACOSX)
13 // File name of the nacl_helper and nacl_helper_bootstrap, Linux only.
14 const base::FilePath::CharType kInternalNaClHelperFileName[] =
15 FILE_PATH_LITERAL("nacl_helper");
16 const base::FilePath::CharType kInternalNaClHelperBootstrapFileName[] =
17 FILE_PATH_LITERAL("nacl_helper_bootstrap");
18 #endif
20 } // namespace
22 namespace nacl {
24 bool PathProvider(int key, base::FilePath* result) {
25 base::FilePath cur;
26 switch (key) {
27 #if defined(OS_LINUX)
28 case FILE_NACL_HELPER:
29 if (!PathService::Get(base::DIR_MODULE, &cur))
30 return false;
31 cur = cur.Append(kInternalNaClHelperFileName);
32 break;
33 case FILE_NACL_HELPER_BOOTSTRAP:
34 if (!PathService::Get(base::DIR_MODULE, &cur))
35 return false;
36 cur = cur.Append(kInternalNaClHelperBootstrapFileName);
37 break;
38 #endif
39 default:
40 return false;
43 *result = cur;
44 return true;
47 // This cannot be done as a static initializer sadly since Visual Studio will
48 // eliminate this object file if there is no direct entry point into it.
49 void RegisterPathProvider() {
50 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
53 } // namespace nacl