| 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.h" | 5 #include "ui/events/event.h" | 
| 6 | 6 | 
| 7 #include <utility> | 7 #include <utility> | 
| 8 | 8 | 
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" | 
| 10 | 10 | 
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 142     case ET_GESTURE_PINCH_UPDATE: | 142     case ET_GESTURE_PINCH_UPDATE: | 
| 143     case ET_GESTURE_LONG_PRESS: | 143     case ET_GESTURE_LONG_PRESS: | 
| 144     case ET_GESTURE_LONG_TAP: | 144     case ET_GESTURE_LONG_TAP: | 
| 145     case ET_GESTURE_SWIPE: | 145     case ET_GESTURE_SWIPE: | 
| 146     case ET_GESTURE_SHOW_PRESS: | 146     case ET_GESTURE_SHOW_PRESS: | 
| 147     // Flings can be GestureEvents too. | 147     // Flings can be GestureEvents too. | 
| 148     case ET_SCROLL_FLING_START: | 148     case ET_SCROLL_FLING_START: | 
| 149     case ET_SCROLL_FLING_CANCEL: | 149     case ET_SCROLL_FLING_CANCEL: | 
| 150       return SourceEventType::UNKNOWN; | 150       return SourceEventType::UNKNOWN; | 
| 151 | 151 | 
|  | 152     case ui::ET_KEY_PRESSED: | 
|  | 153       return ui::SourceEventType::KEY_PRESS; | 
|  | 154 | 
| 152     case ET_MOUSE_PRESSED: | 155     case ET_MOUSE_PRESSED: | 
| 153     case ET_MOUSE_DRAGGED: | 156     case ET_MOUSE_DRAGGED: | 
| 154     case ET_MOUSE_RELEASED: | 157     case ET_MOUSE_RELEASED: | 
| 155     case ET_MOUSE_MOVED: | 158     case ET_MOUSE_MOVED: | 
| 156     case ET_MOUSE_ENTERED: | 159     case ET_MOUSE_ENTERED: | 
| 157     case ET_MOUSE_EXITED: | 160     case ET_MOUSE_EXITED: | 
| 158     case ET_KEY_PRESSED: | 161     // We measure latency for key presses, not key releases. Most behavior is | 
|  | 162     // keyed off of presses, and release latency is higher than press latency as | 
|  | 163     // it's impacted by event handling of the press event. | 
| 159     case ET_KEY_RELEASED: | 164     case ET_KEY_RELEASED: | 
| 160     case ET_MOUSE_CAPTURE_CHANGED: | 165     case ET_MOUSE_CAPTURE_CHANGED: | 
| 161     case ET_DROP_TARGET_EVENT: | 166     case ET_DROP_TARGET_EVENT: | 
| 162     case ET_CANCEL_MODE: | 167     case ET_CANCEL_MODE: | 
| 163     case ET_UMA_DATA: | 168     case ET_UMA_DATA: | 
| 164       return SourceEventType::OTHER; | 169       return SourceEventType::OTHER; | 
| 165 | 170 | 
| 166     case ET_TOUCH_RELEASED: | 171     case ET_TOUCH_RELEASED: | 
| 167     case ET_TOUCH_PRESSED: | 172     case ET_TOUCH_PRESSED: | 
| 168     case ET_TOUCH_MOVED: | 173     case ET_TOUCH_MOVED: | 
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1134 } | 1139 } | 
| 1135 | 1140 | 
| 1136 KeyEvent::KeyEvent(const base::NativeEvent& native_event) | 1141 KeyEvent::KeyEvent(const base::NativeEvent& native_event) | 
| 1137     : KeyEvent(native_event, EventFlagsFromNative(native_event)) {} | 1142     : KeyEvent(native_event, EventFlagsFromNative(native_event)) {} | 
| 1138 | 1143 | 
| 1139 KeyEvent::KeyEvent(const base::NativeEvent& native_event, int event_flags) | 1144 KeyEvent::KeyEvent(const base::NativeEvent& native_event, int event_flags) | 
| 1140     : Event(native_event, EventTypeFromNative(native_event), event_flags), | 1145     : Event(native_event, EventTypeFromNative(native_event), event_flags), | 
| 1141       key_code_(KeyboardCodeFromNative(native_event)), | 1146       key_code_(KeyboardCodeFromNative(native_event)), | 
| 1142       code_(CodeFromNative(native_event)), | 1147       code_(CodeFromNative(native_event)), | 
| 1143       is_char_(IsCharFromNative(native_event)) { | 1148       is_char_(IsCharFromNative(native_event)) { | 
|  | 1149   latency()->AddLatencyNumberWithTimestamp( | 
|  | 1150       INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, | 
|  | 1151       base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); | 
|  | 1152   latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 
|  | 1153 | 
| 1144   if (IsRepeated(*this)) | 1154   if (IsRepeated(*this)) | 
| 1145     set_flags(flags() | ui::EF_IS_REPEAT); | 1155     set_flags(flags() | ui::EF_IS_REPEAT); | 
| 1146 | 1156 | 
| 1147 #if defined(USE_X11) | 1157 #if defined(USE_X11) | 
| 1148   NormalizeFlags(); | 1158   NormalizeFlags(); | 
| 1149 #endif | 1159 #endif | 
| 1150 #if defined(OS_WIN) | 1160 #if defined(OS_WIN) | 
| 1151   // Only Windows has native character events. | 1161   // Only Windows has native character events. | 
| 1152   if (is_char_) | 1162   if (is_char_) | 
| 1153     key_ = DomKey::FromCharacter(native_event.wParam); | 1163     key_ = DomKey::FromCharacter(native_event.wParam); | 
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1446                    flags | EF_FROM_TOUCH), | 1456                    flags | EF_FROM_TOUCH), | 
| 1447       details_(details), | 1457       details_(details), | 
| 1448       unique_touch_event_id_(unique_touch_event_id) { | 1458       unique_touch_event_id_(unique_touch_event_id) { | 
| 1449   latency()->set_source_event_type(ui::SourceEventType::TOUCH); | 1459   latency()->set_source_event_type(ui::SourceEventType::TOUCH); | 
| 1450 } | 1460 } | 
| 1451 | 1461 | 
| 1452 GestureEvent::~GestureEvent() { | 1462 GestureEvent::~GestureEvent() { | 
| 1453 } | 1463 } | 
| 1454 | 1464 | 
| 1455 }  // namespace ui | 1465 }  // namespace ui | 
| OLD | NEW | 
|---|