Commit e804b53b authored by yael.aharon@intel.com's avatar yael.aharon@intel.com

Remove dependency from NaCl code on chrome_constants.

This is part of an effort to componentize NaCl code.
BUG=244791

Review URL: https://chromiumcodereview.appspot.com/16154005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207806 0039d316-1c4b-4281-b951-d872f2087c98
parent 3707eb2b
......@@ -8,8 +8,7 @@
#include "base/path_service.h"
#include "ipc/ipc_switches.h"
#include "chrome/browser/nacl_host/nacl_broker_service_win.h"
#include "chrome/browser/nacl_host/nacl_process_host.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/browser/nacl_host/nacl_browser.h"
#include "chrome/common/chrome_process_type.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/logging_chrome.h"
......@@ -52,11 +51,10 @@ bool NaClBrokerHost::Init() {
return false;
// Create the path to the nacl broker/loader executable.
base::FilePath module_path;
if (!PathService::Get(base::FILE_MODULE, &module_path))
base::FilePath nacl_path;
if (!NaClBrowser::GetInstance()->GetNaCl64ExePath(&nacl_path))
return false;
base::FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName);
CommandLine* cmd_line = new CommandLine(nacl_path);
nacl::CopyNaClCommandLineArguments(cmd_line);
......
......@@ -197,6 +197,18 @@ void NaClBrowser::InitIrtFilePath() {
}
}
#if defined(OS_WIN)
bool NaClBrowser::GetNaCl64ExePath(base::FilePath* exe_path) {
base::FilePath module_path;
if (!PathService::Get(base::FILE_MODULE, &module_path)) {
LOG(ERROR) << "NaCl process launch failed: could not resolve module";
return false;
}
*exe_path = module_path.DirName().Append(L"nacl64");
return true;
}
#endif
NaClBrowser* NaClBrowser::GetInstance() {
return Singleton<NaClBrowser>::get();
}
......
......@@ -109,6 +109,11 @@ class NaClBrowser {
bool QueryKnownToValidate(const std::string& signature, bool off_the_record);
void SetKnownToValidate(const std::string& signature, bool off_the_record);
void ClearValidationCache(const base::Closure& callback);
#if defined(OS_WIN)
// Get path to NaCl loader on the filesystem if possible.
// |exe_path| does not change if the method fails.
bool GetNaCl64ExePath(base::FilePath* exe_path);
#endif
private:
friend struct DefaultSingletonTraits<NaClBrowser>;
......
......@@ -27,7 +27,6 @@
#include "chrome/browser/nacl_host/nacl_browser.h"
#include "chrome/browser/nacl_host/nacl_host_message_filter.h"
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_process_type.h"
#include "chrome/common/chrome_switches.h"
......@@ -443,12 +442,9 @@ bool NaClProcessHost::LaunchSelLdr() {
#if defined(OS_WIN)
// On Windows 64-bit NaCl loader is called nacl64.exe instead of chrome.exe
if (RunningOnWOW64()) {
base::FilePath module_path;
if (!PathService::Get(base::FILE_MODULE, &module_path)) {
LOG(ERROR) << "NaCl process launch failed: could not resolve module";
if (!NaClBrowser::GetInstance()->GetNaCl64ExePath(&exe_path)) {
return false;
}
exe_path = module_path.DirName().Append(chrome::kNaClAppName);
}
#endif
......
......@@ -133,8 +133,6 @@ const char* const kHelperFlavorSuffixes[] = {
};
#endif // OS_MACOSX
const wchar_t kNaClAppName[] = L"nacl64";
#if defined(OS_WIN)
const base::FilePath::CharType kMetroDriverDll[] = FPL("metro_driver.dll");
const wchar_t kStatusTrayWindowClass[] = L"Chrome_StatusTrayWindow";
......
......@@ -46,7 +46,6 @@ extern const wchar_t kTestingInterfaceDLL[];
extern const char kInitialProfile[];
extern const char kMultiProfileDirPrefix[];
extern const wchar_t kBrowserResourcesDll[];
extern const wchar_t kNaClAppName[];
extern const base::FilePath::CharType kExtensionFileExtension[];
extern const base::FilePath::CharType kExtensionKeyFileExtension[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment