blob: 026158ce9060d69d4195912b43e5023742b2627e (
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
57
58
59
60
61
62
63
64
65
66
|
// Copyright 2014 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 CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_
#define CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebGestureCurve.h"
#include "ui/gfx/geometry/vector2d_f.h"
namespace blink {
class WebGestureCurveTarget;
}
namespace ui {
class GestureCurve;
}
namespace content {
class CONTENT_EXPORT WebGestureCurveImpl
: public NON_EXPORTED_BASE(blink::WebGestureCurve) {
public:
static scoped_ptr<blink::WebGestureCurve> CreateFromDefaultPlatformCurve(
const gfx::Vector2dF& initial_velocity,
const gfx::Vector2dF& initial_offset,
bool on_main_thread);
static scoped_ptr<blink::WebGestureCurve> CreateFromUICurveForTesting(
scoped_ptr<ui::GestureCurve> curve,
const gfx::Vector2dF& initial_offset);
virtual ~WebGestureCurveImpl();
// WebGestureCurve implementation.
virtual bool apply(double time,
blink::WebGestureCurveTarget* target) override;
private:
enum class ThreadType {
MAIN,
IMPL,
TEST
};
WebGestureCurveImpl(scoped_ptr<ui::GestureCurve> curve,
const gfx::Vector2dF& initial_offset,
ThreadType animating_thread_type);
scoped_ptr<ui::GestureCurve> curve_;
gfx::Vector2dF last_offset_;
ThreadType animating_thread_type_;
int64 ticks_since_first_animate_;
double first_animate_time_;
double last_animate_time_;
DISALLOW_COPY_AND_ASSIGN(WebGestureCurveImpl);
};
} // namespace content
#endif // CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_
|