Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1360)

Unified Diff: ui/base/gestures/gesture_recognizer_impl.cc

Issue 10831240: Remove TouchEvent interface, and rename TouchEventImpl to TouchEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge-tot Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/gestures/gesture_point.cc ('k') | ui/base/gestures/gesture_sequence.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/gestures/gesture_recognizer_impl.cc
diff --git a/ui/base/gestures/gesture_recognizer_impl.cc b/ui/base/gestures/gesture_recognizer_impl.cc
index 4c51f8d71fb8917c26b911ee460e46c55547aeb9..caa5054d95c0f34ea5980d2464d3775d2fe965a5 100644
--- a/ui/base/gestures/gesture_recognizer_impl.cc
+++ b/ui/base/gestures/gesture_recognizer_impl.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
+#include "ui/base/event.h"
#include "ui/base/events.h"
#include "ui/base/gestures/gesture_configuration.h"
#include "ui/base/gestures/gesture_sequence.h"
@@ -36,70 +37,20 @@ class ScopedPop {
class MirroredTouchEvent : public TouchEvent {
public:
explicit MirroredTouchEvent(const TouchEvent* real)
- : type_(real->GetEventType()),
- location_(real->GetLocation()),
- touch_id_(real->GetTouchId()),
- flags_(real->GetEventFlags()),
- timestamp_(real->GetTimestamp()),
- radius_x_(real->RadiusX()),
- radius_y_(real->RadiusY()),
- rotation_angle_(real->RotationAngle()),
- force_(real->Force()) {
+ : TouchEvent(real->type(),
+ real->location(),
+ real->touch_id(),
+ real->time_stamp()) {
+ set_flags(real->flags());
+ set_radius(real->radius_x(), real->radius_y());
+ set_rotation_angle(real->rotation_angle());
+ set_force(real->force());
}
virtual ~MirroredTouchEvent() {
}
- // Overridden from TouchEvent.
- virtual EventType GetEventType() const OVERRIDE {
- return type_;
- }
-
- virtual gfx::Point GetLocation() const OVERRIDE {
- return location_;
- }
-
- virtual int GetTouchId() const OVERRIDE {
- return touch_id_;
- }
-
- virtual int GetEventFlags() const OVERRIDE {
- return flags_;
- }
-
- virtual base::TimeDelta GetTimestamp() const OVERRIDE {
- return timestamp_;
- }
-
- virtual float RadiusX() const OVERRIDE {
- return radius_x_;
- }
-
- virtual float RadiusY() const OVERRIDE {
- return radius_y_;
- }
-
- virtual float RotationAngle() const OVERRIDE {
- return rotation_angle_;
- }
-
- virtual float Force() const OVERRIDE {
- return force_;
- }
-
- protected:
- void set_type(const EventType type) { type_ = type; }
-
private:
- EventType type_;
- gfx::Point location_;
- int touch_id_;
- int flags_;
- base::TimeDelta timestamp_;
- float radius_x_;
- float radius_y_;
- float rotation_angle_;
- float force_;
DISALLOW_COPY_AND_ASSIGN(MirroredTouchEvent);
};
@@ -178,7 +129,7 @@ GestureRecognizerImpl::~GestureRecognizerImpl() {
// Otherwise, returns NULL.
GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget(
TouchEvent* event) {
- return touch_id_target_[event->GetTouchId()];
+ return touch_id_target_[event->touch_id()];
}
GestureConsumer* GestureRecognizerImpl::GetTargetForGestureEvent(
@@ -282,13 +233,13 @@ GestureSequence::Gestures* GestureRecognizerImpl::ProcessTouchEventForGesture(
const TouchEvent& event,
ui::TouchStatus status,
GestureConsumer* target) {
- if (event.GetEventType() == ui::ET_TOUCH_RELEASED ||
- event.GetEventType() == ui::ET_TOUCH_CANCELLED) {
- touch_id_target_[event.GetTouchId()] = NULL;
+ if (event.type() == ui::ET_TOUCH_RELEASED ||
+ event.type() == ui::ET_TOUCH_CANCELLED) {
+ touch_id_target_[event.touch_id()] = NULL;
} else {
- touch_id_target_[event.GetTouchId()] = target;
+ touch_id_target_[event.touch_id()] = target;
if (target)
- touch_id_target_for_gestures_[event.GetTouchId()] = target;
+ touch_id_target_for_gestures_[event.touch_id()] = target;
}
GestureSequence* gesture_sequence = GetGestureSequenceForConsumer(target);
@@ -315,7 +266,7 @@ GestureSequence::Gestures* GestureRecognizerImpl::AdvanceTouchQueue(
GestureSequence* sequence = GetGestureSequenceForConsumer(consumer);
- if (processed && event->GetEventType() == ui::ET_TOUCH_RELEASED) {
+ if (processed && event->type() == ui::ET_TOUCH_RELEASED) {
// A touch release was was processed (e.g. preventDefault()ed by a
// web-page), but we still need to process a touch cancel.
CancelledTouchEvent cancelled(event);
« no previous file with comments | « ui/base/gestures/gesture_point.cc ('k') | ui/base/gestures/gesture_sequence.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698