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

Unified Diff: chrome/renderer/gesture_manager.h

Issue 3388013: Forward touch events to a RenderWidget's associated WebWidget (Closed)
Patch Set: removed commented-out include Created 10 years, 3 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: chrome/renderer/gesture_manager.h
diff --git a/chrome/renderer/gesture_manager.h b/chrome/renderer/gesture_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..eb8256bd9c5b763454b4f4a6718789a284638242
--- /dev/null
+++ b/chrome/renderer/gesture_manager.h
@@ -0,0 +1,84 @@
+// Copyright (c) 2010 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 CHROME_RENDERER_GESTURE_MANAGER_H_
+#define CHROME_RENDERER_GESTURE_MANAGER_H_
+#pragma once
+
+#include "base/singleton.h"
+
+#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
+
+class RenderWidget;
+
+namespace WebKit {
+class WebTouchEvent;
+class WebTouchPoint;
+}
+
+// A GestureManager singleton detects gestures occurring in the
+// incoming feed of touch events in the Renderer. In response to
+// a given touch event, the GestureManager, updates its internal state
+// and optionally dispatches synthetic events to the invoking
+// RenderWidget.
+//
+// This GestureManager is a singleton in the renderer process and differs
+// from the GestureManager found in the browser process.
+// A subsequent CL will unify these and provide more complete
+// functionality.
+class GestureManager /* : public AbstractGestureManager */ {
+ public:
+ // The states of the gesture manager state machine.
+ enum SyntheticCandidateGesture {
+ NO_GESTURE,
+ PENDING_SYNTHETIC_CLICK,
+ SCROLL,
+ };
+
+ virtual ~GestureManager();
+ static GestureManager* Get();
+
+ // Invoked for each touch event that could contribute to the current gesture.
+ // Takes the event and the RenderWidget that originated it and which will also
+ // be the target of any generated synthetic event. Finally, previously_handled
+ // specifies if the event was actually handled explicitly by a WebWidget.
+ // Returns true if the event resulted in firing a synthetic event.
+ virtual bool ProcessTouchEventForGesture(const WebKit::WebTouchEvent& event,
+ RenderWidget* source,
+ bool previously_handled);
+
+ protected:
+ GestureManager();
+
+ private:
+ // Dispatch a mouseDown/mouseUp/Click sequence.
+ void DispatchSyntheticClick(RenderWidget* w,
+ const WebKit::WebTouchEvent& event,
+ const WebKit::WebTouchPoint& p);
+
+ // True for a time within the click interval.
+ bool IsInClickTimeWindow(double ts);
+
+ // True for a point p still inside the thresholded square.
+ bool IsInsideManhattanSquare(const WebKit::WebTouchPoint& p);
+
+ // Scroll the screen.
+ void ScrollViaTouchMotion(const WebKit::WebTouchPoint& p, RenderWidget* w);
+
+ friend struct DefaultSingletonTraits<GestureManager>;
+
+ // The synthetic candidate gesture to fire at the end of a touch event
+ // sequence.
+ SyntheticCandidateGesture candidate_gesture_;
+
+ // Location of first touch.
+ WebKit::WebPoint first_touch_position_;
+
+ // Time of first touch.
+ double first_touch_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(GestureManager);
+};
+
+#endif // CHROME_RENDERER_GESTURE_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698