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

Unified Diff: ash/touch/touch_uma.cc

Issue 2655303004: Add id properties to PointerEvent (Closed)
Patch Set: pointer id Created 3 years, 10 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
Index: ash/touch/touch_uma.cc
diff --git a/ash/touch/touch_uma.cc b/ash/touch/touch_uma.cc
index 32bf2de7cbb2c17d3a08d90730b90a84eb4650e0..d0c3ab49eacbddbfff14fdc08fce889a6ebe55d7 100644
--- a/ash/touch/touch_uma.cc
+++ b/ash/touch/touch_uma.cc
@@ -123,9 +123,11 @@ void TouchUMA::RecordTouchEvent(aura::Window* target,
if (event.type() == ui::ET_TOUCH_PRESSED) {
WmShell::Get()->RecordUserMetricsAction(UMA_TOUCHSCREEN_TAP_DOWN);
- details->last_start_time_[event.touch_id()] = event.time_stamp();
- details->start_touch_position_[event.touch_id()] = event.root_location();
- details->last_touch_position_[event.touch_id()] = event.location();
+ details->last_start_time_[event.pointer_details().id] = event.time_stamp();
+ details->start_touch_position_[event.pointer_details().id] =
+ event.root_location();
+ details->last_touch_position_[event.pointer_details().id] =
+ event.location();
if (details->last_release_time_.ToInternalValue()) {
// Measuring the interval between a touch-release and the next
@@ -146,16 +148,17 @@ void TouchUMA::RecordTouchEvent(aura::Window* target,
details->last_start_time_.size(), 1,
kMaxTouchPoints, kMaxTouchPoints + 1);
} else if (event.type() == ui::ET_TOUCH_RELEASED) {
- if (details->last_start_time_.count(event.touch_id())) {
+ if (details->last_start_time_.count(event.pointer_details().id)) {
base::TimeDelta duration =
- event.time_stamp() - details->last_start_time_[event.touch_id()];
+ event.time_stamp() -
+ details->last_start_time_[event.pointer_details().id];
// Look for touches that were [almost] stationary for a long time.
const double kLongStationaryTouchDuration = 10;
const int kLongStationaryTouchDistanceSquared = 100;
if (duration.InSecondsF() > kLongStationaryTouchDuration) {
gfx::Vector2d distance =
event.root_location() -
- details->start_touch_position_[event.touch_id()];
+ details->start_touch_position_[event.pointer_details().id];
if (distance.LengthSquared() < kLongStationaryTouchDistanceSquared) {
UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.StationaryTouchDuration",
duration.InSeconds(),
@@ -163,30 +166,33 @@ void TouchUMA::RecordTouchEvent(aura::Window* target,
}
}
}
- details->last_start_time_.erase(event.touch_id());
- details->last_move_time_.erase(event.touch_id());
- details->start_touch_position_.erase(event.touch_id());
- details->last_touch_position_.erase(event.touch_id());
+ details->last_start_time_.erase(event.pointer_details().id);
+ details->last_move_time_.erase(event.pointer_details().id);
+ details->start_touch_position_.erase(event.pointer_details().id);
+ details->last_touch_position_.erase(event.pointer_details().id);
details->last_release_time_ = event.time_stamp();
} else if (event.type() == ui::ET_TOUCH_MOVED) {
int distance = 0;
- if (details->last_touch_position_.count(event.touch_id())) {
- gfx::Point lastpos = details->last_touch_position_[event.touch_id()];
+ if (details->last_touch_position_.count(event.pointer_details().id)) {
+ gfx::Point lastpos =
+ details->last_touch_position_[event.pointer_details().id];
distance =
std::abs(lastpos.x() - event.x()) + std::abs(lastpos.y() - event.y());
}
- if (details->last_move_time_.count(event.touch_id())) {
+ if (details->last_move_time_.count(event.pointer_details().id)) {
base::TimeDelta move_delay =
- event.time_stamp() - details->last_move_time_[event.touch_id()];
+ event.time_stamp() -
+ details->last_move_time_[event.pointer_details().id];
UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchMoveInterval",
move_delay.InMilliseconds(), 1, 50, 25);
}
UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchMoveSteps", distance, 1, 1000, 50);
- details->last_move_time_[event.touch_id()] = event.time_stamp();
- details->last_touch_position_[event.touch_id()] = event.location();
+ details->last_move_time_[event.pointer_details().id] = event.time_stamp();
+ details->last_touch_position_[event.pointer_details().id] =
+ event.location();
}
}

Powered by Google App Engine
This is Rietveld 408576698