OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_ | 5 #ifndef WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_ |
6 #define WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_ | 6 #define WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_ |
7 | 7 |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurve.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurve.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 FlingAnimatorImpl(); | 23 FlingAnimatorImpl(); |
24 virtual ~FlingAnimatorImpl(); | 24 virtual ~FlingAnimatorImpl(); |
25 | 25 |
26 static FlingAnimatorImpl* CreateAndroidGestureCurve( | 26 static FlingAnimatorImpl* CreateAndroidGestureCurve( |
27 const WebKit::WebFloatPoint& velocity, | 27 const WebKit::WebFloatPoint& velocity, |
28 const WebKit::WebSize&); | 28 const WebKit::WebSize&); |
29 | 29 |
30 virtual bool apply(double time, | 30 virtual bool apply(double time, |
31 WebKit::WebGestureCurveTarget* target); | 31 WebKit::WebGestureCurveTarget* target); |
| 32 |
| 33 static bool RegisterJni(JNIEnv*); |
| 34 |
32 private: | 35 private: |
33 void StartFling(const gfx::PointF& velocity); | 36 void StartFling(const gfx::PointF& velocity); |
34 // Returns true if the animation is not yet finished. | 37 // Returns true if the animation is not yet finished. |
35 bool UpdatePosition(); | 38 bool UpdatePosition(); |
36 gfx::Point GetCurrentPosition(); | 39 gfx::Point GetCurrentPosition(); |
37 virtual void CancelFling(); | 40 virtual void CancelFling(); |
38 | 41 |
39 bool is_active_; | 42 bool is_active_; |
40 | 43 |
41 // Java OverScroller instance and methods. | 44 // Java OverScroller instance and methods. |
42 base::android::ScopedJavaGlobalRef<jobject> java_scroller_; | 45 base::android::ScopedJavaGlobalRef<jobject> java_scroller_; |
43 jmethodID fling_method_id_; | |
44 jmethodID abort_method_id_; | |
45 jmethodID compute_method_id_; | |
46 jmethodID getX_method_id_; | |
47 jmethodID getY_method_id_; | |
48 | 46 |
49 gfx::Point last_position_; | 47 gfx::Point last_position_; |
50 | 48 |
51 DISALLOW_COPY_AND_ASSIGN(FlingAnimatorImpl); | 49 DISALLOW_COPY_AND_ASSIGN(FlingAnimatorImpl); |
52 }; | 50 }; |
53 | 51 |
54 } // namespace webkit_glue | 52 } // namespace webkit_glue |
55 | 53 |
56 #endif // WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_ | 54 #endif // WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_ |
OLD | NEW |