| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/touch/touch_uma.h" | 5 #include "ash/touch/touch_uma.h" |
| 6 | 6 |
| 7 #include "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/common/wm_shell.h" |
| 8 #include "ash/shell.h" | |
| 9 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 11 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| 12 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 13 #include "ui/aura/window_event_dispatcher.h" | 12 #include "ui/aura/window_event_dispatcher.h" |
| 14 #include "ui/aura/window_property.h" | 13 #include "ui/aura/window_property.h" |
| 15 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
| 16 #include "ui/events/event_utils.h" | 15 #include "ui/events/event_utils.h" |
| 17 #include "ui/gfx/geometry/point_conversions.h" | 16 #include "ui/gfx/geometry/point_conversions.h" |
| 18 | 17 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 position.set_y(std::min(bounds.height() - 1, std::max(0, position.y()))); | 115 position.set_y(std::min(bounds.height() - 1, std::max(0, position.y()))); |
| 117 | 116 |
| 118 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionX", | 117 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionX", |
| 119 position.x() / bucket_size_x, | 118 position.x() / bucket_size_x, |
| 120 0, kBucketCountForLocation, kBucketCountForLocation + 1); | 119 0, kBucketCountForLocation, kBucketCountForLocation + 1); |
| 121 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionY", | 120 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionY", |
| 122 position.y() / bucket_size_y, | 121 position.y() / bucket_size_y, |
| 123 0, kBucketCountForLocation, kBucketCountForLocation + 1); | 122 0, kBucketCountForLocation, kBucketCountForLocation + 1); |
| 124 | 123 |
| 125 if (event.type() == ui::ET_TOUCH_PRESSED) { | 124 if (event.type() == ui::ET_TOUCH_PRESSED) { |
| 126 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 125 WmShell::Get()->RecordUserMetricsAction(UMA_TOUCHSCREEN_TAP_DOWN); |
| 127 UMA_TOUCHSCREEN_TAP_DOWN); | |
| 128 | 126 |
| 129 details->last_start_time_[event.touch_id()] = event.time_stamp(); | 127 details->last_start_time_[event.touch_id()] = event.time_stamp(); |
| 130 details->start_touch_position_[event.touch_id()] = event.root_location(); | 128 details->start_touch_position_[event.touch_id()] = event.root_location(); |
| 131 details->last_touch_position_[event.touch_id()] = event.location(); | 129 details->last_touch_position_[event.touch_id()] = event.location(); |
| 132 | 130 |
| 133 if (details->last_release_time_.ToInternalValue()) { | 131 if (details->last_release_time_.ToInternalValue()) { |
| 134 // Measuring the interval between a touch-release and the next | 132 // Measuring the interval between a touch-release and the next |
| 135 // touch-start is probably less useful when doing multi-touch (e.g. | 133 // touch-start is probably less useful when doing multi-touch (e.g. |
| 136 // gestures, or multi-touch friendly apps). So count this only if the user | 134 // gestures, or multi-touch friendly apps). So count this only if the user |
| 137 // hasn't done any multi-touch during the last 30 seconds. | 135 // hasn't done any multi-touch during the last 30 seconds. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 return GESTURE_OMNIBOX_SCROLL; | 297 return GESTURE_OMNIBOX_SCROLL; |
| 300 if (event.type() == ui::ET_GESTURE_PINCH_BEGIN) | 298 if (event.type() == ui::ET_GESTURE_PINCH_BEGIN) |
| 301 return GESTURE_OMNIBOX_PINCH; | 299 return GESTURE_OMNIBOX_PINCH; |
| 302 return GESTURE_UNKNOWN; | 300 return GESTURE_UNKNOWN; |
| 303 } | 301 } |
| 304 | 302 |
| 305 return GESTURE_UNKNOWN; | 303 return GESTURE_UNKNOWN; |
| 306 } | 304 } |
| 307 | 305 |
| 308 } // namespace ash | 306 } // namespace ash |
| OLD | NEW |