| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 base::win::ScopedHandle parent_process; | 218 base::win::ScopedHandle parent_process; |
| 219 base::win::ScopedHandle on_initialized_event; | 219 base::win::ScopedHandle on_initialized_event; |
| 220 DWORD main_thread_id = 0; | 220 DWORD main_thread_id = 0; |
| 221 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, | 221 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, |
| 222 &main_thread_id, | 222 &main_thread_id, |
| 223 &on_initialized_event)) { | 223 &on_initialized_event)) { |
| 224 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; | 224 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; |
| 225 } | 225 } |
| 226 | 226 |
| 227 base::FilePath default_user_data_directory; | |
| 228 if (!PathService::Get(chrome::DIR_USER_DATA, &default_user_data_directory)) | |
| 229 return chrome::RESULT_CODE_MISSING_DATA; | |
| 230 // The actual user data directory may differ from the default according to | |
| 231 // policy and command-line arguments evaluated in the browser process. | |
| 232 // The hang monitor will simply be disabled if a window with this name is | |
| 233 // never instantiated by the browser process. Since this should be | |
| 234 // exceptionally rare it should not impact stability efforts. | |
| 235 base::string16 message_window_name = default_user_data_directory.value(); | |
| 236 | |
| 237 base::FilePath watcher_data_directory; | 227 base::FilePath watcher_data_directory; |
| 238 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) | 228 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) |
| 239 return chrome::RESULT_CODE_MISSING_DATA; | 229 return chrome::RESULT_CODE_MISSING_DATA; |
| 240 | 230 |
| 241 base::string16 channel_name = GoogleUpdateSettings::GetChromeChannel( | 231 base::string16 channel_name = GoogleUpdateSettings::GetChromeChannel( |
| 242 !InstallUtil::IsPerUserInstall(cmd_line.GetProgram())); | 232 !InstallUtil::IsPerUserInstall(cmd_line.GetProgram())); |
| 243 | 233 |
| 244 // Intentionally leaked. | 234 // Intentionally leaked. |
| 245 HMODULE watcher_dll = Load(&version, &file); | 235 HMODULE watcher_dll = Load(&version, &file); |
| 246 if (!watcher_dll) | 236 if (!watcher_dll) |
| 247 return chrome::RESULT_CODE_MISSING_DATA; | 237 return chrome::RESULT_CODE_MISSING_DATA; |
| 248 | 238 |
| 249 ChromeWatcherMainFunction watcher_main = | 239 ChromeWatcherMainFunction watcher_main = |
| 250 reinterpret_cast<ChromeWatcherMainFunction>( | 240 reinterpret_cast<ChromeWatcherMainFunction>( |
| 251 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); | 241 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); |
| 252 return watcher_main(chrome::kBrowserExitCodesRegistryPath, | 242 return watcher_main( |
| 253 parent_process.Take(), main_thread_id, | 243 chrome::kBrowserExitCodesRegistryPath, parent_process.Take(), |
| 254 on_initialized_event.Take(), | 244 main_thread_id, on_initialized_event.Take(), |
| 255 watcher_data_directory.value().c_str(), | 245 watcher_data_directory.value().c_str(), channel_name.c_str()); |
| 256 message_window_name.c_str(), channel_name.c_str()); | |
| 257 } | 246 } |
| 258 | 247 |
| 259 // Initialize the sandbox services. | 248 // Initialize the sandbox services. |
| 260 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 249 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
| 261 content::InitializeSandboxInfo(&sandbox_info); | 250 content::InitializeSandboxInfo(&sandbox_info); |
| 262 | 251 |
| 263 dll_ = Load(&version, &file); | 252 dll_ = Load(&version, &file); |
| 264 if (!dll_) | 253 if (!dll_) |
| 265 return chrome::RESULT_CODE_MISSING_DATA; | 254 return chrome::RESULT_CODE_MISSING_DATA; |
| 266 | 255 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 375 } |
| 387 }; | 376 }; |
| 388 | 377 |
| 389 MainDllLoader* MakeMainDllLoader() { | 378 MainDllLoader* MakeMainDllLoader() { |
| 390 #if defined(GOOGLE_CHROME_BUILD) | 379 #if defined(GOOGLE_CHROME_BUILD) |
| 391 return new ChromeDllLoader(); | 380 return new ChromeDllLoader(); |
| 392 #else | 381 #else |
| 393 return new ChromiumDllLoader(); | 382 return new ChromiumDllLoader(); |
| 394 #endif | 383 #endif |
| 395 } | 384 } |
| OLD | NEW |