| Index: chrome/app/client_util.cc
|
| diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc
|
| index d577aab2d62f149ba4c712617096d4d4a54ccef8..34ecfbda3a1a4ad5994a5dfe3e185e9181b20260 100644
|
| --- a/chrome/app/client_util.cc
|
| +++ b/chrome/app/client_util.cc
|
| @@ -5,6 +5,7 @@
|
| #include <windows.h>
|
| #include <shlwapi.h>
|
|
|
| +#include "base/base_paths.h"
|
| #include "base/command_line.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/debug/trace_event.h"
|
| @@ -13,6 +14,7 @@
|
| #include "base/lazy_instance.h"
|
| #include "base/logging.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/path_service.h"
|
| #include "base/strings/string16.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| @@ -27,6 +29,7 @@
|
| #include "chrome/app/image_pre_reader_win.h"
|
| #include "chrome/chrome_watcher/chrome_watcher_main_api.h"
|
| #include "chrome/common/chrome_constants.h"
|
| +#include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/chrome_result_codes.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/env_vars.h"
|
| @@ -186,6 +189,10 @@ int MainDllLoader::Launch(HINSTANCE instance) {
|
| return chrome::RESULT_CODE_UNSUPPORTED_PARAM;
|
| }
|
|
|
| + base::FilePath watcher_data_directory;
|
| + if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory))
|
| + return chrome::RESULT_CODE_MISSING_DATA;
|
| +
|
| // Intentionally leaked.
|
| HMODULE watcher_dll = Load(&version, &file);
|
| if (!watcher_dll)
|
| @@ -195,7 +202,8 @@ int MainDllLoader::Launch(HINSTANCE instance) {
|
| reinterpret_cast<ChromeWatcherMainFunction>(
|
| ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint));
|
| return watcher_main(chrome::kBrowserExitCodesRegistryPath,
|
| - parent_process.Take(), on_initialized_event.Take());
|
| + parent_process.Take(), on_initialized_event.Take(),
|
| + watcher_data_directory.value().c_str());
|
| }
|
|
|
| // Initialize the sandbox services.
|
| @@ -260,11 +268,14 @@ void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type,
|
|
|
| // Launch the watcher process if stats collection consent has been granted.
|
| if (g_chrome_crash_client.Get().GetCollectStatsConsent()) {
|
| - base::char16 exe_path[MAX_PATH];
|
| - ::GetModuleFileNameW(nullptr, exe_path, arraysize(exe_path));
|
| - ChromeWatcherClient watcher_client(base::Bind(
|
| - &GenerateChromeWatcherCommandLine, base::FilePath(exe_path)));
|
| - watcher_client.LaunchWatcher();
|
| + base::FilePath exe_path;
|
| + if (PathService::Get(base::FILE_EXE, &exe_path)) {
|
| + ChromeWatcherClient watcher_client(
|
| + base::Bind(&GenerateChromeWatcherCommandLine, exe_path));
|
| + watcher_client.LaunchWatcher();
|
| + } else {
|
| + NOTREACHED();
|
| + }
|
| }
|
| }
|
| }
|
|
|