blob: 8d3758b60385370a312ce020faa418d5eb36c344 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
#define WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
#include "base/android/scoped_java_ref.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurve.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
#include "ui/gfx/point.h"
#include "ui/gfx/point_f.h"
namespace WebKit {
class WebGestureCurveTarget;
}
namespace webkit_glue {
class FlingAnimatorImpl : public WebKit::WebGestureCurve {
public:
FlingAnimatorImpl();
virtual ~FlingAnimatorImpl();
static FlingAnimatorImpl* CreateAndroidGestureCurve(
const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize&);
virtual bool apply(double time,
WebKit::WebGestureCurveTarget* target);
private:
void StartFling(const gfx::PointF& velocity);
// Returns true if the animation is not yet finished.
bool UpdatePosition();
gfx::Point GetCurrentPosition();
virtual void CancelFling();
bool is_active_;
// Java OverScroller instance and methods.
base::android::ScopedJavaGlobalRef<jobject> java_scroller_;
jmethodID fling_method_id_;
jmethodID abort_method_id_;
jmethodID compute_method_id_;
jmethodID getX_method_id_;
jmethodID getY_method_id_;
gfx::Point last_position_;
DISALLOW_COPY_AND_ASSIGN(FlingAnimatorImpl);
};
} // namespace webkit_glue
#endif // WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
|