| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 root_location_ = location_; | 451 root_location_ = location_; |
| 452 } | 452 } |
| 453 | 453 |
| 454 //////////////////////////////////////////////////////////////////////////////// | 454 //////////////////////////////////////////////////////////////////////////////// |
| 455 // MouseEvent | 455 // MouseEvent |
| 456 | 456 |
| 457 MouseEvent::MouseEvent(const base::NativeEvent& native_event) | 457 MouseEvent::MouseEvent(const base::NativeEvent& native_event) |
| 458 : LocatedEvent(native_event), | 458 : LocatedEvent(native_event), |
| 459 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), | 459 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), |
| 460 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { | 460 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { |
| 461 latency()->AddLatencyNumberWithTimestamp( |
| 462 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, |
| 463 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); |
| 464 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 461 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) | 465 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) |
| 462 SetClickCount(GetRepeatCount(*this)); | 466 SetClickCount(GetRepeatCount(*this)); |
| 463 } | 467 } |
| 464 | 468 |
| 465 MouseEvent::MouseEvent(const PointerEvent& pointer_event) | 469 MouseEvent::MouseEvent(const PointerEvent& pointer_event) |
| 466 : LocatedEvent(pointer_event), | 470 : LocatedEvent(pointer_event), |
| 467 pointer_details_(pointer_event.pointer_details()) { | 471 pointer_details_(pointer_event.pointer_details()) { |
| 468 DCHECK(pointer_event.IsMousePointerEvent()); | 472 DCHECK(pointer_event.IsMousePointerEvent()); |
| 469 switch (pointer_event.type()) { | 473 switch (pointer_event.type()) { |
| 470 case ET_POINTER_DOWN: | 474 case ET_POINTER_DOWN: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 base::TimeDelta time_stamp, | 508 base::TimeDelta time_stamp, |
| 505 int flags, | 509 int flags, |
| 506 int changed_button_flags) | 510 int changed_button_flags) |
| 507 : LocatedEvent(type, | 511 : LocatedEvent(type, |
| 508 gfx::PointF(location), | 512 gfx::PointF(location), |
| 509 gfx::PointF(root_location), | 513 gfx::PointF(root_location), |
| 510 time_stamp, | 514 time_stamp, |
| 511 flags), | 515 flags), |
| 512 changed_button_flags_(changed_button_flags), | 516 changed_button_flags_(changed_button_flags), |
| 513 pointer_details_(PointerDetails(EventPointerType::POINTER_TYPE_MOUSE)) { | 517 pointer_details_(PointerDetails(EventPointerType::POINTER_TYPE_MOUSE)) { |
| 518 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 514 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) | 519 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) |
| 515 SetType(ET_MOUSE_DRAGGED); | 520 SetType(ET_MOUSE_DRAGGED); |
| 516 } | 521 } |
| 517 | 522 |
| 518 // static | 523 // static |
| 519 bool MouseEvent::IsRepeatedClickEvent( | 524 bool MouseEvent::IsRepeatedClickEvent( |
| 520 const MouseEvent& event1, | 525 const MouseEvent& event1, |
| 521 const MouseEvent& event2) { | 526 const MouseEvent& event2) { |
| 522 // These values match the Windows defaults. | 527 // These values match the Windows defaults. |
| 523 static const int kDoubleClickTimeMS = 500; | 528 static const int kDoubleClickTimeMS = 500; |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 gfx::PointF(x, y), | 1287 gfx::PointF(x, y), |
| 1283 time_stamp, | 1288 time_stamp, |
| 1284 flags | EF_FROM_TOUCH), | 1289 flags | EF_FROM_TOUCH), |
| 1285 details_(details) { | 1290 details_(details) { |
| 1286 } | 1291 } |
| 1287 | 1292 |
| 1288 GestureEvent::~GestureEvent() { | 1293 GestureEvent::~GestureEvent() { |
| 1289 } | 1294 } |
| 1290 | 1295 |
| 1291 } // namespace ui | 1296 } // namespace ui |
| OLD | NEW |