This source file includes following definitions.
- PathProvider
- RegisterPathProvider
#include "components/nacl/common/nacl_paths.h"
#include "base/file_util.h"
#include "base/path_service.h"
namespace {
#if defined(OS_POSIX) && !defined(OS_MACOSX)
const base::FilePath::CharType kInternalNaClHelperFileName[] =
FILE_PATH_LITERAL("nacl_helper");
const base::FilePath::CharType kInternalNaClHelperBootstrapFileName[] =
FILE_PATH_LITERAL("nacl_helper_bootstrap");
#endif
}
namespace nacl {
bool PathProvider(int key, base::FilePath* result) {
base::FilePath cur;
switch (key) {
#if defined(OS_LINUX)
case FILE_NACL_HELPER:
if (!PathService::Get(base::DIR_MODULE, &cur))
return false;
cur = cur.Append(kInternalNaClHelperFileName);
break;
case FILE_NACL_HELPER_BOOTSTRAP:
if (!PathService::Get(base::DIR_MODULE, &cur))
return false;
cur = cur.Append(kInternalNaClHelperBootstrapFileName);
break;
#endif
default:
return false;
}
*result = cur;
return true;
}
void RegisterPathProvider() {
PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
}
}