Bug 795307 - Use telemetry to report touch enabled device stats. r=nfroyd

This commit is contained in:
Jim Mathies 2012-09-29 11:39:23 -05:00
Родитель b6bca32325
Коммит 1f0a409256
2 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -2260,5 +2260,10 @@
"READ_SAVED_PING_SUCCESS": { "READ_SAVED_PING_SUCCESS": {
"kind": "boolean", "kind": "boolean",
"description": "Sucessful reading a saved ping file" "description": "Sucessful reading a saved ping file"
},
"TOUCH_ENABLED_DEVICE": {
"kind": "boolean",
"description": "The device supports touch input",
"cpp_guard": "XP_WIN"
} }
} }

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsUXThemeConstants.h" #include "nsUXThemeConstants.h"
#include "gfxFont.h" #include "gfxFont.h"
#include "WinUtils.h" #include "WinUtils.h"
#include "mozilla/Telemetry.h"
using namespace mozilla::widget; using namespace mozilla::widget;
using mozilla::LookAndFeel; using mozilla::LookAndFeel;
@ -38,8 +39,18 @@ static int32_t GetSystemParam(long flag, int32_t def)
return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def; 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() nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
{ {
mozilla::Telemetry::Accumulate(mozilla::Telemetry::TOUCH_ENABLED_DEVICE,
IsTouchPresent());
} }
nsLookAndFeel::~nsLookAndFeel() nsLookAndFeel::~nsLookAndFeel()
@ -365,13 +376,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
aResult = !IsAppThemed(); aResult = !IsAppThemed();
break; break;
case eIntID_TouchEnabled: case eIntID_TouchEnabled:
aResult = 0; aResult = IsTouchPresent();
int32_t touchCapabilities;
touchCapabilities = ::GetSystemMetrics(SM_DIGITIZER);
if ((touchCapabilities & NID_READY) &&
(touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH))) {
aResult = 1;
}
break; break;
case eIntID_WindowsDefaultTheme: case eIntID_WindowsDefaultTheme:
aResult = nsUXThemeData::IsDefaultWindowTheme(); aResult = nsUXThemeData::IsDefaultWindowTheme();