Correct DPI setting to account for undocumented scaling.

The OS performs scaling on behalf of non-dpi-aware (dpi-naive?) apps. This patch lets us map the virtual DPI value from the OS back into the real value.

BUG=238143

Review URL: https://chromiumcodereview.appspot.com/14757006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198574 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 511d6d7..de8d34d 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -60,6 +60,7 @@
 
 #if defined(OS_WIN)
 #include "base/win/metro.h"
+#include "ui/base/win/dpi.h"
 
 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
 extern "C" IMAGE_DOS_HEADER __ImageBase;
@@ -288,6 +289,8 @@
       GetDeviceCaps(hdc, HORZRES) / (size_x / kMillimetersPerInch) : 0;
   double dpi_y = (size_y > 0) ?
       GetDeviceCaps(hdc, VERTRES) / (size_y / kMillimetersPerInch) : 0;
+  dpi_x *= ui::win::GetUndocumentedDPIScale();
+  dpi_y *= ui::win::GetUndocumentedDPIScale();
   screen_info->max_dpi_x = std::max(dpi_x, screen_info->max_dpi_x);
   screen_info->max_dpi_y = std::max(dpi_y, screen_info->max_dpi_y);
   return TRUE;