| 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 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID); | 120 typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID); |
| 121 SetProcessDPIAwarePtr set_process_dpi_aware_func = | 121 SetProcessDPIAwarePtr set_process_dpi_aware_func = |
| 122 reinterpret_cast<SetProcessDPIAwarePtr>( | 122 reinterpret_cast<SetProcessDPIAwarePtr>( |
| 123 GetProcAddress(GetModuleHandleA("user32.dll"), | 123 GetProcAddress(GetModuleHandleA("user32.dll"), |
| 124 "SetProcessDPIAware")); | 124 "SetProcessDPIAware")); |
| 125 return set_process_dpi_aware_func && | 125 return set_process_dpi_aware_func && |
| 126 set_process_dpi_aware_func(); | 126 set_process_dpi_aware_func(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void EnableHighDPISupport() { | 129 void EnableHighDPISupport() { |
| 130 // Enable per-monitor DPI for Win10 or above instead of Win8.1 since Win8.1 | 130 if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { |
| 131 // does not have EnableChildWindowDpiMessage, necessary for correct non-client | |
| 132 // area scaling across monitors. | |
| 133 PROCESS_DPI_AWARENESS process_dpi_awareness = | |
| 134 base::win::GetVersion() >= base::win::VERSION_WIN10 | |
| 135 ? PROCESS_PER_MONITOR_DPI_AWARE | |
| 136 : PROCESS_SYSTEM_DPI_AWARE; | |
| 137 if (!SetProcessDpiAwarenessWrapper(process_dpi_awareness)) { | |
| 138 SetProcessDPIAwareWrapper(); | 131 SetProcessDPIAwareWrapper(); |
| 139 } | 132 } |
| 140 } | 133 } |
| 141 | 134 |
| 142 // Returns true if |command_line| contains a /prefetch:# argument where # is in | 135 // Returns true if |command_line| contains a /prefetch:# argument where # is in |
| 143 // [1, 8]. | 136 // [1, 8]. |
| 144 bool HasValidWindowsPrefetchArgument(const base::CommandLine& command_line) { | 137 bool HasValidWindowsPrefetchArgument(const base::CommandLine& command_line) { |
| 145 const base::char16 kPrefetchArgumentPrefix[] = L"/prefetch:"; | 138 const base::char16 kPrefetchArgumentPrefix[] = L"/prefetch:"; |
| 146 | 139 |
| 147 for (const auto& arg : command_line.argv()) { | 140 for (const auto& arg : command_line.argv()) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 RemoveAppCompatFlagsEntry(); | 257 RemoveAppCompatFlagsEntry(); |
| 265 | 258 |
| 266 // Load and launch the chrome dll. *Everything* happens inside. | 259 // Load and launch the chrome dll. *Everything* happens inside. |
| 267 VLOG(1) << "About to load main DLL."; | 260 VLOG(1) << "About to load main DLL."; |
| 268 MainDllLoader* loader = MakeMainDllLoader(); | 261 MainDllLoader* loader = MakeMainDllLoader(); |
| 269 int rc = loader->Launch(instance); | 262 int rc = loader->Launch(instance); |
| 270 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 263 loader->RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
| 271 delete loader; | 264 delete loader; |
| 272 return rc; | 265 return rc; |
| 273 } | 266 } |
| OLD | NEW |