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

Unified Diff: content/browser/renderer_host/render_widget_host_view_win.h

Issue 10365009: Adding Gesture Recognition to RenderWidgetHostViewWin (web client) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge cleanup. (Implementing four new virtuals added in the base.) Created 8 years, 7 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 | « no previous file | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_win.h
diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h
index 555683da039b1e72da8840670092a55c9220154d..9e96a3f48e3de77c0fdd9664465ad081f7b207f9 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.h
+++ b/content/browser/renderer_host/render_widget_host_view_win.h
@@ -24,6 +24,8 @@
#include "content/common/content_export.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "ui/base/gestures/gesture_recognizer.h"
+#include "ui/base/gestures/gesture_types.h"
#include "ui/base/win/ime_input.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/point.h"
@@ -32,6 +34,7 @@
class BackingStore;
class SkRegion;
+class WebTouchState;
namespace content {
class RenderWidgetHost;
@@ -92,7 +95,9 @@ class RenderWidgetHostViewWin
RenderWidgetHostHWNDTraits>,
public content::RenderWidgetHostViewBase,
public content::NotificationObserver,
- public BrowserAccessibilityDelegate {
+ public BrowserAccessibilityDelegate,
+ public ui::GestureConsumer,
+ public ui::GestureEventHelper {
public:
virtual ~RenderWidgetHostViewWin();
@@ -240,6 +245,23 @@ class RenderWidgetHostViewWin
virtual void AccessibilitySetTextSelection(
int acc_obj_id, int start_offset, int end_offset) OVERRIDE;
+ // Overridden from ui::GestureEventHelper.
+ virtual ui::GestureEvent* CreateGestureEvent(
+ ui::EventType type,
+ const gfx::Point& location,
+ int flags,
+ base::Time time,
+ float param_first,
+ float param_second,
+ unsigned int touch_id_bitfield) OVERRIDE;
+ virtual ui::TouchEvent* CreateTouchEvent(
+ ui::EventType type,
+ const gfx::Point& location,
+ int touch_id,
+ base::TimeDelta time_stamp) OVERRIDE;
+ virtual bool DispatchLongPressGestureEvent(ui::GestureEvent* event) OVERRIDE;
+ virtual bool DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE;
+
protected:
friend class content::RenderWidgetHostView;
@@ -325,13 +347,20 @@ class RenderWidgetHostViewWin
// becomes hidden, this method is called to reset the tooltip.
void ResetTooltip();
+ // Builds and forwards a WebKitGestureEvent to the renderer.
+ bool ForwardGestureEventToRenderer(
+ ui::GestureEvent* gesture);
+
+ // Process all of the given gestures (passes them on to renderer)
+ void ProcessGestures(ui::GestureRecognizer::Gestures* gestures);
+
// Sends the specified mouse event to the renderer.
void ForwardMouseEventToRenderer(UINT message, WPARAM wparam, LPARAM lparam);
- // Synthesize mouse wheel event.
- LRESULT SynthesizeMouseWheel(bool is_vertical, int scroll_code,
- short scroll_position);
-
+ // Synthesize mouse wheel event.
+ LRESULT SynthesizeMouseWheel(bool is_vertical, int scroll_code,
+ short scroll_position);
+
// Shuts down the render_widget_host_. This is a separate function so we can
// invoke it from the message loop.
void ShutdownHost();
@@ -425,42 +454,10 @@ class RenderWidgetHostViewWin
// true if the View is not visible.
bool is_hidden_;
- // Wrapper for maintaining touchstate associated with a WebTouchEvent.
- class WebTouchState {
- public:
- explicit WebTouchState(const CWindowImpl* window);
-
- // Updates the current touchpoint state with the supplied touches.
- // Touches will be consumed only if they are of the same type (e.g. down,
- // up, move). Returns the number of consumed touches.
- size_t UpdateTouchPoints(TOUCHINPUT* points, size_t count);
-
- // Marks all active touchpoints as released.
- bool ReleaseTouchPoints();
-
- // The contained WebTouchEvent.
- const WebKit::WebTouchEvent& touch_event() { return touch_event_; }
-
- // Returns if any touches are modified in the event.
- bool is_changed() { return touch_event_.changedTouchesLength != 0; }
-
- private:
- // Adds a touch point or returns NULL if there's not enough space.
- WebKit::WebTouchPoint* AddTouchPoint(TOUCHINPUT* touch_input);
-
- // Copy details from a TOUCHINPUT to an existing WebTouchPoint, returning
- // true if the resulting point is a stationary move.
- bool UpdateTouchPoint(WebKit::WebTouchPoint* touch_point,
- TOUCHINPUT* touch_input);
-
- WebKit::WebTouchEvent touch_event_;
- const CWindowImpl* const window_;
- };
-
// The touch-state. Its touch-points are updated as necessary. A new
// touch-point is added from an TOUCHEVENTF_DOWN message, and a touch-point
// is removed from the list on an TOUCHEVENTF_UP message.
- WebTouchState touch_state_;
+ scoped_ptr<WebTouchState> touch_state_;
// True if we're in the midst of a paint operation and should respond to
// DidPaintRect() notifications by merely invalidating. See comments on
@@ -567,6 +564,8 @@ class RenderWidgetHostViewWin
// Are touch events currently enabled?
bool touch_events_enabled_;
+ scoped_ptr<ui::GestureRecognizer> gesture_recognizer_;
+
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin);
};
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698