Bug 795307 - Use telemetry to report touch enabled device stats. r=nfroyd
☠☠ backed out by 4fc56788f874 ☠ ☠
authorJim Mathies <jmathies@mozilla.com>
Fri, 28 Sep 2012 14:11:12 -0500
changeset 108507 0c18edd01cd4db9905801b29e5a2135b99f09752
parent 108506 204ba80209a2964f11851fe788375d51fd8aae4a
child 108508 ff77ff9b20336ad05192dd1dbaad49e5f35c62f8
push id15554
push userjmathies@mozilla.com
push dateFri, 28 Sep 2012 19:11:19 +0000
treeherdermozilla-inbound@0c18edd01cd4 [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
@@ -33,18 +33,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 +370,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: