| 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/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 21 #include "base/strings/string_split.h" | 21 #include "base/strings/string_split.h" |
| 22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.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/chrome_crash_reporter_client_win.h" | 26 #include "chrome/app/chrome_crash_reporter_client_win.h" |
| 27 #include "chrome/app/main_dll_loader_win.h" | 27 #include "chrome/app/main_dll_loader_win.h" |
| 28 #include "chrome/browser/policy/policy_path_parser.h" | 28 #include "chrome/browser/policy/policy_path_parser.h" |
| 29 #include "chrome/browser/win/chrome_process_finder.h" | 29 #include "chrome/browser/win/chrome_process_finder.h" |
| 30 #include "chrome/common/channel_info.h" |
| 30 #include "chrome/common/chrome_paths_internal.h" | 31 #include "chrome/common/chrome_paths_internal.h" |
| 31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/installer/util/browser_distribution.h" | 33 #include "chrome/installer/util/browser_distribution.h" |
| 33 #include "chrome_elf/chrome_elf_main.h" | 34 #include "chrome_elf/chrome_elf_main.h" |
| 34 #include "components/crash/content/app/crash_reporter_client.h" | 35 #include "components/crash/content/app/crash_reporter_client.h" |
| 35 #include "components/crash/content/app/crash_switches.h" | 36 #include "components/crash/content/app/crash_switches.h" |
| 36 #include "components/crash/content/app/crashpad.h" | 37 #include "components/crash/content/app/crashpad.h" |
| 37 #include "components/crash/content/app/run_as_crashpad_handler_win.h" | 38 #include "components/crash/content/app/run_as_crashpad_handler_win.h" |
| 38 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 39 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
| 39 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" | 40 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" |
| 41 #include "components/version_info/version_info.h" |
| 40 #include "content/public/common/content_switches.h" | 42 #include "content/public/common/content_switches.h" |
| 41 #include "content/public/common/result_codes.h" | 43 #include "content/public/common/result_codes.h" |
| 42 | 44 |
| 43 namespace { | 45 namespace { |
| 44 | 46 |
| 45 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = | 47 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = |
| 46 LAZY_INSTANCE_INITIALIZER; | 48 LAZY_INSTANCE_INITIALIZER; |
| 47 | 49 |
| 48 base::LazyInstance<std::vector<crash_reporter::Report>>::Leaky g_crash_reports = | 50 base::LazyInstance<std::vector<crash_reporter::Report>>::Leaky g_crash_reports = |
| 49 LAZY_INSTANCE_INITIALIZER; | 51 LAZY_INSTANCE_INITIALIZER; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID); | 122 typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID); |
| 121 SetProcessDPIAwarePtr set_process_dpi_aware_func = | 123 SetProcessDPIAwarePtr set_process_dpi_aware_func = |
| 122 reinterpret_cast<SetProcessDPIAwarePtr>( | 124 reinterpret_cast<SetProcessDPIAwarePtr>( |
| 123 GetProcAddress(GetModuleHandleA("user32.dll"), | 125 GetProcAddress(GetModuleHandleA("user32.dll"), |
| 124 "SetProcessDPIAware")); | 126 "SetProcessDPIAware")); |
| 125 return set_process_dpi_aware_func && | 127 return set_process_dpi_aware_func && |
| 126 set_process_dpi_aware_func(); | 128 set_process_dpi_aware_func(); |
| 127 } | 129 } |
| 128 | 130 |
| 129 void EnableHighDPISupport() { | 131 void EnableHighDPISupport() { |
| 130 if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { | 132 PROCESS_DPI_AWARENESS process_dpi_awareness = PROCESS_SYSTEM_DPI_AWARE; |
| 133 if (base::win::GetVersion() >= base::win::VERSION_WIN10 && |
| 134 chrome::GetChannel() < version_info::Channel::STABLE) { |
| 135 process_dpi_awareness = PROCESS_PER_MONITOR_DPI_AWARE; |
| 136 } |
| 137 if (!SetProcessDpiAwarenessWrapper(process_dpi_awareness)) { |
| 131 SetProcessDPIAwareWrapper(); | 138 SetProcessDPIAwareWrapper(); |
| 132 } | 139 } |
| 133 } | 140 } |
| 134 | 141 |
| 135 // Returns true if |command_line| contains a /prefetch:# argument where # is in | 142 // Returns true if |command_line| contains a /prefetch:# argument where # is in |
| 136 // [1, 8]. | 143 // [1, 8]. |
| 137 bool HasValidWindowsPrefetchArgument(const base::CommandLine& command_line) { | 144 bool HasValidWindowsPrefetchArgument(const base::CommandLine& command_line) { |
| 138 const base::char16 kPrefetchArgumentPrefix[] = L"/prefetch:"; | 145 const base::char16 kPrefetchArgumentPrefix[] = L"/prefetch:"; |
| 139 | 146 |
| 140 for (const auto& arg : command_line.argv()) { | 147 for (const auto& arg : command_line.argv()) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 RemoveAppCompatFlagsEntry(); | 264 RemoveAppCompatFlagsEntry(); |
| 258 | 265 |
| 259 // Load and launch the chrome dll. *Everything* happens inside. | 266 // Load and launch the chrome dll. *Everything* happens inside. |
| 260 VLOG(1) << "About to load main DLL."; | 267 VLOG(1) << "About to load main DLL."; |
| 261 MainDllLoader* loader = MakeMainDllLoader(); | 268 MainDllLoader* loader = MakeMainDllLoader(); |
| 262 int rc = loader->Launch(instance); | 269 int rc = loader->Launch(instance); |
| 263 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 270 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
| 264 delete loader; | 271 delete loader; |
| 265 return rc; | 272 return rc; |
| 266 } | 273 } |
| OLD | NEW |