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 if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { | 130 // Enable per-monitor DPI for Win10 or above instead of Win8.1 since Win8.1 |
| 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)) { |
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 |