Index: ui/gfx/win/dpi.cc |
diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc |
index 798e954eb54760eabbe4922ea36cc277448951ef..0c71d43328257306fcb33d4cc49eddee62821046 100644 |
--- a/ui/gfx/win/dpi.cc |
+++ b/ui/gfx/win/dpi.cc |
@@ -98,6 +98,21 @@ BOOL SetProcessDPIAwareWrapper() { |
set_process_dpi_aware_func(); |
} |
+const wchar_t kRegistryProfilePath[] = L"SOFTWARE\\Google\\Chrome\\Profile"; |
+const wchar_t kHighDPISupport[] = L"high-dpi-support"; |
+ |
+DWORD ReadRegistryValue(HKEY root, const wchar_t* base_key, |
+ const wchar_t* value_name, DWORD default_value) { |
+ base::win::RegKey regKey(HKEY_CURRENT_USER, |
+ base_key, |
+ KEY_QUERY_VALUE); |
+ DWORD value; |
+ if (regKey.Valid() && |
+ regKey.ReadValueDW(value_name,&value) == ERROR_SUCCESS) { |
+ return value; |
+ } |
+ return default_value; |
+} |
} // namespace |
namespace gfx { |
@@ -137,14 +152,18 @@ float GetDPIScale() { |
return 1.0; |
} |
+std::wstring ConvertToWString(const std::string& s) { |
+ std::wstring result; |
+ result.assign(s.begin(),s.end()); |
+ return result; |
+} |
+ |
bool IsHighDPIEnabled() { |
// 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, |
+ ConvertToWString(switches::kHighDPISupport).c_str(),FALSE); |
+ return value == 1; |
} |
bool IsInHighDPIMode() { |
@@ -152,8 +171,9 @@ bool IsInHighDPIMode() { |
} |
void EnableHighDPISupport() { |
- if (IsHighDPIEnabled() && |
- (base::win::GetVersion() < base::win::VERSION_WIN8_1)) { |
+ // TODO: Test to see if this changes in Win8.1 - If not, then change |
+ // GetUndocumentedDPIScale... |
+ if (IsHighDPIEnabled()) { |
if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { |
SetProcessDPIAwareWrapper(); |
} |