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/WebFlingAnimator.h" | |
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurve.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurve.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
15 #include "ui/gfx/point.h" | 14 #include "ui/gfx/point.h" |
16 | 15 |
17 namespace WebKit { | 16 namespace WebKit { |
18 class WebGestureCurveTarget; | 17 class WebGestureCurveTarget; |
19 } | 18 } |
20 | 19 |
21 namespace webkit_glue { | 20 namespace webkit_glue { |
22 | 21 |
23 // TODO(rjkroege): Remove WebFlingAnimator once all of the gesture curve | 22 class FlingAnimatorImpl : public WebKit::WebGestureCurve { |
24 // implementation has moved to Chromium. | |
25 class FlingAnimatorImpl : public WebKit::WebFlingAnimator, | |
26 public WebKit::WebGestureCurve { | |
27 public: | 23 public: |
28 FlingAnimatorImpl(); | 24 FlingAnimatorImpl(); |
29 virtual ~FlingAnimatorImpl(); | 25 virtual ~FlingAnimatorImpl(); |
30 | 26 |
31 static FlingAnimatorImpl* CreateAndroidGestureCurve( | 27 static FlingAnimatorImpl* CreateAndroidGestureCurve( |
32 const WebKit::WebFloatPoint& velocity, | 28 const WebKit::WebFloatPoint& velocity, |
33 const WebKit::WebSize&); | 29 const WebKit::WebSize&); |
34 | 30 |
35 // WebKit::WebFlingAnimator methods. | |
36 virtual void startFling(const WebKit::WebFloatPoint& velocity, | |
37 const WebKit::WebRect& range); | |
38 // Returns true if the animation is not yet finished. | |
39 virtual bool updatePosition(); | |
40 virtual WebKit::WebPoint getCurrentPosition(); | |
41 virtual void cancelFling(); | |
42 | |
43 // WebKit::WebGestureCurve methods. | |
44 virtual bool apply(double time, | 31 virtual bool apply(double time, |
45 WebKit::WebGestureCurveTarget* target); | 32 WebKit::WebGestureCurveTarget* target); |
46 private: | 33 private: |
34 void startFling(const WebKit::WebFloatPoint& velocity, | |
jamesr
2012/12/01 01:47:19
if this isn't implementing exposed API and is just
rjkroege
2012/12/03 16:55:09
Done. And an assortment of other minor style nits.
| |
35 const WebKit::WebRect& range); | |
jamesr
2012/12/01 01:47:19
indentation - this should be aligned with the open
rjkroege
2012/12/03 16:55:09
Done.
| |
36 // Returns true if the animation is not yet finished. | |
37 bool updatePosition(); | |
38 WebKit::WebPoint getCurrentPosition(); | |
39 void cancelFling(); | |
40 | |
47 bool is_active_; | 41 bool is_active_; |
48 | 42 |
49 // Java OverScroller instance and methods. | 43 // Java OverScroller instance and methods. |
50 base::android::ScopedJavaGlobalRef<jobject> java_scroller_; | 44 base::android::ScopedJavaGlobalRef<jobject> java_scroller_; |
51 jmethodID fling_method_id_; | 45 jmethodID fling_method_id_; |
52 jmethodID abort_method_id_; | 46 jmethodID abort_method_id_; |
53 jmethodID compute_method_id_; | 47 jmethodID compute_method_id_; |
54 jmethodID getX_method_id_; | 48 jmethodID getX_method_id_; |
55 jmethodID getY_method_id_; | 49 jmethodID getY_method_id_; |
56 | 50 |
57 gfx::Point last_position_; | 51 gfx::Point last_position_; |
58 | 52 |
59 DISALLOW_COPY_AND_ASSIGN(FlingAnimatorImpl); | 53 DISALLOW_COPY_AND_ASSIGN(FlingAnimatorImpl); |
60 }; | 54 }; |
61 | 55 |
62 } // namespace webkit_glue | 56 } // namespace webkit_glue |
63 | 57 |
64 #endif // WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_ | 58 #endif // WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_ |
OLD | NEW |