Chromium Code Reviews| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 AsPointerEvent()->pointer_details().pointer_type == | 281 AsPointerEvent()->pointer_details().pointer_type == |
| 282 EventPointerType::POINTER_TYPE_MOUSE; | 282 EventPointerType::POINTER_TYPE_MOUSE; |
| 283 } | 283 } |
| 284 | 284 |
| 285 bool Event::IsTouchPointerEvent() const { | 285 bool Event::IsTouchPointerEvent() const { |
| 286 return IsPointerEvent() && | 286 return IsPointerEvent() && |
| 287 AsPointerEvent()->pointer_details().pointer_type == | 287 AsPointerEvent()->pointer_details().pointer_type == |
| 288 EventPointerType::POINTER_TYPE_TOUCH; | 288 EventPointerType::POINTER_TYPE_TOUCH; |
| 289 } | 289 } |
| 290 | 290 |
| 291 CancelModeEvent* Event::AsCancelModeEvent() { | |
|
rjkroege
2016/10/03 22:58:40
I know that you're (rightly) following the pattern
sadrul
2016/10/04 00:35:04
+1
kylix_rd
2016/10/04 14:12:20
Certainly. I can simply move the method bodies to
| |
| 292 CHECK(IsCancelModeEvent()); | |
| 293 return static_cast<CancelModeEvent*>(this); | |
| 294 } | |
| 295 | |
| 296 const CancelModeEvent* Event::AsCancelModeEvent() const { | |
| 297 CHECK(IsCancelModeEvent()); | |
| 298 return static_cast<const CancelModeEvent*>(this); | |
| 299 } | |
| 300 | |
| 291 GestureEvent* Event::AsGestureEvent() { | 301 GestureEvent* Event::AsGestureEvent() { |
| 292 CHECK(IsGestureEvent()); | 302 CHECK(IsGestureEvent()); |
| 293 return static_cast<GestureEvent*>(this); | 303 return static_cast<GestureEvent*>(this); |
| 294 } | 304 } |
| 295 | 305 |
| 296 const GestureEvent* Event::AsGestureEvent() const { | 306 const GestureEvent* Event::AsGestureEvent() const { |
| 297 CHECK(IsGestureEvent()); | 307 CHECK(IsGestureEvent()); |
| 298 return static_cast<const GestureEvent*>(this); | 308 return static_cast<const GestureEvent*>(this); |
| 299 } | 309 } |
| 300 | 310 |
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1416 flags | EF_FROM_TOUCH), | 1426 flags | EF_FROM_TOUCH), |
| 1417 details_(details), | 1427 details_(details), |
| 1418 unique_touch_event_id_(unique_touch_event_id) { | 1428 unique_touch_event_id_(unique_touch_event_id) { |
| 1419 latency()->set_source_event_type(ui::SourceEventType::TOUCH); | 1429 latency()->set_source_event_type(ui::SourceEventType::TOUCH); |
| 1420 } | 1430 } |
| 1421 | 1431 |
| 1422 GestureEvent::~GestureEvent() { | 1432 GestureEvent::~GestureEvent() { |
| 1423 } | 1433 } |
| 1424 | 1434 |
| 1425 } // namespace ui | 1435 } // namespace ui |
| OLD | NEW |