1 // Copyright 2014 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.
5 #ifndef UI_EVENTS_GESTURES_BLINK_WEB_GESTURE_CURVE_IMPL_H_
6 #define UI_EVENTS_GESTURES_BLINK_WEB_GESTURE_CURVE_IMPL_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "third_party/WebKit/public/platform/WebGestureCurve.h"
11 #include "ui/gfx/geometry/vector2d_f.h"
14 class WebGestureCurveTarget
;
20 class WebGestureCurveImpl
: public NON_EXPORTED_BASE(blink::WebGestureCurve
) {
22 static scoped_ptr
<blink::WebGestureCurve
> CreateFromDefaultPlatformCurve(
23 const gfx::Vector2dF
& initial_velocity
,
24 const gfx::Vector2dF
& initial_offset
,
26 static scoped_ptr
<blink::WebGestureCurve
> CreateFromUICurveForTesting(
27 scoped_ptr
<GestureCurve
> curve
,
28 const gfx::Vector2dF
& initial_offset
);
30 virtual ~WebGestureCurveImpl();
32 // WebGestureCurve implementation.
33 virtual bool apply(double time
,
34 blink::WebGestureCurveTarget
* target
) override
;
37 enum class ThreadType
{
43 WebGestureCurveImpl(scoped_ptr
<GestureCurve
> curve
,
44 const gfx::Vector2dF
& initial_offset
,
45 ThreadType animating_thread_type
);
47 scoped_ptr
<GestureCurve
> curve_
;
49 gfx::Vector2dF last_offset_
;
51 ThreadType animating_thread_type_
;
52 int64 ticks_since_first_animate_
;
53 double first_animate_time_
;
54 double last_animate_time_
;
56 DISALLOW_COPY_AND_ASSIGN(WebGestureCurveImpl
);
61 #endif // UI_EVENTS_GESTURES_BLINK_WEB_GESTURE_CURVE_IMPL_H_