| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <userenv.h> // NOLINT | 8 #include <userenv.h> // NOLINT |
| 9 | 9 |
| 10 #include "chrome/app/main_dll_loader_win.h" | 10 #include "chrome/app/main_dll_loader_win.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 base::win::ScopedHandle parent_process; | 236 base::win::ScopedHandle parent_process; |
| 237 base::win::ScopedHandle on_initialized_event; | 237 base::win::ScopedHandle on_initialized_event; |
| 238 DWORD main_thread_id = 0; | 238 DWORD main_thread_id = 0; |
| 239 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, | 239 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, |
| 240 &main_thread_id, | 240 &main_thread_id, |
| 241 &on_initialized_event)) { | 241 &on_initialized_event)) { |
| 242 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; | 242 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; |
| 243 } | 243 } |
| 244 | 244 |
| 245 base::FilePath default_user_data_directory; | |
| 246 if (!PathService::Get(chrome::DIR_USER_DATA, &default_user_data_directory)) | |
| 247 return chrome::RESULT_CODE_MISSING_DATA; | |
| 248 // The actual user data directory may differ from the default according to | |
| 249 // policy and command-line arguments evaluated in the browser process. | |
| 250 // The hang monitor will simply be disabled if a window with this name is | |
| 251 // never instantiated by the browser process. Since this should be | |
| 252 // exceptionally rare it should not impact stability efforts. | |
| 253 base::string16 message_window_name = default_user_data_directory.value(); | |
| 254 | |
| 255 base::FilePath watcher_data_directory; | 245 base::FilePath watcher_data_directory; |
| 256 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) | 246 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) |
| 257 return chrome::RESULT_CODE_MISSING_DATA; | 247 return chrome::RESULT_CODE_MISSING_DATA; |
| 258 | 248 |
| 259 base::string16 channel_name = GoogleUpdateSettings::GetChromeChannel( | 249 base::string16 channel_name = GoogleUpdateSettings::GetChromeChannel( |
| 260 !InstallUtil::IsPerUserInstall(cmd_line.GetProgram())); | 250 !InstallUtil::IsPerUserInstall(cmd_line.GetProgram())); |
| 261 | 251 |
| 262 // Intentionally leaked. | 252 // Intentionally leaked. |
| 263 HMODULE watcher_dll = Load(&version, &file); | 253 HMODULE watcher_dll = Load(&version, &file); |
| 264 if (!watcher_dll) | 254 if (!watcher_dll) |
| 265 return chrome::RESULT_CODE_MISSING_DATA; | 255 return chrome::RESULT_CODE_MISSING_DATA; |
| 266 | 256 |
| 267 ChromeWatcherMainFunction watcher_main = | 257 ChromeWatcherMainFunction watcher_main = |
| 268 reinterpret_cast<ChromeWatcherMainFunction>( | 258 reinterpret_cast<ChromeWatcherMainFunction>( |
| 269 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); | 259 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); |
| 270 return watcher_main(chrome::kBrowserExitCodesRegistryPath, | 260 return watcher_main( |
| 271 parent_process.Take(), main_thread_id, | 261 chrome::kBrowserExitCodesRegistryPath, parent_process.Take(), |
| 272 on_initialized_event.Take(), | 262 main_thread_id, on_initialized_event.Take(), |
| 273 watcher_data_directory.value().c_str(), | 263 watcher_data_directory.value().c_str(), channel_name.c_str()); |
| 274 message_window_name.c_str(), channel_name.c_str()); | |
| 275 } | 264 } |
| 276 | 265 |
| 277 // Initialize the sandbox services. | 266 // Initialize the sandbox services. |
| 278 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 267 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
| 279 content::InitializeSandboxInfo(&sandbox_info); | 268 content::InitializeSandboxInfo(&sandbox_info); |
| 280 | 269 |
| 281 dll_ = Load(&version, &file); | 270 dll_ = Load(&version, &file); |
| 282 if (!dll_) | 271 if (!dll_) |
| 283 return chrome::RESULT_CODE_MISSING_DATA; | 272 return chrome::RESULT_CODE_MISSING_DATA; |
| 284 | 273 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 393 } |
| 405 }; | 394 }; |
| 406 | 395 |
| 407 MainDllLoader* MakeMainDllLoader() { | 396 MainDllLoader* MakeMainDllLoader() { |
| 408 #if defined(GOOGLE_CHROME_BUILD) | 397 #if defined(GOOGLE_CHROME_BUILD) |
| 409 return new ChromeDllLoader(); | 398 return new ChromeDllLoader(); |
| 410 #else | 399 #else |
| 411 return new ChromiumDllLoader(); | 400 return new ChromiumDllLoader(); |
| 412 #endif | 401 #endif |
| 413 } | 402 } |
| OLD | NEW |