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

Unified Diff: content/browser/renderer_host/input/gesture_event_packet.h

Issue 120513005: [Android] Perform eager gesture recognition on MotionEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More testing Created 6 years, 11 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
Index: content/browser/renderer_host/input/gesture_event_packet.h
diff --git a/content/browser/renderer_host/input/gesture_event_packet.h b/content/browser/renderer_host/input/gesture_event_packet.h
new file mode 100644
index 0000000000000000000000000000000000000000..c600791a74cbd06f6a222114ef07b70232274395
--- /dev/null
+++ b/content/browser/renderer_host/input/gesture_event_packet.h
@@ -0,0 +1,49 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_
+
+#include "content/common/content_export.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
+
+namespace content {
+
+// Acts as a transport container for gestures created (directly or indirectly)
+// by a touch event.
+class CONTENT_EXPORT GestureEventPacket {
+ public:
+ enum GestureSource {
+ INVALID = -1, // Used only for a default-constructed packet..
+ TOUCH_BEGIN, // The start of a new gesture sequence.
+ TOUCH, // Continuation of an existing gesture sequence.
+ TOUCH_TIMEOUT, // Timeout from an existing gesture sequence.
+ };
+
+ GestureEventPacket();
+ ~GestureEventPacket();
+
+ // Factory methods for creating a packet from a particular event.
+ static GestureEventPacket FromTouch(const blink::WebTouchEvent& event);
+ static GestureEventPacket FromTouchTimeout(
+ const blink::WebGestureEvent& event);
+
+ void Push(const blink::WebGestureEvent& gesture);
+
+ const blink::WebGestureEvent& gesture(size_t i) const { return gestures_[i]; }
+ size_t gesture_count() const { return gesture_count_; }
+ GestureSource gesture_source() const { return gesture_source_; }
+
+private:
+ explicit GestureEventPacket(GestureSource source);
+
+ enum { kMaxGesturesPerTouch = 5 };
+ blink::WebGestureEvent gestures_[kMaxGesturesPerTouch];
+ size_t gesture_count_;
+ GestureSource gesture_source_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_
« no previous file with comments | « content/browser/android/content_view_core_impl.cc ('k') | content/browser/renderer_host/input/gesture_event_packet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698