| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <windows.h> // NOLINT | 5 #include <windows.h> // NOLINT |
| 6 #include <shlwapi.h> // NOLINT | 6 #include <shlwapi.h> // NOLINT |
| 7 #include <userenv.h> // NOLINT | 7 #include <userenv.h> // NOLINT |
| 8 | 8 |
| 9 #include "chrome/app/main_dll_loader_win.h" | 9 #include "chrome/app/main_dll_loader_win.h" |
| 10 | 10 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 base::win::ScopedHandle parent_process; | 228 base::win::ScopedHandle parent_process; |
| 229 base::win::ScopedHandle on_initialized_event; | 229 base::win::ScopedHandle on_initialized_event; |
| 230 DWORD main_thread_id = 0; | 230 DWORD main_thread_id = 0; |
| 231 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, | 231 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, |
| 232 &main_thread_id, | 232 &main_thread_id, |
| 233 &on_initialized_event)) { | 233 &on_initialized_event)) { |
| 234 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; | 234 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; |
| 235 } | 235 } |
| 236 | 236 |
| 237 base::FilePath default_user_data_directory; | |
| 238 if (!PathService::Get(chrome::DIR_USER_DATA, &default_user_data_directory)) | |
| 239 return chrome::RESULT_CODE_MISSING_DATA; | |
| 240 // The actual user data directory may differ from the default according to | |
| 241 // policy and command-line arguments evaluated in the browser process. | |
| 242 // The hang monitor will simply be disabled if a window with this name is | |
| 243 // never instantiated by the browser process. Since this should be | |
| 244 // exceptionally rare it should not impact stability efforts. | |
| 245 base::string16 message_window_name = default_user_data_directory.value(); | |
| 246 | |
| 247 base::FilePath watcher_data_directory; | 237 base::FilePath watcher_data_directory; |
| 248 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) | 238 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) |
| 249 return chrome::RESULT_CODE_MISSING_DATA; | 239 return chrome::RESULT_CODE_MISSING_DATA; |
| 250 | 240 |
| 251 base::string16 channel_name = GoogleUpdateSettings::GetChromeChannel( | 241 base::string16 channel_name = GoogleUpdateSettings::GetChromeChannel( |
| 252 !InstallUtil::IsPerUserInstall(cmd_line.GetProgram())); | 242 !InstallUtil::IsPerUserInstall(cmd_line.GetProgram())); |
| 253 | 243 |
| 254 // Intentionally leaked. | 244 // Intentionally leaked. |
| 255 HMODULE watcher_dll = Load(&version, &file); | 245 HMODULE watcher_dll = Load(&version, &file); |
| 256 if (!watcher_dll) | 246 if (!watcher_dll) |
| 257 return chrome::RESULT_CODE_MISSING_DATA; | 247 return chrome::RESULT_CODE_MISSING_DATA; |
| 258 | 248 |
| 259 ChromeWatcherMainFunction watcher_main = | 249 ChromeWatcherMainFunction watcher_main = |
| 260 reinterpret_cast<ChromeWatcherMainFunction>( | 250 reinterpret_cast<ChromeWatcherMainFunction>( |
| 261 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); | 251 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); |
| 262 return watcher_main(chrome::kBrowserExitCodesRegistryPath, | 252 return watcher_main( |
| 263 parent_process.Take(), main_thread_id, | 253 chrome::kBrowserExitCodesRegistryPath, parent_process.Take(), |
| 264 on_initialized_event.Take(), | 254 main_thread_id, on_initialized_event.Take(), |
| 265 watcher_data_directory.value().c_str(), | 255 watcher_data_directory.value().c_str(), channel_name.c_str()); |
| 266 message_window_name.c_str(), channel_name.c_str()); | |
| 267 } | 256 } |
| 268 | 257 |
| 269 // Initialize the sandbox services. | 258 // Initialize the sandbox services. |
| 270 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 259 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
| 271 content::InitializeSandboxInfo(&sandbox_info); | 260 content::InitializeSandboxInfo(&sandbox_info); |
| 272 | 261 |
| 273 dll_ = Load(&version, &file); | 262 dll_ = Load(&version, &file); |
| 274 if (!dll_) | 263 if (!dll_) |
| 275 return chrome::RESULT_CODE_MISSING_DATA; | 264 return chrome::RESULT_CODE_MISSING_DATA; |
| 276 | 265 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 } | 385 } |
| 397 }; | 386 }; |
| 398 | 387 |
| 399 MainDllLoader* MakeMainDllLoader() { | 388 MainDllLoader* MakeMainDllLoader() { |
| 400 #if defined(GOOGLE_CHROME_BUILD) | 389 #if defined(GOOGLE_CHROME_BUILD) |
| 401 return new ChromeDllLoader(); | 390 return new ChromeDllLoader(); |
| 402 #else | 391 #else |
| 403 return new ChromiumDllLoader(); | 392 return new ChromiumDllLoader(); |
| 404 #endif | 393 #endif |
| 405 } | 394 } |
| OLD | NEW |