| 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/wm_shell.h" | 7 #include "ash/shell_port.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| 11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 12 #include "ui/aura/window_event_dispatcher.h" | 12 #include "ui/aura/window_event_dispatcher.h" |
| 13 #include "ui/base/class_property.h" | 13 #include "ui/base/class_property.h" |
| 14 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
| 15 #include "ui/events/event_utils.h" | 15 #include "ui/events/event_utils.h" |
| 16 #include "ui/gfx/geometry/point_conversions.h" | 16 #include "ui/gfx/geometry/point_conversions.h" |
| 17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 position.set_y(std::min(bounds.height() - 1, std::max(0, position.y()))); | 106 position.set_y(std::min(bounds.height() - 1, std::max(0, position.y()))); |
| 107 | 107 |
| 108 UMA_HISTOGRAM_CUSTOM_COUNTS( | 108 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 109 "Ash.TouchPositionX", position.x() / bucket_size_x, 1, | 109 "Ash.TouchPositionX", position.x() / bucket_size_x, 1, |
| 110 kBucketCountForLocation, kBucketCountForLocation + 1); | 110 kBucketCountForLocation, kBucketCountForLocation + 1); |
| 111 UMA_HISTOGRAM_CUSTOM_COUNTS( | 111 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 112 "Ash.TouchPositionY", position.y() / bucket_size_y, 1, | 112 "Ash.TouchPositionY", position.y() / bucket_size_y, 1, |
| 113 kBucketCountForLocation, kBucketCountForLocation + 1); | 113 kBucketCountForLocation, kBucketCountForLocation + 1); |
| 114 | 114 |
| 115 if (event.type() == ui::ET_TOUCH_PRESSED) { | 115 if (event.type() == ui::ET_TOUCH_PRESSED) { |
| 116 WmShell::Get()->RecordUserMetricsAction(UMA_TOUCHSCREEN_TAP_DOWN); | 116 ShellPort::Get()->RecordUserMetricsAction(UMA_TOUCHSCREEN_TAP_DOWN); |
| 117 | 117 |
| 118 if (details->last_release_time_.ToInternalValue()) { | 118 if (details->last_release_time_.ToInternalValue()) { |
| 119 // Measuring the interval between a touch-release and the next | 119 // Measuring the interval between a touch-release and the next |
| 120 // touch-start is probably less useful when doing multi-touch (e.g. | 120 // touch-start is probably less useful when doing multi-touch (e.g. |
| 121 // gestures, or multi-touch friendly apps). So count this only if the user | 121 // gestures, or multi-touch friendly apps). So count this only if the user |
| 122 // hasn't done any multi-touch during the last 30 seconds. | 122 // hasn't done any multi-touch during the last 30 seconds. |
| 123 base::TimeDelta diff = event.time_stamp() - details->last_mt_time_; | 123 base::TimeDelta diff = event.time_stamp() - details->last_mt_time_; |
| 124 if (diff.InSeconds() > 30) { | 124 if (diff.InSeconds() > 30) { |
| 125 base::TimeDelta gap = event.time_stamp() - details->last_release_time_; | 125 base::TimeDelta gap = event.time_stamp() - details->last_release_time_; |
| 126 UMA_HISTOGRAM_COUNTS_10000("Ash.TouchStartAfterEnd", | 126 UMA_HISTOGRAM_COUNTS_10000("Ash.TouchStartAfterEnd", |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return GESTURE_OMNIBOX_SCROLL; | 206 return GESTURE_OMNIBOX_SCROLL; |
| 207 if (event.type() == ui::ET_GESTURE_PINCH_BEGIN) | 207 if (event.type() == ui::ET_GESTURE_PINCH_BEGIN) |
| 208 return GESTURE_OMNIBOX_PINCH; | 208 return GESTURE_OMNIBOX_PINCH; |
| 209 return GESTURE_UNKNOWN; | 209 return GESTURE_UNKNOWN; |
| 210 } | 210 } |
| 211 | 211 |
| 212 return GESTURE_UNKNOWN; | 212 return GESTURE_UNKNOWN; |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace ash | 215 } // namespace ash |
| OLD | NEW |