• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_TARGET_BASE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_TARGET_BASE_H_
7 
8 #include "base/time/time.h"
9 #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
10 
11 namespace ui {
12 struct LatencyInfo;
13 }
14 
15 namespace blink {
16 class WebTouchEvent;
17 class WebMouseEvent;
18 class WebMouseWheelEvent;
19 }
20 
21 namespace content {
22 
23 class RenderWidgetHostImpl;
24 
25 class SyntheticGestureTargetBase : public SyntheticGestureTarget {
26  public:
27   explicit SyntheticGestureTargetBase(RenderWidgetHostImpl* host);
28   virtual ~SyntheticGestureTargetBase();
29 
30   virtual void DispatchWebTouchEventToPlatform(
31       const blink::WebTouchEvent& web_touch,
32       const ui::LatencyInfo& latency_info);
33 
34   virtual void DispatchWebMouseWheelEventToPlatform(
35       const blink::WebMouseWheelEvent& web_wheel,
36       const ui::LatencyInfo& latency_info);
37 
38   virtual void DispatchWebMouseEventToPlatform(
39       const blink::WebMouseEvent& web_mouse,
40       const ui::LatencyInfo& latency_info);
41 
42   // SyntheticGestureTarget:
43   virtual void DispatchInputEventToPlatform(
44     const blink::WebInputEvent& event) OVERRIDE;
45 
46   virtual void SetNeedsFlush() OVERRIDE;
47 
48   virtual SyntheticGestureParams::GestureSourceType
49       GetDefaultSyntheticGestureSourceType() const OVERRIDE;
50 
51   virtual base::TimeDelta PointerAssumedStoppedTime() const OVERRIDE;
52 
53   virtual float GetTouchSlopInDips() const OVERRIDE;
54 
55   virtual float GetMinScalingSpanInDips() const OVERRIDE;
56 
57  protected:
render_widget_host()58   RenderWidgetHostImpl* render_widget_host() const { return host_; }
59 
60  private:
61   bool PointIsWithinContents(int x, int y) const;
62 
63   RenderWidgetHostImpl* host_;
64 
65   DISALLOW_COPY_AND_ASSIGN(SyntheticGestureTargetBase);
66 };
67 
68 }  // namespace content
69 
70 #endif  // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_TARGET_BASE_H_
71