Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: ui/gfx/win/dpi.cc

Issue 153403003: Move supports-high-dpi flag into registry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reformat, remove strings Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/win/dpi.cc
diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc
index 798e954eb54760eabbe4922ea36cc277448951ef..f84b88e044024ec1e7a0c409101c10623363421f 100644
--- a/ui/gfx/win/dpi.cc
+++ b/ui/gfx/win/dpi.cc
@@ -98,6 +98,24 @@ BOOL SetProcessDPIAwareWrapper() {
set_process_dpi_aware_func();
}
+const wchar_t kRegistryProfilePath[] = L"SOFTWARE\\Google\\Chrome\\Profile";
sky 2014/02/20 15:48:43 nit: move constants to top of namespace (right her
girard 2014/02/20 20:20:16 Done.
+const wchar_t kHighDPISupportW[] = L"high-dpi-support";
+
+DWORD ReadRegistryValue(HKEY root,
+ const wchar_t* base_key,
+ const wchar_t* value_name,
+ DWORD default_value) {
+ base::win::RegKey reg_key(HKEY_CURRENT_USER,
+ base_key,
+ KEY_QUERY_VALUE);
+ DWORD value;
+ if (reg_key.Valid() &&
+ reg_key.ReadValueDW(value_name, &value) == ERROR_SUCCESS) {
+ return value;
+ }
+ return default_value;
+}
+
} // namespace
namespace gfx {
@@ -138,13 +156,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,
+ kHighDPISupportW, FALSE);
+ return value == 1;
}
bool IsInHighDPIMode() {
@@ -153,10 +171,8 @@ bool IsInHighDPIMode() {
void EnableHighDPISupport() {
if (IsHighDPIEnabled() &&
- (base::win::GetVersion() < base::win::VERSION_WIN8_1)) {
- if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) {
- SetProcessDPIAwareWrapper();
- }
+ !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) {
+ SetProcessDPIAwareWrapper();
}
}
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698