OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> | 5 #include <windows.h> |
6 #include <malloc.h> | 6 #include <malloc.h> |
7 #include <shellscalingapi.h> | 7 #include <shellscalingapi.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <tchar.h> | 9 #include <tchar.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
20 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
24 #include "base/win/registry.h" | 24 #include "base/win/registry.h" |
25 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
26 #include "chrome/app/main_dll_loader_win.h" | 26 #include "chrome/app/main_dll_loader_win.h" |
27 #include "chrome/browser/policy/policy_path_parser.h" | 27 #include "chrome/browser/policy/policy_path_parser.h" |
28 #include "chrome/browser/win/chrome_process_finder.h" | 28 #include "chrome/browser/win/chrome_process_finder.h" |
29 #include "chrome/common/chrome_constants.h" | |
30 #include "chrome/common/chrome_paths_internal.h" | 29 #include "chrome/common/chrome_paths_internal.h" |
31 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/install_static/install_details.h" | 31 #include "chrome/install_static/initialize_from_primary_module.h" |
33 #include "chrome/install_static/install_util.h" | 32 #include "chrome/install_static/install_util.h" |
34 #include "chrome_elf/chrome_elf_main.h" | 33 #include "chrome_elf/chrome_elf_main.h" |
35 #include "components/crash/content/app/crash_switches.h" | 34 #include "components/crash/content/app/crash_switches.h" |
36 #include "components/crash/content/app/crashpad.h" | 35 #include "components/crash/content/app/crashpad.h" |
37 #include "components/crash/content/app/fallback_crash_handling_win.h" | 36 #include "components/crash/content/app/fallback_crash_handling_win.h" |
38 #include "components/crash/content/app/run_as_crashpad_handler_win.h" | 37 #include "components/crash/content/app/run_as_crashpad_handler_win.h" |
39 #include "content/public/common/content_switches.h" | 38 #include "content/public/common/content_switches.h" |
40 #include "content/public/common/result_codes.h" | 39 #include "content/public/common/result_codes.h" |
41 | 40 |
42 namespace { | 41 namespace { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // This is in chrome_elf. | 222 // This is in chrome_elf. |
224 extern "C" void BlockUntilHandlerStartedImpl(); | 223 extern "C" void BlockUntilHandlerStartedImpl(); |
225 #endif // SYZYASAN | 224 #endif // SYZYASAN |
226 | 225 |
227 #if !defined(WIN_CONSOLE_APP) | 226 #if !defined(WIN_CONSOLE_APP) |
228 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { | 227 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { |
229 #else | 228 #else |
230 int main() { | 229 int main() { |
231 HINSTANCE instance = GetModuleHandle(nullptr); | 230 HINSTANCE instance = GetModuleHandle(nullptr); |
232 #endif | 231 #endif |
233 install_static::InstallDetails::InitializeFromPrimaryModule( | 232 install_static::InitializeFromPrimaryModule(); |
234 chrome::kChromeElfDllName); | |
235 | 233 |
236 // Initialize the CommandLine singleton from the environment. | 234 // Initialize the CommandLine singleton from the environment. |
237 base::CommandLine::Init(0, nullptr); | 235 base::CommandLine::Init(0, nullptr); |
238 const base::CommandLine* command_line = | 236 const base::CommandLine* command_line = |
239 base::CommandLine::ForCurrentProcess(); | 237 base::CommandLine::ForCurrentProcess(); |
240 | 238 |
241 const std::string process_type = | 239 const std::string process_type = |
242 command_line->GetSwitchValueASCII(switches::kProcessType); | 240 command_line->GetSwitchValueASCII(switches::kProcessType); |
243 | 241 |
244 // Confirm that an explicit prefetch profile is used for all process types | 242 // Confirm that an explicit prefetch profile is used for all process types |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 RemoveAppCompatFlagsEntry(); | 278 RemoveAppCompatFlagsEntry(); |
281 | 279 |
282 // Load and launch the chrome dll. *Everything* happens inside. | 280 // Load and launch the chrome dll. *Everything* happens inside. |
283 VLOG(1) << "About to load main DLL."; | 281 VLOG(1) << "About to load main DLL."; |
284 MainDllLoader* loader = MakeMainDllLoader(); | 282 MainDllLoader* loader = MakeMainDllLoader(); |
285 int rc = loader->Launch(instance, exe_entry_point_ticks); | 283 int rc = loader->Launch(instance, exe_entry_point_ticks); |
286 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 284 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
287 delete loader; | 285 delete loader; |
288 return rc; | 286 return rc; |
289 } | 287 } |
OLD | NEW |