| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 root_location_ = location_; | 450 root_location_ = location_; |
| 451 } | 451 } |
| 452 | 452 |
| 453 //////////////////////////////////////////////////////////////////////////////// | 453 //////////////////////////////////////////////////////////////////////////////// |
| 454 // MouseEvent | 454 // MouseEvent |
| 455 | 455 |
| 456 MouseEvent::MouseEvent(const base::NativeEvent& native_event) | 456 MouseEvent::MouseEvent(const base::NativeEvent& native_event) |
| 457 : LocatedEvent(native_event), | 457 : LocatedEvent(native_event), |
| 458 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), | 458 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), |
| 459 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { | 459 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { |
| 460 latency()->AddLatencyNumberWithTimestamp( |
| 461 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, |
| 462 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); |
| 463 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 460 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) | 464 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) |
| 461 SetClickCount(GetRepeatCount(*this)); | 465 SetClickCount(GetRepeatCount(*this)); |
| 462 } | 466 } |
| 463 | 467 |
| 464 MouseEvent::MouseEvent(EventType type, | 468 MouseEvent::MouseEvent(EventType type, |
| 465 const gfx::Point& location, | 469 const gfx::Point& location, |
| 466 const gfx::Point& root_location, | 470 const gfx::Point& root_location, |
| 467 base::TimeDelta time_stamp, | 471 base::TimeDelta time_stamp, |
| 468 int flags, | 472 int flags, |
| 469 int changed_button_flags) | 473 int changed_button_flags) |
| 470 : LocatedEvent(type, | 474 : LocatedEvent(type, |
| 471 gfx::PointF(location), | 475 gfx::PointF(location), |
| 472 gfx::PointF(root_location), | 476 gfx::PointF(root_location), |
| 473 time_stamp, | 477 time_stamp, |
| 474 flags), | 478 flags), |
| 475 changed_button_flags_(changed_button_flags), | 479 changed_button_flags_(changed_button_flags), |
| 476 pointer_details_(PointerDetails(EventPointerType::POINTER_TYPE_MOUSE)) { | 480 pointer_details_(PointerDetails(EventPointerType::POINTER_TYPE_MOUSE)) { |
| 481 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 477 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) | 482 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) |
| 478 SetType(ET_MOUSE_DRAGGED); | 483 SetType(ET_MOUSE_DRAGGED); |
| 479 } | 484 } |
| 480 | 485 |
| 481 // static | 486 // static |
| 482 bool MouseEvent::IsRepeatedClickEvent( | 487 bool MouseEvent::IsRepeatedClickEvent( |
| 483 const MouseEvent& event1, | 488 const MouseEvent& event1, |
| 484 const MouseEvent& event2) { | 489 const MouseEvent& event2) { |
| 485 // These values match the Windows defaults. | 490 // These values match the Windows defaults. |
| 486 static const int kDoubleClickTimeMS = 500; | 491 static const int kDoubleClickTimeMS = 500; |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 gfx::PointF(x, y), | 1219 gfx::PointF(x, y), |
| 1215 time_stamp, | 1220 time_stamp, |
| 1216 flags | EF_FROM_TOUCH), | 1221 flags | EF_FROM_TOUCH), |
| 1217 details_(details) { | 1222 details_(details) { |
| 1218 } | 1223 } |
| 1219 | 1224 |
| 1220 GestureEvent::~GestureEvent() { | 1225 GestureEvent::~GestureEvent() { |
| 1221 } | 1226 } |
| 1222 | 1227 |
| 1223 } // namespace ui | 1228 } // namespace ui |
| OLD | NEW |