Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / webkit / glue / fling_animator_impl_android.h
blobe3d6bf8e3c151a6ad62462eb0111ded9ce1ca3b7
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
3 // found in the LICENSE file.
5 #ifndef WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
6 #define WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
8 #include "base/android/scoped_java_ref.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurve.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
12 #include "ui/gfx/point.h"
13 #include "ui/gfx/point_f.h"
14 #include "webkit/glue/webkit_glue_export.h"
16 namespace WebKit {
17 class WebGestureCurveTarget;
20 namespace webkit_glue {
22 class WEBKIT_GLUE_EXPORT FlingAnimatorImpl : public WebKit::WebGestureCurve {
23 public:
24 FlingAnimatorImpl();
25 virtual ~FlingAnimatorImpl();
27 static FlingAnimatorImpl* CreateAndroidGestureCurve(
28 const WebKit::WebFloatPoint& velocity,
29 const WebKit::WebSize&);
31 virtual bool apply(double time,
32 WebKit::WebGestureCurveTarget* target);
34 static bool RegisterJni(JNIEnv*);
36 private:
37 void StartFling(const gfx::PointF& velocity);
38 // Returns true if the animation is not yet finished.
39 bool UpdatePosition();
40 gfx::Point GetCurrentPosition();
41 virtual void CancelFling();
43 bool is_active_;
45 // Java OverScroller instance and methods.
46 base::android::ScopedJavaGlobalRef<jobject> java_scroller_;
48 gfx::Point last_position_;
50 DISALLOW_COPY_AND_ASSIGN(FlingAnimatorImpl);
53 } // namespace webkit_glue
55 #endif // WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_