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

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

Issue 12454004: Revert 186187 - crashing on Win XP browser_tests with "Access is denied". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 | « ui/base/win/dpi.h ('k') | ui/base/win/hwnd_subclass.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/dpi.cc
===================================================================
--- ui/base/win/dpi.cc (revision 186195)
+++ ui/base/win/dpi.cc (working copy)
@@ -8,7 +8,6 @@
#include "base/win/scoped_hdc.h"
#include "ui/base/layout.h"
-#include "base/win/registry.h"
#include "ui/gfx/display.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/rect_conversions.h"
@@ -31,24 +30,6 @@
#endif
}
-FARPROC GetProcAddressWrapper(LPCSTR module_name, LPCSTR proc_name) {
- HMODULE module = ::GetModuleHandleA(module_name);
- if (module) {
- return ::GetProcAddress(module, proc_name);
- }
- return NULL;
-}
-
-BOOL IsProcessDPIAwareWrapper() {
- typedef BOOL(WINAPI *IsProcessDPIAwarePtr)(VOID);
- IsProcessDPIAwarePtr is_process_dpi_aware_func =
- reinterpret_cast<IsProcessDPIAwarePtr>(
- GetProcAddressWrapper("user32.dll", "IsProcessDPIAware"));
- if (is_process_dpi_aware_func)
- return is_process_dpi_aware_func();
- return FALSE;
-}
-
} // namespace
namespace ui {
@@ -84,7 +65,7 @@
typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID);
SetProcessDPIAwarePtr set_process_dpi_aware_func =
reinterpret_cast<SetProcessDPIAwarePtr>(
- GetProcAddressWrapper("user32.dll", "SetProcessDPIAware"));
+ GetProcAddress(GetModuleHandleA("user32.dll"), "SetProcessDPIAware"));
if (set_process_dpi_aware_func)
set_process_dpi_aware_func();
}
@@ -122,33 +103,6 @@
return gfx::ToFlooredSize(gfx::ScaleSize(dip_size, GetDeviceScaleFactor()));
}
-double GetDPIScaleFromRegistry() {
- static double scale = -1.0;
- if (scale == -1.0) {
- double result = 1.0;
- if (!IsProcessDPIAwareWrapper()) {
- //HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\AppliedDPI
- base::win::RegKey key(HKEY_CURRENT_USER,
- L"Control Panel\\Desktop\\WindowMetrics",
- KEY_QUERY_VALUE);
-
- if (key.Valid()) {
- DWORD value = 0;
- if (key.ReadValueDW(L"AppliedDPI", &value) == ERROR_SUCCESS) {
- result = ((double)value) / kDefaultDPIX;
- }
- }
- }
- scale = result;
- }
-
- // Safety test to ignore invalid settings.
- if (scale <= 0.0)
- scale = 1.0;
-
- return scale;
-}
-
} // namespace win
} // namespace ui
« no previous file with comments | « ui/base/win/dpi.h ('k') | ui/base/win/hwnd_subclass.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698