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 CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_ |
6 #define CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_ | 6 #define CONTENT_CHILD_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" | 10 #include "content/common/content_export.h" |
11 #include "third_party/WebKit/public/platform/WebGestureCurve.h" | 11 #include "third_party/WebKit/public/platform/WebGestureCurve.h" |
12 #include "ui/gfx/geometry/vector2d_f.h" | 12 #include "ui/gfx/geometry/vector2d_f.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 class WebGestureCurveTarget; | 15 class WebGestureCurveTarget; |
16 } | 16 } |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 class GestureCurve; | 19 class GestureCurve; |
20 } | 20 } |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 class CONTENT_EXPORT WebGestureCurveImpl | 24 class CONTENT_EXPORT WebGestureCurveImpl |
25 : public NON_EXPORTED_BASE(blink::WebGestureCurve) { | 25 : public NON_EXPORTED_BASE(blink::WebGestureCurve) { |
26 public: | 26 public: |
27 static scoped_ptr<blink::WebGestureCurve> CreateFromDefaultPlatformCurve( | 27 static scoped_ptr<blink::WebGestureCurve> CreateFromDefaultPlatformCurve( |
28 const gfx::Vector2dF& initial_velocity, | 28 const gfx::Vector2dF& initial_velocity, |
29 const gfx::Vector2dF& initial_offset); | 29 const gfx::Vector2dF& initial_offset, |
30 static scoped_ptr<blink::WebGestureCurve> CreateFrom( | 30 bool on_main_thread); |
| 31 static scoped_ptr<blink::WebGestureCurve> CreateFromUICurveForTesting( |
31 scoped_ptr<ui::GestureCurve> curve, | 32 scoped_ptr<ui::GestureCurve> curve, |
32 const gfx::Vector2dF& initial_offset); | 33 const gfx::Vector2dF& initial_offset); |
33 | 34 |
34 virtual ~WebGestureCurveImpl(); | 35 virtual ~WebGestureCurveImpl(); |
35 | 36 |
36 // WebGestureCurve implementation. | 37 // WebGestureCurve implementation. |
37 virtual bool apply(double time, | 38 virtual bool apply(double time, |
38 blink::WebGestureCurveTarget* target) override; | 39 blink::WebGestureCurveTarget* target) override; |
39 | 40 |
40 private: | 41 private: |
| 42 enum class ThreadType { |
| 43 MAIN, |
| 44 IMPL, |
| 45 TEST |
| 46 }; |
| 47 |
41 WebGestureCurveImpl(scoped_ptr<ui::GestureCurve> curve, | 48 WebGestureCurveImpl(scoped_ptr<ui::GestureCurve> curve, |
42 const gfx::Vector2dF& initial_offset); | 49 const gfx::Vector2dF& initial_offset, |
| 50 ThreadType animating_thread_type); |
43 | 51 |
44 scoped_ptr<ui::GestureCurve> curve_; | 52 scoped_ptr<ui::GestureCurve> curve_; |
45 | 53 |
46 gfx::Vector2dF last_offset_; | 54 gfx::Vector2dF last_offset_; |
47 | 55 |
| 56 ThreadType animating_thread_type_; |
| 57 int64 ticks_since_first_animate_; |
| 58 double first_animate_time_; |
| 59 double last_animate_time_; |
| 60 |
48 DISALLOW_COPY_AND_ASSIGN(WebGestureCurveImpl); | 61 DISALLOW_COPY_AND_ASSIGN(WebGestureCurveImpl); |
49 }; | 62 }; |
50 | 63 |
51 } // namespace content | 64 } // namespace content |
52 | 65 |
53 #endif // CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_ | 66 #endif // CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_ |
OLD | NEW |