Bug 795307 - Use telemetry to report touch enabled device stats. r=nfroyd
authorJim Mathies <jmathies@mozilla.com>
Fri, 28 Sep 2012 14:48:36 -0500
changeset 108540 e320e0e3ec4155ead14cf3f863337828058e0024
parent 108539 41c5a807276fa24f2097479d3c45294b6de3b66f
child 108541 6c68ef18d3400d2dc49b973845e62bac7c1ed90f
child 108544 f569fa9e32ae0f82ddff04aa499b833286b4ae4f
push id23566
push userphilringnalda@gmail.com
push dateSat, 29 Sep 2012 05:10:54 +0000
treeherdermozilla-central@c09a0c022b2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs795307
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 795307 - Use telemetry to report touch enabled device stats. r=nfroyd
widget/windows/nsLookAndFeel.cpp
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -7,16 +7,17 @@
 #include <windows.h>
 #include <shellapi.h>
 #include "nsWindow.h"
 #include "nsStyleConsts.h"
 #include "nsUXThemeData.h"
 #include "nsUXThemeConstants.h"
 #include "gfxFont.h"
 #include "WinUtils.h"
+#include "mozilla/Telemetry.h"
 
 using namespace mozilla::widget;
 using mozilla::LookAndFeel;
 
 static nsresult GetColorFromTheme(nsUXThemeClass cls,
                            int32_t aPart,
                            int32_t aState,
                            int32_t aPropId,
@@ -33,18 +34,28 @@ static nsresult GetColorFromTheme(nsUXTh
 }
 
 static int32_t GetSystemParam(long flag, int32_t def)
 {
     DWORD value; 
     return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def;
 }
 
+static int32_t IsTouchPresent()
+{
+  int32_t touchCapabilities;
+  touchCapabilities = ::GetSystemMetrics(SM_DIGITIZER);
+  return ((touchCapabilities & NID_READY) && 
+          (touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH)));
+}
+
 nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
 {
+  mozilla::Telemetry::Accumulate(mozilla::Telemetry::TOUCH_ENABLED_DEVICE,
+                                 IsTouchPresent());
 }
 
 nsLookAndFeel::~nsLookAndFeel()
 {
 }
 
 nsresult
 nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
@@ -360,23 +371,17 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
         break;
     case eIntID_TreeScrollLinesMax:
         aResult = 3;
         break;
     case eIntID_WindowsClassic:
         aResult = !IsAppThemed();
         break;
     case eIntID_TouchEnabled:
-        aResult = 0;
-        int32_t touchCapabilities;
-        touchCapabilities = ::GetSystemMetrics(SM_DIGITIZER);
-        if ((touchCapabilities & NID_READY) && 
-           (touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH))) {
-            aResult = 1;
-        }
+        aResult = IsTouchPresent();
         break;
     case eIntID_WindowsDefaultTheme:
         aResult = nsUXThemeData::IsDefaultWindowTheme();
         break;
     case eIntID_WindowsThemeIdentifier:
         aResult = nsUXThemeData::GetNativeThemeId();
         break;
     case eIntID_MacGraphiteTheme: