| 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 "chrome/app/main_dll_loader_win.h" | 5 #include "chrome/app/main_dll_loader_win.h" |
| 6 | 6 |
| 7 #include <windows.h> // NOLINT | 7 #include <windows.h> // NOLINT |
| 8 #include <shlwapi.h> // NOLINT | 8 #include <shlwapi.h> // NOLINT |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/app/chrome_crash_reporter_client_win.h" | 32 #include "chrome/app/chrome_crash_reporter_client_win.h" |
| 33 #include "chrome/app/chrome_watcher_client_win.h" | 33 #include "chrome/app/chrome_watcher_client_win.h" |
| 34 #include "chrome/app/chrome_watcher_command_line_win.h" | 34 #include "chrome/app/chrome_watcher_command_line_win.h" |
| 35 #include "chrome/app/file_pre_reader_win.h" | 35 #include "chrome/app/file_pre_reader_win.h" |
| 36 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" | 36 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" |
| 37 #include "chrome/common/chrome_constants.h" | 37 #include "chrome/common/chrome_constants.h" |
| 38 #include "chrome/common/chrome_paths.h" | 38 #include "chrome/common/chrome_paths.h" |
| 39 #include "chrome/common/chrome_result_codes.h" | 39 #include "chrome/common/chrome_result_codes.h" |
| 40 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/metrics_constants_util_win.h" | 41 #include "chrome/common/metrics_constants_util_win.h" |
| 42 #include "chrome/installer/util/google_update_constants.h" | |
| 43 #include "chrome/installer/util/google_update_settings.h" | 42 #include "chrome/installer/util/google_update_settings.h" |
| 44 #include "chrome/installer/util/install_util.h" | |
| 45 #include "chrome/installer/util/util_constants.h" | 43 #include "chrome/installer/util/util_constants.h" |
| 46 #include "content/public/app/sandbox_helper_win.h" | 44 #include "content/public/app/sandbox_helper_win.h" |
| 47 #include "content/public/common/content_switches.h" | 45 #include "content/public/common/content_switches.h" |
| 48 #include "sandbox/win/src/sandbox.h" | 46 #include "sandbox/win/src/sandbox.h" |
| 49 | 47 |
| 50 namespace { | 48 namespace { |
| 51 // The entry point signature of chrome.dll. | 49 // The entry point signature of chrome.dll. |
| 52 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*, int64_t); | 50 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*, int64_t); |
| 53 | 51 |
| 54 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); | 52 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, | 159 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, |
| 162 &main_thread_id, | 160 &main_thread_id, |
| 163 &on_initialized_event)) { | 161 &on_initialized_event)) { |
| 164 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; | 162 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; |
| 165 } | 163 } |
| 166 | 164 |
| 167 base::FilePath watcher_data_directory; | 165 base::FilePath watcher_data_directory; |
| 168 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) | 166 if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) |
| 169 return chrome::RESULT_CODE_MISSING_DATA; | 167 return chrome::RESULT_CODE_MISSING_DATA; |
| 170 | 168 |
| 171 base::string16 channel_name = GoogleUpdateSettings::GetChromeChannel( | |
| 172 !InstallUtil::IsPerUserInstall(cmd_line.GetProgram())); | |
| 173 | |
| 174 // Intentionally leaked. | 169 // Intentionally leaked. |
| 175 HMODULE watcher_dll = Load(&file); | 170 HMODULE watcher_dll = Load(&file); |
| 176 if (!watcher_dll) | 171 if (!watcher_dll) |
| 177 return chrome::RESULT_CODE_MISSING_DATA; | 172 return chrome::RESULT_CODE_MISSING_DATA; |
| 178 | 173 |
| 179 ChromeWatcherMainFunction watcher_main = | 174 ChromeWatcherMainFunction watcher_main = |
| 180 reinterpret_cast<ChromeWatcherMainFunction>( | 175 reinterpret_cast<ChromeWatcherMainFunction>( |
| 181 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); | 176 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); |
| 182 return watcher_main(chrome::GetBrowserExitCodesRegistryPath().c_str(), | 177 return watcher_main(chrome::GetBrowserExitCodesRegistryPath().c_str(), |
| 183 parent_process.Take(), main_thread_id, | 178 parent_process.Take(), main_thread_id, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 } | 281 } |
| 287 }; | 282 }; |
| 288 | 283 |
| 289 MainDllLoader* MakeMainDllLoader() { | 284 MainDllLoader* MakeMainDllLoader() { |
| 290 #if defined(GOOGLE_CHROME_BUILD) | 285 #if defined(GOOGLE_CHROME_BUILD) |
| 291 return new ChromeDllLoader(); | 286 return new ChromeDllLoader(); |
| 292 #else | 287 #else |
| 293 return new ChromiumDllLoader(); | 288 return new ChromiumDllLoader(); |
| 294 #endif | 289 #endif |
| 295 } | 290 } |
| OLD | NEW |