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 "ui/events/event_utils.h" | 5 #include "ui/events/event_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "ui/display/display.h" | 10 #include "ui/display/display.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 default: | 54 default: |
55 break; | 55 break; |
56 } | 56 } |
57 return event; | 57 return event; |
58 } | 58 } |
59 | 59 |
60 int RegisterCustomEventType() { | 60 int RegisterCustomEventType() { |
61 return ++g_custom_event_types; | 61 return ++g_custom_event_types; |
62 } | 62 } |
63 | 63 |
| 64 const ui::LocatedEvent* ToLocatedEventOrNull(const ui::Event* event) { |
| 65 return event && event->IsLocatedEvent() ? event->AsLocatedEvent() : nullptr; |
| 66 } |
| 67 |
64 base::TimeTicks EventTimeForNow() { | 68 base::TimeTicks EventTimeForNow() { |
65 return base::TimeTicks::Now(); | 69 return base::TimeTicks::Now(); |
66 } | 70 } |
67 | 71 |
68 bool ShouldDefaultToNaturalScroll() { | 72 bool ShouldDefaultToNaturalScroll() { |
69 return GetInternalDisplayTouchSupport() == | 73 return GetInternalDisplayTouchSupport() == |
70 display::Display::TOUCH_SUPPORT_AVAILABLE; | 74 display::Display::TOUCH_SUPPORT_AVAILABLE; |
71 } | 75 } |
72 | 76 |
73 display::Display::TouchSupport GetInternalDisplayTouchSupport() { | 77 display::Display::TouchSupport GetInternalDisplayTouchSupport() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 case ET_TOUCH_RELEASED: | 110 case ET_TOUCH_RELEASED: |
107 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 111 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
108 delta.InMicroseconds(), 1, 1000000, 50); | 112 delta.InMicroseconds(), 1, 1000000, 50); |
109 return; | 113 return; |
110 default: | 114 default: |
111 return; | 115 return; |
112 } | 116 } |
113 } | 117 } |
114 | 118 |
115 } // namespace ui | 119 } // namespace ui |
OLD | NEW |