Chromium Code Reviews| 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 "ui/gfx/win/dpi.h" | 5 #include "ui/gfx/win/dpi.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/win/scoped_hdc.h" | 9 #include "base/win/scoped_hdc.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 float GetDPIScale() { | 151 float GetDPIScale() { |
| 152 if (IsHighDPIEnabled()) { | 152 if (IsHighDPIEnabled()) { |
| 153 return gfx::Display::HasForceDeviceScaleFactor() ? | 153 return gfx::Display::HasForceDeviceScaleFactor() ? |
| 154 gfx::Display::GetForcedDeviceScaleFactor() : | 154 gfx::Display::GetForcedDeviceScaleFactor() : |
| 155 GetUnforcedDeviceScaleFactor(); | 155 GetUnforcedDeviceScaleFactor(); |
| 156 } | 156 } |
| 157 return 1.0; | 157 return 1.0; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ForceHighDPISupportForTesting(float scale) { | 160 void ForceHighDPISupportForTesting(float scale) { |
| 161 force_highdpi_for_testing = true; | 161 force_highdpi_for_testing = true; |
|
cpu_(ooo_6.6-7.5)
2014/04/14 19:55:03
we don't need force_highdpi_for_testing, please re
| |
| 162 g_device_scale_factor = scale; | 162 g_device_scale_factor = scale; |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool IsHighDPIEnabled() { | 165 bool IsHighDPIEnabled() { |
| 166 // Flag stored in HKEY_CURRENT_USER\SOFTWARE\\Google\\Chrome\\Profile, | 166 // Flag stored in HKEY_CURRENT_USER\SOFTWARE\\Google\\Chrome\\Profile, |
| 167 // under the DWORD value high-dpi-support. | 167 // under the DWORD value high-dpi-support. |
| 168 // Default is disabled. | 168 // Default is disabled. |
| 169 static DWORD value = ReadRegistryValue( | 169 static DWORD value = ReadRegistryValue( |
| 170 HKEY_CURRENT_USER, kRegistryProfilePath, | 170 HKEY_CURRENT_USER, kRegistryProfilePath, |
| 171 kHighDPISupportW, FALSE); | 171 kHighDPISupportW, TRUE); |
| 172 return force_highdpi_for_testing || (value == 1); | 172 return force_highdpi_for_testing || (value != 0); |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool IsInHighDPIMode() { | 175 bool IsInHighDPIMode() { |
| 176 return GetDPIScale() > 1.0; | 176 return GetDPIScale() > 1.0; |
| 177 } | 177 } |
| 178 | 178 |
| 179 void EnableHighDPISupport() { | 179 void EnableHighDPISupport() { |
| 180 if (IsHighDPIEnabled() && | 180 if (IsHighDPIEnabled() && |
| 181 !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { | 181 !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { |
| 182 SetProcessDPIAwareWrapper(); | 182 SetProcessDPIAwareWrapper(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 | 259 |
| 260 double GetUndocumentedDPITouchScale() { | 260 double GetUndocumentedDPITouchScale() { |
| 261 static double scale = | 261 static double scale = |
| 262 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? | 262 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? |
| 263 GetUndocumentedDPIScale() : 1.0; | 263 GetUndocumentedDPIScale() : 1.0; |
| 264 return scale; | 264 return scale; |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace win | 267 } // namespace win |
| 268 } // namespace gfx | 268 } // namespace gfx |
| OLD | NEW |