Chromium Code Reviews| Index: ui/gfx/win/dpi.cc |
| diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc |
| index 798e954eb54760eabbe4922ea36cc277448951ef..fbb6b91d171ca9afba5d0861e62afb8e36915cb6 100644 |
| --- a/ui/gfx/win/dpi.cc |
| +++ b/ui/gfx/win/dpi.cc |
| @@ -98,6 +98,22 @@ BOOL SetProcessDPIAwareWrapper() { |
| set_process_dpi_aware_func(); |
| } |
| +const wchar_t kRegistryProfilePath[] = L"SOFTWARE\\Google\\Chrome\\Profile"; |
| +const wchar_t kHighDPISupportW[] = L"high-dpi-support"; |
| + |
| +DWORD ReadRegistryValue(HKEY root, const wchar_t* base_key, |
|
sky
2014/02/19 21:20:32
nit: when you wrap to multiple lines, one paramete
girard
2014/02/20 02:22:18
Done.
|
| + const wchar_t* value_name, DWORD default_value) { |
| + base::win::RegKey regKey(HKEY_CURRENT_USER, |
|
sky
2014/02/19 21:20:32
reg_key
girard
2014/02/20 02:22:18
Done.
|
| + base_key, |
|
sky
2014/02/19 21:20:32
nit: spacing
girard
2014/02/20 02:22:18
Done.
|
| + KEY_QUERY_VALUE); |
| + DWORD value; |
| + if (regKey.Valid() && |
| + regKey.ReadValueDW(value_name,&value) == ERROR_SUCCESS) { |
|
sky
2014/02/19 21:20:32
'name,&'-> 'name, &'
girard
2014/02/20 02:22:18
Done.
|
| + return value; |
| + } |
| + return default_value; |
| +} |
| + |
| } // namespace |
| namespace gfx { |
| @@ -138,13 +154,13 @@ float GetDPIScale() { |
| } |
| bool IsHighDPIEnabled() { |
| + // Flag stored in HKEY_CURRENT_USER\SOFTWARE\\Google\\Chrome\\Profile, |
| + // under the DWORD value high-dpi-support. |
| // Default is disabled. |
| - if (CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kHighDPISupport)) { |
| - return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| - switches::kHighDPISupport).compare("1") == 0; |
| - } |
| - return false; |
| + static DWORD value = ReadRegistryValue( |
| + HKEY_CURRENT_USER,kRegistryProfilePath, |
|
sky
2014/02/19 21:20:32
nit: spaces after ','
girard
2014/02/20 02:22:18
Done.
|
| + kHighDPISupportW,FALSE); |
| + return value == 1; |
| } |
| bool IsInHighDPIMode() { |
| @@ -152,8 +168,7 @@ bool IsInHighDPIMode() { |
| } |
| void EnableHighDPISupport() { |
| - if (IsHighDPIEnabled() && |
| - (base::win::GetVersion() < base::win::VERSION_WIN8_1)) { |
| + if (IsHighDPIEnabled()) { |
| if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { |
|
sky
2014/02/19 21:20:32
nit: combine ifs.
girard
2014/02/20 02:22:18
Done.
|
| SetProcessDPIAwareWrapper(); |
| } |