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

Unified Diff: chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc

Issue 2151413002: Add a UMA histogram for a user's device scale at startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
index b1af95d46c49e1f16df919098bf4be74ca4560cc..08a3db2e79b2d225f3e81907531a843f4e5af604 100644
--- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
+++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
@@ -54,6 +54,7 @@
#include "base/win/windows_version.h"
#include "chrome/browser/shell_integration_win.h"
#include "chrome/installer/util/google_update_settings.h"
+#include "ui/display/win/dpi.h"
#endif // defined(OS_WIN)
namespace {
@@ -271,6 +272,18 @@ void RecordTouchEventState() {
UMA_TOUCH_EVENTS_STATE_COUNT);
}
+#if defined(OS_WIN)
+void RecordDeviceScale() {
+ // Clamp the reported value so that if it's wildly out-of-band we won't send
+ // it to the backend.
+ const int scale = std::min(
+ std::max(std::floor(display::win::GetUnforcedDeviceScaleFactor() * 100),
+ 0.f),
+ 1000.f);
Ilya Sherman 2016/07/16 00:43:10 nit: I think you want 0 and 1000 instead of 0.f an
Bret 2016/07/16 01:22:35 std::floor returns a float and std::min/max requir
+ UMA_HISTOGRAM_SPARSE_SLOWLY("UI.DeviceScale", scale);
+}
+#endif
Ilya Sherman 2016/07/16 00:43:10 Could you please find a different location for rec
Bret 2016/07/16 01:22:35 Done. Moved into dpi.cc initialization.
+
#if defined(USE_OZONE) || defined(USE_X11)
// Asynchronously records the touch event state when the ui::DeviceDataManager
@@ -356,6 +369,7 @@ void ChromeBrowserMainExtraPartsMetrics::PostBrowserStart() {
FROM_HERE, base::Bind(&RecordStartupMetricsOnBlockingPool),
kStartupMetricsGatheringDelay);
#if defined(OS_WIN)
+ RecordDeviceScale();
content::BrowserThread::PostDelayedTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&shell_integration::win::RecordIsPinnedToTaskbarHistogram),
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698