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
3// found in the LICENSE file.
4
5#ifndef CONTENT_CHILD_FLING_ANIMATOR_IMPL_ANDROID_H_
6#define CONTENT_CHILD_FLING_ANIMATOR_IMPL_ANDROID_H_
7
8
9#include "third_party/WebKit/public/platform/WebFloatPoint.h"
10#include "third_party/WebKit/public/platform/WebGestureCurve.h"
11#include "third_party/WebKit/public/platform/WebSize.h"
12#include "ui/gfx/android/scroller.h"
13#include "ui/gfx/point_f.h"
14
15namespace blink {
16class WebGestureCurveTarget;
17}
18
19namespace content {
20
21class FlingAnimatorImpl : public blink::WebGestureCurve {
22 public:
23  FlingAnimatorImpl();
24  virtual ~FlingAnimatorImpl();
25
26  static FlingAnimatorImpl* CreateAndroidGestureCurve(
27      const blink::WebFloatPoint& velocity,
28      const blink::WebSize&);
29
30  virtual bool apply(double time, blink::WebGestureCurveTarget* target);
31
32 private:
33  void StartFling(const gfx::PointF& velocity);
34  void CancelFling();
35
36  bool is_active_;
37
38  gfx::Scroller scroller_;
39
40  gfx::PointF last_position_;
41
42  DISALLOW_COPY_AND_ASSIGN(FlingAnimatorImpl);
43};
44
45}  // namespace content
46
47#endif  // CONTENT_CHILD_FLING_ANIMATOR_IMPL_ANDROID_H_
48