BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / components / nacl / common / nacl_paths.cc
blobf7093800bc1f032cc81bd0937a4ca6ab53d471cf
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/command_line.h"
8 #include "base/files/file_util.h"
9 #include "base/path_service.h"
10 #include "components/nacl/common/nacl_switches.h"
12 namespace {
14 #if defined(OS_LINUX)
15 // File name of the nacl_helper and nacl_helper_bootstrap, Linux only.
16 const base::FilePath::CharType kInternalNaClHelperFileName[] =
17 FILE_PATH_LITERAL("nacl_helper");
18 const base::FilePath::CharType kInternalNaClHelperNonSfiFileName[] =
19 FILE_PATH_LITERAL("nacl_helper_nonsfi");
20 const base::FilePath::CharType kInternalNaClHelperBootstrapFileName[] =
21 FILE_PATH_LITERAL("nacl_helper_bootstrap");
23 bool GetNaClHelperPath(const base::FilePath::CharType* filename,
24 base::FilePath* output) {
25 if (!PathService::Get(base::DIR_MODULE, output))
26 return false;
27 *output = output->Append(filename);
28 return true;
31 #endif
33 } // namespace
35 namespace nacl {
37 bool PathProvider(int key, base::FilePath* result) {
38 switch (key) {
39 #if defined(OS_LINUX)
40 case FILE_NACL_HELPER:
41 return GetNaClHelperPath(kInternalNaClHelperFileName, result);
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);
52 return GetNaClHelperPath(kInternalNaClHelperNonSfiFileName, result);
53 case FILE_NACL_HELPER_BOOTSTRAP:
54 return GetNaClHelperPath(kInternalNaClHelperBootstrapFileName, result);
55 #endif
56 default:
57 return false;
61 // 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.
63 void RegisterPathProvider() {
64 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
67 } // namespace nacl