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