OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_ | 5 #ifndef UI_EVENTS_GESTURES_BLINK_WEB_GESTURE_CURVE_IMPL_H_ |
6 #define CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_ | 6 #define UI_EVENTS_GESTURES_BLINK_WEB_GESTURE_CURVE_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/common/content_export.h" | |
11 #include "third_party/WebKit/public/platform/WebGestureCurve.h" | 10 #include "third_party/WebKit/public/platform/WebGestureCurve.h" |
12 #include "ui/gfx/geometry/vector2d_f.h" | 11 #include "ui/gfx/geometry/vector2d_f.h" |
13 | 12 |
14 namespace blink { | 13 namespace blink { |
15 class WebGestureCurveTarget; | 14 class WebGestureCurveTarget; |
16 } | 15 } |
17 | 16 |
18 namespace ui { | 17 namespace ui { |
19 class GestureCurve; | 18 class GestureCurve; |
20 } | |
21 | 19 |
22 namespace content { | 20 class WebGestureCurveImpl : public NON_EXPORTED_BASE(blink::WebGestureCurve) { |
23 | |
24 class CONTENT_EXPORT WebGestureCurveImpl | |
25 : public NON_EXPORTED_BASE(blink::WebGestureCurve) { | |
26 public: | 21 public: |
27 static scoped_ptr<blink::WebGestureCurve> CreateFromDefaultPlatformCurve( | 22 static scoped_ptr<blink::WebGestureCurve> CreateFromDefaultPlatformCurve( |
28 const gfx::Vector2dF& initial_velocity, | 23 const gfx::Vector2dF& initial_velocity, |
29 const gfx::Vector2dF& initial_offset, | 24 const gfx::Vector2dF& initial_offset, |
30 bool on_main_thread); | 25 bool on_main_thread); |
31 static scoped_ptr<blink::WebGestureCurve> CreateFromUICurveForTesting( | 26 static scoped_ptr<blink::WebGestureCurve> CreateFromUICurveForTesting( |
32 scoped_ptr<ui::GestureCurve> curve, | 27 scoped_ptr<GestureCurve> curve, |
33 const gfx::Vector2dF& initial_offset); | 28 const gfx::Vector2dF& initial_offset); |
34 | 29 |
35 virtual ~WebGestureCurveImpl(); | 30 virtual ~WebGestureCurveImpl(); |
36 | 31 |
37 // WebGestureCurve implementation. | 32 // WebGestureCurve implementation. |
38 virtual bool apply(double time, | 33 virtual bool apply(double time, |
39 blink::WebGestureCurveTarget* target) override; | 34 blink::WebGestureCurveTarget* target) override; |
40 | 35 |
41 private: | 36 private: |
42 enum class ThreadType { | 37 enum class ThreadType { |
43 MAIN, | 38 MAIN, |
44 IMPL, | 39 IMPL, |
45 TEST | 40 TEST |
46 }; | 41 }; |
47 | 42 |
48 WebGestureCurveImpl(scoped_ptr<ui::GestureCurve> curve, | 43 WebGestureCurveImpl(scoped_ptr<GestureCurve> curve, |
49 const gfx::Vector2dF& initial_offset, | 44 const gfx::Vector2dF& initial_offset, |
50 ThreadType animating_thread_type); | 45 ThreadType animating_thread_type); |
51 | 46 |
52 scoped_ptr<ui::GestureCurve> curve_; | 47 scoped_ptr<GestureCurve> curve_; |
53 | 48 |
54 gfx::Vector2dF last_offset_; | 49 gfx::Vector2dF last_offset_; |
55 | 50 |
56 ThreadType animating_thread_type_; | 51 ThreadType animating_thread_type_; |
57 int64 ticks_since_first_animate_; | 52 int64 ticks_since_first_animate_; |
58 double first_animate_time_; | 53 double first_animate_time_; |
59 double last_animate_time_; | 54 double last_animate_time_; |
60 | 55 |
61 DISALLOW_COPY_AND_ASSIGN(WebGestureCurveImpl); | 56 DISALLOW_COPY_AND_ASSIGN(WebGestureCurveImpl); |
62 }; | 57 }; |
63 | 58 |
64 } // namespace content | 59 } // namespace ui |
65 | 60 |
66 #endif // CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_ | 61 #endif // UI_EVENTS_GESTURES_BLINK_WEB_GESTURE_CURVE_IMPL_H_ |
OLD | NEW |