Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ui / events / gestures / blink / web_gesture_curve_impl.h
blobfeb17383c587fee98497c36e470039eed6999d13
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"
13 namespace blink {
14 class WebGestureCurveTarget;
17 namespace ui {
18 class GestureCurve;
20 class WebGestureCurveImpl : public NON_EXPORTED_BASE(blink::WebGestureCurve) {
21 public:
22 static scoped_ptr<blink::WebGestureCurve> CreateFromDefaultPlatformCurve(
23 const gfx::Vector2dF& initial_velocity,
24 const gfx::Vector2dF& initial_offset,
25 bool on_main_thread);
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;
36 private:
37 enum class ThreadType {
38 MAIN,
39 IMPL,
40 TEST
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);
59 } // namespace ui
61 #endif // UI_EVENTS_GESTURES_BLINK_WEB_GESTURE_CURVE_IMPL_H_