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

Side by Side Diff: chrome/browser/metrics/metrics_log.cc

Issue 23851034: GetDeviceCaps doesn't need to be scaled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/metrics/metrics_log.h" 5 #include "chrome/browser/metrics/metrics_log.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "gpu/config/gpu_info.h" 51 #include "gpu/config/gpu_info.h"
52 #include "ui/gfx/screen.h" 52 #include "ui/gfx/screen.h"
53 #include "url/gurl.h" 53 #include "url/gurl.h"
54 54
55 #if defined(OS_ANDROID) 55 #if defined(OS_ANDROID)
56 #include "base/android/build_info.h" 56 #include "base/android/build_info.h"
57 #endif 57 #endif
58 58
59 #if defined(OS_WIN) 59 #if defined(OS_WIN)
60 #include "base/win/metro.h" 60 #include "base/win/metro.h"
61 #include "ui/gfx/win/dpi.h"
62 61
63 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx 62 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
64 extern "C" IMAGE_DOS_HEADER __ImageBase; 63 extern "C" IMAGE_DOS_HEADER __ImageBase;
65 #endif 64 #endif
66 65
67 using content::GpuDataManager; 66 using content::GpuDataManager;
68 using metrics::OmniboxEventProto; 67 using metrics::OmniboxEventProto;
69 using metrics::PerfDataProto; 68 using metrics::PerfDataProto;
70 using metrics::ProfilerEventProto; 69 using metrics::ProfilerEventProto;
71 using metrics::SystemProfileProto; 70 using metrics::SystemProfileProto;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 const double kMillimetersPerInch = 25.4; 297 const double kMillimetersPerInch = 25.4;
299 ScreenDPIInformation* screen_info = 298 ScreenDPIInformation* screen_info =
300 reinterpret_cast<ScreenDPIInformation*>(dwData); 299 reinterpret_cast<ScreenDPIInformation*>(dwData);
301 // Size of screen, in mm. 300 // Size of screen, in mm.
302 DWORD size_x = GetDeviceCaps(hdc, HORZSIZE); 301 DWORD size_x = GetDeviceCaps(hdc, HORZSIZE);
303 DWORD size_y = GetDeviceCaps(hdc, VERTSIZE); 302 DWORD size_y = GetDeviceCaps(hdc, VERTSIZE);
304 double dpi_x = (size_x > 0) ? 303 double dpi_x = (size_x > 0) ?
305 GetDeviceCaps(hdc, HORZRES) / (size_x / kMillimetersPerInch) : 0; 304 GetDeviceCaps(hdc, HORZRES) / (size_x / kMillimetersPerInch) : 0;
306 double dpi_y = (size_y > 0) ? 305 double dpi_y = (size_y > 0) ?
307 GetDeviceCaps(hdc, VERTRES) / (size_y / kMillimetersPerInch) : 0; 306 GetDeviceCaps(hdc, VERTRES) / (size_y / kMillimetersPerInch) : 0;
308 dpi_x *= gfx::win::GetUndocumentedDPIScale();
309 dpi_y *= gfx::win::GetUndocumentedDPIScale();
310 screen_info->max_dpi_x = std::max(dpi_x, screen_info->max_dpi_x); 307 screen_info->max_dpi_x = std::max(dpi_x, screen_info->max_dpi_x);
311 screen_info->max_dpi_y = std::max(dpi_y, screen_info->max_dpi_y); 308 screen_info->max_dpi_y = std::max(dpi_y, screen_info->max_dpi_y);
312 return TRUE; 309 return TRUE;
313 } 310 }
314 311
315 void WriteScreenDPIInformationProto(SystemProfileProto::Hardware* hardware) { 312 void WriteScreenDPIInformationProto(SystemProfileProto::Hardware* hardware) {
316 HDC desktop_dc = GetDC(NULL); 313 HDC desktop_dc = GetDC(NULL);
317 if (desktop_dc) { 314 if (desktop_dc) {
318 ScreenDPIInformation si = {0, 0}; 315 ScreenDPIInformation si = {0, 0};
319 if (EnumDisplayMonitors(desktop_dc, NULL, GetMonitorDPICallback, 316 if (EnumDisplayMonitors(desktop_dc, NULL, GetMonitorDPICallback,
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 948
952 paired_device->set_vendor_prefix(vendor_prefix); 949 paired_device->set_vendor_prefix(vendor_prefix);
953 } 950 }
954 951
955 paired_device->set_vendor_id(device->GetVendorID()); 952 paired_device->set_vendor_id(device->GetVendorID());
956 paired_device->set_product_id(device->GetProductID()); 953 paired_device->set_product_id(device->GetProductID());
957 paired_device->set_device_id(device->GetDeviceID()); 954 paired_device->set_device_id(device->GetDeviceID());
958 } 955 }
959 #endif // defined(OS_CHROMEOS) 956 #endif // defined(OS_CHROMEOS)
960 } 957 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698