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

Unified Diff: ash/touch/touch_uma.cc

Issue 10831303: ash: Add UMA for taps on webpage, bezel and tabstrip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/touch/touch_uma.cc
diff --git a/ash/touch/touch_uma.cc b/ash/touch/touch_uma.cc
index 729a6e4e6f8d487c29da77ec0832508816db217f..ed66bb2b9133b9f6433eaba369c06f7f30ba5be8 100644
--- a/ash/touch/touch_uma.cc
+++ b/ash/touch/touch_uma.cc
@@ -30,6 +30,9 @@ enum GestureActionType {
GESTURE_DESKTOP_PINCH,
GESTURE_WEBPAGE_PINCH,
GESTURE_WEBPAGE_SCROLL,
+ GESTURE_WEBPAGE_TAP,
+ GESTURE_TABSTRIP_TAP,
+ GESTURE_BEZEL_DOWN,
// NOTE: Add new action types only immediately above this line. Also, make sure
// the enum list in tools/histogram/histograms.xml is updated with any change in
// here.
@@ -98,6 +101,8 @@ GestureActionType FindGestureActionType(aura::Window* window,
if (!window || window->GetRootWindow() == window) {
if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN)
return GESTURE_BEZEL_SCROLL;
+ if (event.type() == ui::ET_GESTURE_BEGIN)
+ return GESTURE_BEZEL_DOWN;
return GESTURE_UNKNOWN;
}
@@ -118,6 +123,8 @@ GestureActionType FindGestureActionType(aura::Window* window,
return GESTURE_WEBPAGE_PINCH;
if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN)
return GESTURE_WEBPAGE_SCROLL;
+ if (event.type() == ui::ET_GESTURE_TAP)
+ return GESTURE_WEBPAGE_TAP;
return GESTURE_UNKNOWN;
}
@@ -139,6 +146,8 @@ GestureActionType FindGestureActionType(aura::Window* window,
return GESTURE_TABSTRIP_SCROLL;
if (event.type() == ui::ET_GESTURE_PINCH_BEGIN)
return GESTURE_TABSTRIP_PINCH;
+ if (event.type() == ui::ET_GESTURE_TAP)
+ return GESTURE_TABSTRIP_TAP;
return GESTURE_UNKNOWN;
}
@@ -273,10 +282,10 @@ void TouchUMA::RecordTouchEvent(aura::Window* target,
}
// Record the location of the touch points.
- const int kBucketCount = 100;
+ const int kBucketCountForLocation = 100;
const gfx::Rect bounds = target->GetRootWindow()->bounds();
- const int bucket_size_x = bounds.width() / kBucketCount;
- const int bucket_size_y = bounds.height() / kBucketCount;
+ const int bucket_size_x = bounds.width() / kBucketCountForLocation;
+ const int bucket_size_y = bounds.height() / kBucketCountForLocation;
gfx::Point position = event.root_location();
@@ -299,19 +308,18 @@ void TouchUMA::RecordTouchEvent(aura::Window* target,
#else
position = ui::EventLocationFromNative(event.native_event());
#endif
+ position = position.Scale(1. / target->layer()->device_scale_factor());
Ilya Sherman 2012/08/14 18:54:01 nit: I'm not 100% sure of this, but I think Chromi
sadrul 2012/08/14 19:57:05 It looks like we use "1." in other places in the c
}
position.set_x(std::min(bounds.width() - 1, std::max(0, position.x())));
position.set_y(std::min(bounds.height() - 1, std::max(0, position.y())));
- STATIC_HISTOGRAM_POINTER_BLOCK("Ash.TouchPositionX",
- Add(position.x() / bucket_size_x),
- base::LinearHistogram::FactoryGet("Ash.TouchPositionX", 1, kBucketCount,
- kBucketCount + 1, base::Histogram::kUmaTargetedHistogramFlag));
- STATIC_HISTOGRAM_POINTER_BLOCK("Ash.TouchPositionY",
- Add(position.y() / bucket_size_y),
- base::LinearHistogram::FactoryGet("Ash.TouchPositionY", 1, kBucketCount,
- kBucketCount + 1, base::Histogram::kUmaTargetedHistogramFlag));
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionX",
+ position.x() / bucket_size_x,
+ 0, kBucketCountForLocation, kBucketCountForLocation + 1);
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionY",
+ position.y() / bucket_size_y,
+ 0, kBucketCountForLocation, kBucketCountForLocation + 1);
if (event.type() == ui::ET_TOUCH_PRESSED) {
Shell::GetInstance()->delegate()->RecordUserMetricsAction(
@@ -336,9 +344,8 @@ void TouchUMA::RecordTouchEvent(aura::Window* target,
// Record the number of touch-points currently active for the window.
const int kMaxTouchPoints = 10;
UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.ActiveTouchPoints",
- std::min(static_cast<int>(details->last_start_time_.size()),
- kMaxTouchPoints),
- 1, kMaxTouchPoints, kMaxTouchPoints);
+ details->last_start_time_.size(),
+ 1, kMaxTouchPoints, kMaxTouchPoints + 1);
Ilya Sherman 2012/08/14 18:54:01 Note that this change will probably cause one of t
sadrul 2012/08/14 19:57:05 Thanks for the heads-up. I think at this point, th
} else if (event.type() == ui::ET_TOUCH_RELEASED) {
if (details->last_start_time_.count(event.touch_id())) {
base::TimeDelta duration = event.time_stamp() -
« 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